Skip to content

Commit

Permalink
Set up Rubocop pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
jrmhaig committed Mar 28, 2024
1 parent bf97748 commit c3bf562
Show file tree
Hide file tree
Showing 4 changed files with 99 additions and 31 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Rubocop

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
test:

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.2
bundler-cache: true
- name: Run Rubocop
run: bundle exec rubocop
4 changes: 2 additions & 2 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ require:
inherit_from: .rubocop_todo.yml

AllCops:
TargetRubyVersion: 2.5
TargetRubyVersion: 2.7
NewCops: enable
Layout/LineLength:
Max: 99
Max: 120
Naming/FileName:
Enabled: false
Style/ModuleFunction:
Expand Down
99 changes: 73 additions & 26 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -1,64 +1,84 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2021-07-10 17:38:28 UTC using RuboCop version 1.16.1.
# on 2023-10-02 15:42:47 UTC using RuboCop version 1.56.3.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
# versions of RuboCop, may require this file to be generated again.

# Offense count: 10
# Cop supports --auto-correct.
# Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
# URISchemes: http, https
Layout/LineLength:
Max: 110
# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: Severity, Include.
# Include: **/*.gemspec
Gemspec/DeprecatedAttributeAssignment:
Exclude:
- 'amoeba.gemspec'

# Offense count: 7
# Configuration parameters: EnforcedStyle, AllowedGems, Include.
# SupportedStyles: Gemfile, gems.rb, gemspec
# Include: **/*.gemspec, **/Gemfile, **/gems.rb
Gemspec/DevelopmentDependencies:
Exclude:
- 'amoeba.gemspec'

# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: Severity, Include.
# Include: **/*.gemspec
Gemspec/RequireMFA:
Exclude:
- 'amoeba.gemspec'

# Offense count: 1
# Configuration parameters: Severity, Include.
# Include: **/*.gemspec
Gemspec/RequiredRubyVersion:
Exclude:
- 'amoeba.gemspec'

# Offense count: 1
# Configuration parameters: AllowedParentClasses.
Lint/MissingSuper:
Exclude:
- 'lib/amoeba/macros/base.rb'

# Offense count: 17
# This cop supports unsafe autocorrection (--autocorrect-all).
Lint/UselessAssignment:
Exclude:
- 'spec/support/data.rb'

# Offense count: 8
# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods.
# IgnoredMethods: refine
Metrics/BlockLength:
Max: 339

# Offense count: 2
# Configuration parameters: CountComments, CountAsOne.
Metrics/ClassLength:
Max: 141
Max: 128

# Offense count: 3
# Configuration parameters: ForbiddenDelimiters.
# ForbiddenDelimiters: (?-mix:(^|\s)(EO[A-Z]{1}|END)(\s|$))
# ForbiddenDelimiters: (?i-mx:(^|\s)(EO[A-Z]{1}|END)(\s|$))
Naming/HeredocDelimiterNaming:
Exclude:
- 'lib/amoeba/config.rb'

# Offense count: 2
# Configuration parameters: EnforcedStyle, CheckMethodNames, CheckSymbols, AllowedIdentifiers.
# Configuration parameters: EnforcedStyle, CheckMethodNames, CheckSymbols, AllowedIdentifiers, AllowedPatterns.
# SupportedStyles: snake_case, normalcase, non_integer
# AllowedIdentifiers: capture3, iso8601, rfc1123_date, rfc822, rfc2822, rfc3339
# AllowedIdentifiers: capture3, iso8601, rfc1123_date, rfc822, rfc2822, rfc3339, x86_64
Naming/VariableNumber:
Exclude:
- 'spec/support/data.rb'

# Offense count: 1
RSpec/BeforeAfterAll:
Exclude:
- 'spec/spec_helper.rb'
- 'spec/rails_helper.rb'
- 'spec/support/**/*.rb'
- '**/spec/spec_helper.rb'
- '**/spec/rails_helper.rb'
- '**/spec/support/**/*.rb'
- 'spec/lib/amoeba_spec.rb'

# Offense count: 12
# Configuration parameters: Prefixes.
# Configuration parameters: Prefixes, AllowedPatterns.
# Prefixes: when, with, without
RSpec/ContextWording:
Exclude:
Expand All @@ -68,6 +88,11 @@ RSpec/ContextWording:
# Configuration parameters: IgnoredMetadata.
RSpec/DescribeClass:
Exclude:
- '**/spec/features/**/*'
- '**/spec/requests/**/*'
- '**/spec/routing/**/*'
- '**/spec/system/**/*'
- '**/spec/views/**/*'
- 'spec/lib/amoeba_spec.rb'

# Offense count: 3
Expand All @@ -86,33 +111,55 @@ RSpec/MultipleExpectations:
Max: 55

# Offense count: 18
# Configuration parameters: IgnoreSharedExamples.
# Configuration parameters: EnforcedStyle, IgnoreSharedExamples.
# SupportedStyles: always, named_only
RSpec/NamedSubject:
Exclude:
- 'spec/lib/amoeba_spec.rb'

# Offense count: 1
# Cop supports --auto-correct.
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: Strict, EnforcedStyle, AllowedExplicitMatchers.
# SupportedStyles: inflected, explicit
RSpec/PredicateMatcher:
Exclude:
- 'spec/lib/amoeba_spec.rb'

# Offense count: 5
# Cop supports --auto-correct.
# Offense count: 11
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: EnforcedStyle.
# SupportedStyles: always, always_true, never
Style/FrozenStringLiteralComment:
Exclude:
- 'gemfiles/activerecord_6.0.gemfile'
- 'gemfiles/activerecord_6.1.gemfile'
- 'gemfiles/activerecord_7.0.gemfile'
- 'gemfiles/activerecord_head.gemfile'
- 'gemfiles/jruby_activerecord_7.0.gemfile'
- 'gemfiles/jruby_activerecord_head.gemfile'
- 'spec/lib/amoeba_spec.rb'
- 'spec/spec_helper.rb'
- 'spec/support/data.rb'
- 'spec/support/models.rb'
- 'spec/support/schema.rb'

# Offense count: 25
# This cop supports safe autocorrection (--autocorrect).
Style/RedundantConstantBase:
Exclude:
- 'spec/lib/amoeba_spec.rb'
- 'spec/spec_helper.rb'
- 'spec/support/models.rb'

# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
Style/RedundantRegexpArgument:
Exclude:
- 'spec/lib/amoeba_spec.rb'

# Offense count: 5
# Cop supports --auto-correct.
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: Mode.
Style/StringConcatenation:
Exclude:
- 'spec/lib/amoeba_spec.rb'
Expand Down
6 changes: 3 additions & 3 deletions amoeba.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ Gem::Specification.new do |s|
s.require_paths = ['lib']

# specify any dependencies here; for example:
s.add_development_dependency 'rspec', '>= 3.0.0'
s.add_development_dependency 'rubocop', '~> 1.16'
s.add_development_dependency 'rspec', '~> 3.12'
s.add_development_dependency 'rubocop', '~> 1.56'
s.add_development_dependency 'rubocop-rake', '~> 0.6'
s.add_development_dependency 'rubocop-rspec', '~> 2.4'
s.add_development_dependency 'rubocop-rspec', '~> 2.24'

if RUBY_PLATFORM == 'java'
s.add_development_dependency 'activerecord-jdbc-adapter', '~> 70.0'
Expand Down

0 comments on commit c3bf562

Please sign in to comment.