Skip to content

Commit

Permalink
DepShield: dynamically load todo lists (#239)
Browse files Browse the repository at this point in the history
This helps ensure the lists are included where they are needed and
avoids globbing (and in the case of componentized apps, the danger of
re-globbing per component)
  • Loading branch information
that-jill authored Feb 2, 2024
1 parent f0bbbaf commit a2435cb
Show file tree
Hide file tree
Showing 14 changed files with 168 additions and 106 deletions.
39 changes: 0 additions & 39 deletions packages/data_taster/README.md

This file was deleted.

4 changes: 2 additions & 2 deletions packages/dep_shield/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ PATH
PATH
remote: .
specs:
dep_shield (0.1.2)
dep_shield (0.2.1)
nitro_config
rails (>= 6.0.6.1, < 7.0)
rails (>= 6.0.6.1, <= 7.0.6)
sentry-rails (= 5.5.0)
sentry-ruby (= 5.5.0)

Expand Down
2 changes: 1 addition & 1 deletion packages/dep_shield/dep_shield.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Gem::Specification.new do |spec|
spec.add_development_dependency "sqlite3", "~> 1.4.2"

spec.add_dependency "nitro_config"
spec.add_dependency "rails", ">= 6.0.6.1", "< 7.0"
spec.add_dependency "rails", ">= 6.0.6.1", "<= 7.0.6"
spec.add_dependency "sentry-rails", "5.5.0"
spec.add_dependency "sentry-ruby", "5.5.0"
end
19 changes: 18 additions & 1 deletion packages/dep_shield/docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ Introducing DepShield, your go-to Ruby gem for proactive deprecation management

With DepShield, developers can stay ahead of the curve by receiving real-time alerts about deprecated code, ensuring a smoother transition to future updates. Tailor your development and demo environments to raise alarms, preventing the introduction of new deprecations. In addition, DepShield offers the flexibility to configure self-reporting mechanisms, allowing seamless issue notifications, configurable by environment Say goodbye to unexpected deprecation surprises and embrace a more streamlined and informed coding experience with DepShield!

## Setup

After installing DepShield, load any todo lists in your application with:

`DepShield.todos.load("path-to-deprecation_todos.yml")`

## Usage

`DepShield#raise_or_capture!` is used to mark methods as deprecated. When called, it will intelligently warn or raise exceptions to alert developers to the deprecated activity. The method expects two arguments, a `name` (ie, the name of the deprecation you're introducing), and a `message` (usually information about what is deprecated and how to fix it). Marking something as deprecated is pretty simple:
Expand All @@ -22,10 +28,21 @@ This is used in conjuction with NitroConfig to define how different environment
Option A: the result of this is a logged warning every time the method is called.
Option B: this will raise and notify our error catcher (Sentry).

If a developer needs to bypass this/defer fixing the deprecation to a future date, the call can be "grandfathered" by adding this information to the allowlist in `.deprecation_todo.yml` in the application/component that hosts the deprecated reference. For example, if you have a method in the `authors` component that references `Books.category`:
If a developer needs to bypass this/defer fixing the deprecation to a future date, the call can be "grandfathered" by adding this information to the allowlist in a `.deprecation_todo.yml` file in the application/component that hosts the deprecated reference. For example, if you have a method in the `authors` component that references `Books.category`:

```ruby
# components/authors/lib/book_information.rb

book_category = Books.category
```

You could disable this with:

```yml
# components/authors/.deprecation_todo.yml

books_default_category:
- components/authors/lib/book_information.rb
```
More details and another example can be found [here](https://github.com/powerhome/power-tools/blob/main/packages/dep_shield/spec/internal/config/.deprecation_todo.yml)
3 changes: 2 additions & 1 deletion packages/dep_shield/gemfiles/rails_6_0.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@

source "https://rubygems.org"

gem "nokogiri", "< 1.16"
gem "rails", "6.0.6.1"
gem "rake", "~> 13.0"
gem "rspec", "~> 3.0"
gem "rubocop", "~> 1.21"
gem "rubocop-powerhome", path: "../../rubocop-powerhome"

gemspec path: "../"
58 changes: 42 additions & 16 deletions packages/dep_shield/gemfiles/rails_6_0.gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,20 @@
PATH
remote: ../../rubocop-powerhome
specs:
rubocop-powerhome (0.5.2)
rubocop (~> 1.52.0)
rubocop-performance
rubocop-rails
rubocop-rake
rubocop-rspec

PATH
remote: ..
specs:
dep_shield (0.1.0)
dep_shield (0.2.1)
nitro_config
rails (>= 6.0.6.1, <= 7.0.6)
sentry-rails (= 5.5.0)
sentry-ruby (= 5.5.0)

GEM
Expand Down Expand Up @@ -68,6 +81,10 @@ GEM
thor (>= 0.14.0)
ast (2.4.2)
builder (3.2.4)
combustion (1.4.0)
activesupport (>= 3.0.0)
railties (>= 3.0.0)
thor (>= 0.14.6)
concurrent-ruby (1.2.3)
crass (1.0.6)
date (3.3.4)
Expand All @@ -78,7 +95,6 @@ GEM
i18n (1.14.1)
concurrent-ruby (~> 1.0)
json (2.7.1)
language_server-protocol (3.17.0.3)
license_finder (7.1.0)
bundler
rubyzip (>= 1, < 3)
Expand Down Expand Up @@ -108,10 +124,12 @@ GEM
net-smtp (0.4.0.1)
net-protocol
nio4r (2.7.0)
nokogiri (1.16.0-arm64-darwin)
nitro_config (0.2.0)
activesupport (>= 5.2.8.1)
nokogiri (1.15.5-arm64-darwin)
racc (~> 1.4)
parallel (1.24.0)
parser (3.3.0.4)
parser (3.3.0.5)
ast (~> 2.4.1)
racc
racc (1.7.3)
Expand Down Expand Up @@ -162,16 +180,23 @@ GEM
rspec-mocks (3.12.6)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.12.0)
rspec-rails (5.1.2)
actionpack (>= 5.2)
activesupport (>= 5.2)
railties (>= 5.2)
rspec-core (~> 3.10)
rspec-expectations (~> 3.10)
rspec-mocks (~> 3.10)
rspec-support (~> 3.10)
rspec-support (3.12.1)
rubocop (1.60.1)
rubocop (1.52.1)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
parser (>= 3.3.0.2)
parser (>= 3.2.2.3)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml (>= 3.2.5, < 4.0)
rubocop-ast (>= 1.30.0, < 2.0)
rubocop-ast (>= 1.28.0, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.30.0)
Expand All @@ -183,12 +208,6 @@ GEM
rubocop-performance (1.20.2)
rubocop (>= 1.48.1, < 2.0)
rubocop-ast (>= 1.30.0, < 2.0)
rubocop-powerhome (0.5.0)
rubocop
rubocop-performance
rubocop-rails
rubocop-rake
rubocop-rspec
rubocop-rails (2.23.1)
activesupport (>= 4.2.0)
rack (>= 1.1)
Expand All @@ -202,6 +221,9 @@ GEM
rubocop-factory_bot (~> 2.22)
ruby-progressbar (1.13.0)
rubyzip (2.3.2)
sentry-rails (5.5.0)
railties (>= 5.0)
sentry-ruby (~> 5.5.0)
sentry-ruby (5.5.0)
concurrent-ruby (~> 1.0, >= 1.0.2)
sprockets (4.2.1)
Expand All @@ -211,6 +233,7 @@ GEM
actionpack (>= 5.2)
activesupport (>= 5.2)
sprockets (>= 3.0.0)
sqlite3 (1.4.4)
thor (1.3.0)
thread_safe (0.3.6)
timeout (0.4.1)
Expand All @@ -231,13 +254,16 @@ PLATFORMS

DEPENDENCIES
appraisal (~> 2.5.0)
combustion (~> 1.4)
dep_shield!
license_finder (>= 7.0)
nokogiri (< 1.16)
rails (= 6.0.6.1)
rake (~> 13.0)
rspec (~> 3.0)
rubocop (~> 1.21)
rubocop-powerhome (= 0.5.0)
rspec-rails (~> 5.1.2)
rubocop-powerhome!
sqlite3 (~> 1.4.2)

BUNDLED WITH
2.5.4
3 changes: 2 additions & 1 deletion packages/dep_shield/gemfiles/rails_6_1.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@

source "https://rubygems.org"

gem "nokogiri", "< 1.16"
gem "rails", "6.1.7.4"
gem "rake", "~> 13.0"
gem "rspec", "~> 3.0"
gem "rubocop", "~> 1.21"
gem "rubocop-powerhome", path: "../../rubocop-powerhome"

gemspec path: "../"
58 changes: 42 additions & 16 deletions packages/dep_shield/gemfiles/rails_6_1.gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,20 @@
PATH
remote: ../../rubocop-powerhome
specs:
rubocop-powerhome (0.5.2)
rubocop (~> 1.52.0)
rubocop-performance
rubocop-rails
rubocop-rake
rubocop-rspec

PATH
remote: ..
specs:
dep_shield (0.1.0)
dep_shield (0.2.1)
nitro_config
rails (>= 6.0.6.1, <= 7.0.6)
sentry-rails (= 5.5.0)
sentry-ruby (= 5.5.0)

GEM
Expand Down Expand Up @@ -72,6 +85,10 @@ GEM
thor (>= 0.14.0)
ast (2.4.2)
builder (3.2.4)
combustion (1.4.0)
activesupport (>= 3.0.0)
railties (>= 3.0.0)
thor (>= 0.14.6)
concurrent-ruby (1.2.3)
crass (1.0.6)
date (3.3.4)
Expand All @@ -82,7 +99,6 @@ GEM
i18n (1.14.1)
concurrent-ruby (~> 1.0)
json (2.7.1)
language_server-protocol (3.17.0.3)
license_finder (7.1.0)
bundler
rubyzip (>= 1, < 3)
Expand Down Expand Up @@ -112,10 +128,12 @@ GEM
net-smtp (0.4.0.1)
net-protocol
nio4r (2.7.0)
nokogiri (1.16.0-arm64-darwin)
nitro_config (0.2.0)
activesupport (>= 5.2.8.1)
nokogiri (1.15.5-arm64-darwin)
racc (~> 1.4)
parallel (1.24.0)
parser (3.3.0.4)
parser (3.3.0.5)
ast (~> 2.4.1)
racc
racc (1.7.3)
Expand Down Expand Up @@ -166,16 +184,23 @@ GEM
rspec-mocks (3.12.6)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.12.0)
rspec-rails (5.1.2)
actionpack (>= 5.2)
activesupport (>= 5.2)
railties (>= 5.2)
rspec-core (~> 3.10)
rspec-expectations (~> 3.10)
rspec-mocks (~> 3.10)
rspec-support (~> 3.10)
rspec-support (3.12.1)
rubocop (1.60.1)
rubocop (1.52.1)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
parser (>= 3.3.0.2)
parser (>= 3.2.2.3)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml (>= 3.2.5, < 4.0)
rubocop-ast (>= 1.30.0, < 2.0)
rubocop-ast (>= 1.28.0, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.30.0)
Expand All @@ -187,12 +212,6 @@ GEM
rubocop-performance (1.20.2)
rubocop (>= 1.48.1, < 2.0)
rubocop-ast (>= 1.30.0, < 2.0)
rubocop-powerhome (0.5.0)
rubocop
rubocop-performance
rubocop-rails
rubocop-rake
rubocop-rspec
rubocop-rails (2.23.1)
activesupport (>= 4.2.0)
rack (>= 1.1)
Expand All @@ -206,6 +225,9 @@ GEM
rubocop-factory_bot (~> 2.22)
ruby-progressbar (1.13.0)
rubyzip (2.3.2)
sentry-rails (5.5.0)
railties (>= 5.0)
sentry-ruby (~> 5.5.0)
sentry-ruby (5.5.0)
concurrent-ruby (~> 1.0, >= 1.0.2)
sprockets (4.2.1)
Expand All @@ -215,6 +237,7 @@ GEM
actionpack (>= 5.2)
activesupport (>= 5.2)
sprockets (>= 3.0.0)
sqlite3 (1.4.4)
thor (1.3.0)
timeout (0.4.1)
tomlrb (2.0.3)
Expand All @@ -234,13 +257,16 @@ PLATFORMS

DEPENDENCIES
appraisal (~> 2.5.0)
combustion (~> 1.4)
dep_shield!
license_finder (>= 7.0)
nokogiri (< 1.16)
rails (= 6.1.7.4)
rake (~> 13.0)
rspec (~> 3.0)
rubocop (~> 1.21)
rubocop-powerhome (= 0.5.0)
rspec-rails (~> 5.1.2)
rubocop-powerhome!
sqlite3 (~> 1.4.2)

BUNDLED WITH
2.5.4
Loading

0 comments on commit a2435cb

Please sign in to comment.