diff --git a/CHANGELOG.md b/CHANGELOG.md index e2511f3..5cfe2eb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,6 @@ -# v1.5.0 +# Changelog + +## v1.5.0 - Drop support for EOL Ruby 3.0 (EOL since April 1st 2024) - Drop support for EOL Rails 6.1 (EOL since October 1st 2024) @@ -7,98 +9,98 @@ - Fix `NoMethodError` when calling `selector_for?` or `anonymise_for!` on a model class without an `anonymise` config block - Include reference to anonymised record in `Anony::Result` to allow easier matching of results to records when using selectors. -# v1.4.0 +## v1.4.0 - Update cops to use `Base` rather than `Cop` as a base class as the latter has been deprecated -# v1.3.1 +## v1.3.1 - Update gc_ruboconfig development dependency to v5.0.0 -# v1.3.0 +## v1.3.0 - Add support for Ruby 3.2, 3.3 and Rails 7.1 - Drop support for EOL Ruby 2.6, 2.7 and Rails 6.0 -# v1.2.0 +## v1.2.0 - Add support for configuring multiple superclasses for the `DefineDeletionStrategy` cop [#98](https://github.com/gocardless/anony/pull/98) - Introduce helpers (selectors) for anonymising all a subject's records [#97](https://github.com/gocardless/anony/pull/97) -# v1.1.0 +## v1.1.0 - Drop ruby 2.4 and 2.5 support - Unpin ActiveSupport for Rails 7 -# v1.0.2 +## v1.0.2 - Unpin ActiveSupport for Rails 6 -# v1.0.1 +## v1.0.1 -* Throw a more useful exception when calling .anonymise without config [#53](https://github.com/gocardless/anony/pull/53) +- Throw a more useful exception when calling .anonymise without config [#53](https://github.com/gocardless/anony/pull/53) -# v1.0.0 +## v1.0.0 -* Create a result object when calling `anonymise!` [#44](https://github.com/gocardless/anony/pull/44) +- Create a result object when calling `anonymise!` [#44](https://github.com/gocardless/anony/pull/44) -# v0.8.0 +## v0.8.0 -* Improve the documentation [#45](https://github.com/gocardless/anony/pull/45) -* Rename fields strategy to overwrite [#46](https://github.com/gocardless/anony/pull/46) +- Improve the documentation [#45](https://github.com/gocardless/anony/pull/45) +- Rename fields strategy to overwrite [#46](https://github.com/gocardless/anony/pull/46) -# v0.7.3 +## v0.7.3 -* Allow customising the model superclass for the `DefineDeletionStrategy` cop [#36](https://github.com/gocardless/anony/pull/36) +- Allow customising the model superclass for the `DefineDeletionStrategy` cop [#36](https://github.com/gocardless/anony/pull/36) -# v0.7.2 +## v0.7.2 -* Add ability to prevent anonymisation with `skip_if` [#25](https://github.com/gocardless/anony/pull/25) +- Add ability to prevent anonymisation with `skip_if` [#25](https://github.com/gocardless/anony/pull/25) -# v0.7.1 +## v0.7.1 -* Fix breakage when applying a strategy multiple times [#35](https://github.com/gocardless/anony/pull/35) +- Fix breakage when applying a strategy multiple times [#35](https://github.com/gocardless/anony/pull/35) -# v0.7.0 +## v0.7.0 -* **BREAKING** Switch to nesting field-level configuration in a `fields` block +- **BREAKING*- Switch to nesting field-level configuration in a `fields` block [#32](https://github.com/gocardless/anony/pull/32). This should just be a case of switching `anonymise { ... }` to `anonymise { fields { ... } }` in most cases, but for more details please check the README. -* **BREAKING** `Anony::Strategies.register` was renamed to `Anony::FieldLevelStrategies.register`. +- **BREAKING*- `Anony::Strategies.register` was renamed to `Anony::FieldLevelStrategies.register`. -# v0.6.0 +## v0.6.0 -* Use ActiveRecord::Persistence#current_time_from_proper_timezone [#34](https://github.com/gocardless/anony/pull/34) +- Use ActiveRecord::Persistence#current_time_from_proper_timezone [#34](https://github.com/gocardless/anony/pull/34) -# v0.5.0 +## v0.5.0 -* Make `valid_anonymisation?` a class method [#24](https://github.com/gocardless/anony/pull/24) -* Allow dynamic registration of Anony::Strategies [#23](https://github.com/gocardless/anony/pull/23) -* Only apply anonymisation strategies to columns that are defined [#28](https://github.com/gocardless/anony/pull/28) +- Make `valid_anonymisation?` a class method [#24](https://github.com/gocardless/anony/pull/24) +- Allow dynamic registration of Anony::Strategies [#23](https://github.com/gocardless/anony/pull/23) +- Only apply anonymisation strategies to columns that are defined [#28](https://github.com/gocardless/anony/pull/28) -# v0.4.0 +## v0.4.0 -* Allow using a constant value as a strategy [#19](https://github.com/gocardless/anony/pull/19) +- Allow using a constant value as a strategy [#19](https://github.com/gocardless/anony/pull/19) -# v0.3.1 +## v0.3.1 -* Fix `anonymised_at` column [#13](https://github.com/gocardless/anony/pull/13) +- Fix `anonymised_at` column [#13](https://github.com/gocardless/anony/pull/13) -# v0.3.0 +## v0.3.0 -* Support `anonymised_at` column [#9](https://github.com/gocardless/anony/pull/9) +- Support `anonymised_at` column [#9](https://github.com/gocardless/anony/pull/9) -# v0.2.1 +## v0.2.1 -* Fix relative require in DefineDeletionStrategy cop [#8](https://github.com/gocardless/anony/pull/8) +- Fix relative require in DefineDeletionStrategy cop [#8](https://github.com/gocardless/anony/pull/8) -# v0.2 +## v0.2 -* Improve the README [#5](https://github.com/gocardless/anony/pulls/5) -* Use Rubocop for testing code style [#6](https://github.com/gocardless/anony/pulls/6) -* Add an [RSpec helper](https://github.com/gocardless/anony/blob/v0.2/README.md#testing) for testing [#7](https://github.com/gocardless/anony/pulls/7) +- Improve the README [#5](https://github.com/gocardless/anony/pulls/5) +- Use Rubocop for testing code style [#6](https://github.com/gocardless/anony/pulls/6) +- Add an [RSpec helper](https://github.com/gocardless/anony/blob/v0.2/README.md#testing) for testing [#7](https://github.com/gocardless/anony/pulls/7) -# v0.1 +## v0.1 Initial release. diff --git a/README.md b/README.md index 603dc42..29219b9 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,7 @@ class User < ActiveRecord::Base end end ``` + ```ruby irb(main):001:0> user = User.find(1) => # @@ -120,10 +121,10 @@ When a model is anonymised, an `Anony::Result` is returned. This allows the libr The result object has 3 attributes: - * `status` - If the model was `destroyed`, `overwritten`, `skipped` or the operation `failed` - * `fields` - In the event the model was `overwritten`, the fields that were updated (excludes timestamps) - * `error` - In the event the anonymisation `failed`, then the associated error. Note only rescues the following errors: `ActiveRecord::RecordNotSaved`, `ActiveRecord::RecordNotDestroyed`. Anything else is thrown. - * `record` - The model instance that was anonymised to produce this result. +* `status` - If the model was `destroyed`, `overwritten`, `skipped` or the operation `failed` +* `fields` - In the event the model was `overwritten`, the fields that were updated (excludes timestamps) +* `error` - In the event the anonymisation `failed`, then the associated error. Note only rescues the following errors: `ActiveRecord::RecordNotSaved`, `ActiveRecord::RecordNotDestroyed`. Anything else is thrown. +* `record` - The model instance that was anonymised to produce this result. For convenience, the result object can also be queried with `destroyed?`, `overwritten?`, `skipped?` and `failed?`, so that it can be directly interrogated or used in a `switch case` with the `status` property. @@ -131,11 +132,11 @@ For convenience, the result object can also be queried with `destroyed?`, `overw This library ships with a number of built-in strategies: - * **nilable** overwrites the field with `nil` - * **hex** overwrites the field with random hexadecimal characters - * **email** overwrites the field with an email - * **phone_number** overwrites the field with a dummy phone number - * **current_datetime** overwrites the field with `Time.zone.now` (using [ActiveSupport's TimeWithZone](https://api.rubyonrails.org/classes/ActiveSupport/TimeZone.html#method-i-now)) +* **nilable** overwrites the field with `nil` +* **hex** overwrites the field with random hexadecimal characters +* **email** overwrites the field with an email +* **phone_number** overwrites the field with a dummy phone number +* **current_datetime** overwrites the field with `Time.zone.now` (using [ActiveSupport's TimeWithZone](https://api.rubyonrails.org/classes/ActiveSupport/TimeZone.html#method-i-now)) ### Custom strategies @@ -205,7 +206,7 @@ class Manager < ApplicationRecord end ``` -``` +```shell irb(main):001:0> manager = Manager.first => # @@ -233,7 +234,7 @@ class Manager < ApplicationRecord end ``` -``` +```shell irb(main):001:0> manager = Manager.first => # @@ -348,7 +349,7 @@ end The result object will indicate the model was skipped: -``` +```shell irb(main):001:0> manager = Manager.find(1) => # @@ -368,7 +369,7 @@ available). If your configuration is incomplete, calling `#anonymise!` will rais `FieldsException` and will not return an `Anony:Result` object. This is perceived to a critical error as anony cannot safely anonymise the model. -``` +```shell irb(main):001:0> manager = Manager.find(1) => # @@ -409,7 +410,6 @@ Anony::Config.ignore_fields(:id, :created_at, :updated_at) By default, `Config.ignore_fields` is an empty array and all fields are considered anonymisable. - ## Testing This library ships with a set of useful RSpec examples for your specs. Just require them @@ -476,7 +476,7 @@ require: This cop ensures that all models in your application have defined an `anonymise` block. The output looks like this: -``` +```bash app/models/employee.rb:7:1: W: Lint/DefineDeletionStrategy: Define .anonymise for Employee, see https://github.com/gocardless/anony/blob/master/README.md for details: class Employee < ApplicationRecord ... @@ -492,17 +492,17 @@ Lint/DefineDeletionStrategy: ``` If your models use multiple superclasses, you can specify a list of superclasses in your `.rubocop.yml`. Note that you will have to specify `ApplicationRecord` explicitly in this list should you want to lint all models which inherit from `ApplicationRecord`. + ```yml Lint/DefineDeletionStrategy: ModelSuperclass: - Acme::Record - UmbrellaCorp::Record - ``` ## License & Contributing * Anony is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT). -* Bug reports and pull requests are welcome on GitHub at https://github.com/gocardless/anony. +* Bug reports and pull requests are welcome on GitHub at . GoCardless ♥ open source. If you do too, come [join us](https://gocardless.com/about/jobs). diff --git a/docs/COMPATIBILITY.md b/docs/COMPATIBILITY.md index b58cd68..bad7f1f 100644 --- a/docs/COMPATIBILITY.md +++ b/docs/COMPATIBILITY.md @@ -4,14 +4,14 @@ Our goal as Anony maintainers is for the library to be compatible with all suppo Specifically, any CRuby/MRI version that has not received an End of Life notice ([e.g. this notice for Ruby 2.1](https://www.ruby-lang.org/en/news/2017/04/01/support-of-ruby-2-1-has-ended/)) is supported. Similarly, any version of Rails listed as currently supported on [this page](http://guides.rubyonrails.org/maintenance_policy.html) is one we aim to support in Anony. -To that end, [our build matrix](../.circleci/config.yml) includes all these versions. +To that end, [our build matrix](../.github/workflows/test.yml) includes all these versions. Any time Anony doesn't work on a supported combination of Ruby and Rails, it's a bug, and can be reported [here](https://github.com/gocardless/Anony/issues). -# Deprecation +## Deprecation -Whenever a version of Ruby or Rails falls out of support, we will mirror that change in Anony by updating the build matrix and releasing a new major version. +Whenever a version of Ruby or Rails falls out of support, we will mirror that change in Anony by updating the build matrix and releasing a new minor version. At that point, we will close any issues that only affect the unsupported version, and may choose to remove any workarounds from the code that are only necessary for the unsupported version. -We will then bump the major version of Anony, to indicate the break in compatibility. Even if the new version of Anony happens to work on the unsupported version of Ruby or Rails, we consider compatibility to be broken at this point. +We will then bump the minor version of Anony, to indicate the break in compatibility. Even if the new version of Anony happens to work on the unsupported version of Ruby or Rails, we consider compatibility to be broken at this point. We do not change the major version, as we are not making breaking changes to our API and we expect users of the gem to be keeping up to date with supported versions of Ruby and Rails.