Skip to content

Commit

Permalink
Add standardrb, fixes, and GH action for linting
Browse files Browse the repository at this point in the history
  • Loading branch information
joshmenden committed Oct 31, 2024
1 parent 2cb97f9 commit feba804
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 12 deletions.
10 changes: 10 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ gem "benchmark-ips"
gem "memory_profiler"
gem "minitest"
gem "rake"
gem "standard"
8 changes: 6 additions & 2 deletions lib/logstop/formatter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions lib/logstop/railtie.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
18 changes: 9 additions & 9 deletions logstop.gemspec
Original file line number Diff line number Diff line change
@@ -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 = "[email protected]"
spec.author = "Andrew Kane"
spec.email = "[email protected]"

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
2 changes: 1 addition & 1 deletion test/logstop_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit feba804

Please sign in to comment.