diff --git a/packages/data_taster/README.md b/packages/data_taster/README.md deleted file mode 100644 index efa4fba5..00000000 --- a/packages/data_taster/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# DataTaster - -TODO: Delete this and the text below, and describe your gem - -Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/data_taster`. To experiment with that code, run `bin/console` for an interactive prompt. - -## Installation - -TODO: Replace `UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG` with your gem name right after releasing it to RubyGems.org. Please do not do it earlier due to security reasons. Alternatively, replace this section with instructions to install your gem from git if you don't plan to release to RubyGems.org. - -Install the gem and add to the application's Gemfile by executing: - - $ bundle add UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG - -If bundler is not being used to manage dependencies, install the gem by executing: - - $ gem install UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG - -## Usage - -TODO: Write usage instructions here - -## Development - -After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment. - -To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org). - -## Contributing - -Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/data_taster. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/data_taster/blob/main/CODE_OF_CONDUCT.md). - -## License - -The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT). - -## Code of Conduct - -Everyone interacting in the DataTaster project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/data_taster/blob/main/CODE_OF_CONDUCT.md). diff --git a/packages/dep_shield/Gemfile.lock b/packages/dep_shield/Gemfile.lock index 89ba73c8..3d4ddd19 100644 --- a/packages/dep_shield/Gemfile.lock +++ b/packages/dep_shield/Gemfile.lock @@ -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) diff --git a/packages/dep_shield/dep_shield.gemspec b/packages/dep_shield/dep_shield.gemspec index 80fd38ee..7f811233 100644 --- a/packages/dep_shield/dep_shield.gemspec +++ b/packages/dep_shield/dep_shield.gemspec @@ -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 diff --git a/packages/dep_shield/docs/README.md b/packages/dep_shield/docs/README.md index b6acf138..653dfab5 100644 --- a/packages/dep_shield/docs/README.md +++ b/packages/dep_shield/docs/README.md @@ -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: @@ -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) diff --git a/packages/dep_shield/gemfiles/rails_6_0.gemfile b/packages/dep_shield/gemfiles/rails_6_0.gemfile index f6b7e6a7..e68f539c 100644 --- a/packages/dep_shield/gemfiles/rails_6_0.gemfile +++ b/packages/dep_shield/gemfiles/rails_6_0.gemfile @@ -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: "../" diff --git a/packages/dep_shield/gemfiles/rails_6_0.gemfile.lock b/packages/dep_shield/gemfiles/rails_6_0.gemfile.lock index 86fe1ad2..0bf432d1 100644 --- a/packages/dep_shield/gemfiles/rails_6_0.gemfile.lock +++ b/packages/dep_shield/gemfiles/rails_6_0.gemfile.lock @@ -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 @@ -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) @@ -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) @@ -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) @@ -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) @@ -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) @@ -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) @@ -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) @@ -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 diff --git a/packages/dep_shield/gemfiles/rails_6_1.gemfile b/packages/dep_shield/gemfiles/rails_6_1.gemfile index a578cf4f..3e04a46b 100644 --- a/packages/dep_shield/gemfiles/rails_6_1.gemfile +++ b/packages/dep_shield/gemfiles/rails_6_1.gemfile @@ -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: "../" diff --git a/packages/dep_shield/gemfiles/rails_6_1.gemfile.lock b/packages/dep_shield/gemfiles/rails_6_1.gemfile.lock index d27c0338..dadd9937 100644 --- a/packages/dep_shield/gemfiles/rails_6_1.gemfile.lock +++ b/packages/dep_shield/gemfiles/rails_6_1.gemfile.lock @@ -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 @@ -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) @@ -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) @@ -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) @@ -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) @@ -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) @@ -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) @@ -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) @@ -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 diff --git a/packages/dep_shield/gemfiles/rails_7_0.gemfile b/packages/dep_shield/gemfiles/rails_7_0.gemfile index c0b24228..dd11019b 100644 --- a/packages/dep_shield/gemfiles/rails_7_0.gemfile +++ b/packages/dep_shield/gemfiles/rails_7_0.gemfile @@ -4,9 +4,10 @@ source "https://rubygems.org" +gem "nokogiri", "< 1.16" gem "rails", "7.0.6" gem "rake", "~> 13.0" gem "rspec", "~> 3.0" -gem "rubocop", "~> 1.21" +gem "rubocop-powerhome", path: "../../rubocop-powerhome" gemspec path: "../" diff --git a/packages/dep_shield/gemfiles/rails_7_0.gemfile.lock b/packages/dep_shield/gemfiles/rails_7_0.gemfile.lock index 86de713a..37a153e0 100644 --- a/packages/dep_shield/gemfiles/rails_7_0.gemfile.lock +++ b/packages/dep_shield/gemfiles/rails_7_0.gemfile.lock @@ -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 @@ -78,6 +91,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) @@ -88,7 +105,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) @@ -118,10 +134,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) @@ -172,16 +190,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) @@ -193,12 +218,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) @@ -212,8 +231,12 @@ 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) + sqlite3 (1.4.4) thor (1.3.0) timeout (0.4.1) tomlrb (2.0.3) @@ -233,13 +256,16 @@ PLATFORMS DEPENDENCIES appraisal (~> 2.5.0) + combustion (~> 1.4) dep_shield! license_finder (>= 7.0) + nokogiri (< 1.16) rails (= 7.0.6) 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 diff --git a/packages/dep_shield/lib/dep_shield/todos.rb b/packages/dep_shield/lib/dep_shield/todos.rb index b5a1dfbe..462d8264 100644 --- a/packages/dep_shield/lib/dep_shield/todos.rb +++ b/packages/dep_shield/lib/dep_shield/todos.rb @@ -2,23 +2,23 @@ module DepShield class Todos - def todo_list - @todo_list ||= begin - paths = Rails.root.glob("**/.deprecation_todo.yml") + def initialize + @todo_list = {} + end + + def load(pathname) + return unless File.exist?(pathname) - paths.each_with_object({}) do |path, list| - todos = YAML.load_file(path) || {} + list = YAML.load_file(pathname) || {} - todos.each do |feature_name, dep_todos| - list[feature_name] ||= [] - list[feature_name] += dep_todos - end - end + list.each do |feature_name, dep_todos| + @todo_list[feature_name] ||= [] + @todo_list[feature_name] += dep_todos end end def allowed?(name, stack) - todo_list.fetch(name, []).any? do |allowed_file| + @todo_list.fetch(name, []).any? do |allowed_file| stack.join("\n").include? allowed_file end end diff --git a/packages/dep_shield/lib/dep_shield/version.rb b/packages/dep_shield/lib/dep_shield/version.rb index bcb2a580..9b4c3dab 100644 --- a/packages/dep_shield/lib/dep_shield/version.rb +++ b/packages/dep_shield/lib/dep_shield/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module DepShield - VERSION = "0.1.2" + VERSION = "0.2.1" end diff --git a/packages/dep_shield/spec/dep_shield/deprecation_spec.rb b/packages/dep_shield/spec/dep_shield/deprecation_spec.rb index 040ebb99..77235e87 100644 --- a/packages/dep_shield/spec/dep_shield/deprecation_spec.rb +++ b/packages/dep_shield/spec/dep_shield/deprecation_spec.rb @@ -6,6 +6,9 @@ context "#raise_or_capture!" do describe "configured to capture_deprecation" do before do + DepShield.todos.load(Rails.root.join("config", ".deprecation_todo.yml")) + DepShield.todos.load(Rails.root.join("config", ".empty_deprecation_todo.yml")) + allow(NitroConfig).to receive(:get).with("nitro_errors/capture_deprecation").and_return true end diff --git a/packages/dep_shield/spec/internal/config/extra/.deprecation_todo.yml b/packages/dep_shield/spec/internal/config/.empty_deprecation_todo.yml similarity index 100% rename from packages/dep_shield/spec/internal/config/extra/.deprecation_todo.yml rename to packages/dep_shield/spec/internal/config/.empty_deprecation_todo.yml