diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8eb67b1..43e9607 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -10,3 +10,13 @@ jobs: ruby-version: 3.3 bundler-cache: true - run: bundle exec rake test + standardrb-check: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: ruby/setup-ruby@v1 + with: + ruby-version: 3.3 + bundler-cache: true + - run: bundle install + - run: bundle exec standardrb --format progress diff --git a/Gemfile b/Gemfile index 628a427..56c50b6 100644 --- a/Gemfile +++ b/Gemfile @@ -7,3 +7,4 @@ gem "benchmark-ips" gem "memory_profiler" gem "minitest" gem "rake" +gem "standard" diff --git a/lib/logstop/formatter.rb b/lib/logstop/formatter.rb index ce5651a..d2e2486 100644 --- a/lib/logstop/formatter.rb +++ b/lib/logstop/formatter.rb @@ -29,8 +29,12 @@ def call(severity, timestamp, progname, msg) end # for tagged logging - def method_missing(method_name, *arguments, &block) - @formatter.send(method_name, *arguments, &block) + def method_missing(method_name, ...) + @formatter.send(method_name, ...) + end + + def respond_to_missing?(method, include_private = false) + @formatter.respond_to?(method) || super end # for tagged logging diff --git a/lib/logstop/railtie.rb b/lib/logstop/railtie.rb index 6f1c683..3957a05 100644 --- a/lib/logstop/railtie.rb +++ b/lib/logstop/railtie.rb @@ -4,7 +4,9 @@ class Railtie < Rails::Railtie # make broadcaster inherit formatter if Rails.logger && Rails.logger.formatter.is_a?(Logstop::Formatter) # yes, these are the same, but it works + # rubocop:disable Lint/SelfAssignment Rails.logger.formatter = Rails.logger.formatter + # rubocop:enable Lint/SelfAssignment end end end diff --git a/logstop.gemspec b/logstop.gemspec index ef4fcd6..7653507 100644 --- a/logstop.gemspec +++ b/logstop.gemspec @@ -1,17 +1,17 @@ require_relative "lib/logstop/version" Gem::Specification.new do |spec| - spec.name = "logstop" - spec.version = Logstop::VERSION - spec.summary = "Keep personal data out of your logs" - spec.homepage = "https://github.com/ankane/logstop" - spec.license = "MIT" + spec.name = "logstop" + spec.version = Logstop::VERSION + spec.summary = "Keep personal data out of your logs" + spec.homepage = "https://github.com/ankane/logstop" + spec.license = "MIT" - spec.author = "Andrew Kane" - spec.email = "andrew@ankane.org" + spec.author = "Andrew Kane" + spec.email = "andrew@ankane.org" - spec.files = Dir["*.{md,txt}", "{lib}/**/*"] - spec.require_path = "lib" + spec.files = Dir["*.{md,txt}", "{lib}/**/*"] + spec.require_path = "lib" spec.required_ruby_version = ">= 3.1" end diff --git a/test/logstop_test.rb b/test/logstop_test.rb index 9081f37..782325f 100644 --- a/test/logstop_test.rb +++ b/test/logstop_test.rb @@ -99,7 +99,7 @@ def test_tagged_logging def test_scubber scubber = lambda do |msg| - msg.gsub(/hello/, "[FILTERED]") + msg.gsub("hello", "[FILTERED]") end assert_filtered "hello", scrubber: scubber