diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..bfcd0ef --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,25 @@ +name: Lint + +on: + pull_request: + +permissions: + contents: read + +jobs: + rubocop: + name: Rubocop + runs-on: ubuntu-latest + + env: + BUNDLE_GITHUB__COM: ${{ format('x-access-token:{0}', secrets.FIZZY_GH_TOKEN) }} + + steps: + - uses: actions/checkout@v6 + - uses: ruby/setup-ruby@v1 + with: + ruby-version: .ruby-version + bundler-cache: true + + - name: Run Rubocop + run: bundle exec rubocop diff --git a/.rubocop.yml b/.rubocop.yml index f9d86d4..16773cd 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -6,3 +6,8 @@ inherit_gem: { rubocop-rails-omakase: rubocop.yml } # # Use `[a, [b, c]]` not `[ a, [ b, c ] ]` # Layout/SpaceInsideArrayLiteralBrackets: # Enabled: false + +AllCops: + Exclude: + - 'db/migrate/**/*' + - 'db/schema*.rb' diff --git a/Gemfile b/Gemfile index f978b0d..bb38297 100644 --- a/Gemfile +++ b/Gemfile @@ -5,3 +5,5 @@ git_source(:bc) { |repo| "https://github.com/basecamp/#{repo}" } gem "queenbee", bc: "queenbee-plugin", ref: "14312a940471e20617b38cdec7c092a01567d18b" gem "rails_structured_logging", bc: "rails-structured-logging" gem "activeresource", require: "active_resource" # needed by queenbee + +gem "rubocop-rails-omakase", require: false diff --git a/Gemfile.lock b/Gemfile.lock index 0dacabb..16c647b 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -101,6 +101,7 @@ GEM securerandom (>= 0.3) tzinfo (~> 2.0, >= 2.0.5) uri (>= 0.13.1) + ast (2.4.3) base64 (0.3.0) bigdecimal (3.2.3) builder (3.3.0) @@ -121,6 +122,8 @@ GEM rdoc (>= 4.0.0) reline (>= 0.4.2) json (2.16.0) + language_server-protocol (3.17.0.5) + lint_roller (1.1.0) logger (1.7.0) loofah (2.24.1) crass (~> 1.0.2) @@ -160,9 +163,14 @@ GEM racc (~> 1.4) nokogiri (1.18.10-x86_64-linux-musl) racc (~> 1.4) + parallel (1.27.0) + parser (3.3.10.0) + ast (~> 2.4.1) + racc pp (0.6.3) prettyprint prettyprint (0.2.0) + prism (1.6.0) psych (5.2.6) date stringio @@ -205,14 +213,45 @@ GEM thor (~> 1.0, >= 1.2.2) tsort (>= 0.2) zeitwerk (~> 2.6) + rainbow (3.1.1) rake (13.3.1) rdoc (6.15.1) erb psych (>= 4.0.0) tsort + regexp_parser (2.11.3) reline (0.6.3) io-console (~> 0.5) rexml (3.4.4) + rubocop (1.81.7) + json (~> 2.3) + language_server-protocol (~> 3.17.0.2) + lint_roller (~> 1.1.0) + parallel (~> 1.10) + parser (>= 3.3.0.2) + rainbow (>= 2.2.2, < 4.0) + regexp_parser (>= 2.9.3, < 3.0) + rubocop-ast (>= 1.47.1, < 2.0) + ruby-progressbar (~> 1.7) + unicode-display_width (>= 2.4.0, < 4.0) + rubocop-ast (1.48.0) + parser (>= 3.3.7.2) + prism (~> 1.4) + rubocop-performance (1.26.1) + lint_roller (~> 1.1) + rubocop (>= 1.75.0, < 2.0) + rubocop-ast (>= 1.47.1, < 2.0) + rubocop-rails (2.34.2) + activesupport (>= 4.2.0) + lint_roller (~> 1.1) + rack (>= 1.1) + rubocop (>= 1.75.0, < 2.0) + rubocop-ast (>= 1.44.0, < 2.0) + rubocop-rails-omakase (1.1.0) + rubocop (>= 1.72) + rubocop-performance (>= 1.24) + rubocop-rails (>= 2.30) + ruby-progressbar (1.13.0) securerandom (0.4.1) stringio (3.1.8) thor (1.4.0) @@ -220,6 +259,9 @@ GEM tsort (0.2.0) tzinfo (2.0.6) concurrent-ruby (~> 1.0) + unicode-display_width (3.2.0) + unicode-emoji (~> 4.1) + unicode-emoji (4.1.0) uri (1.0.3) useragent (0.16.11) websocket-driver (0.8.0) @@ -243,6 +285,7 @@ DEPENDENCIES activeresource queenbee! rails_structured_logging! + rubocop-rails-omakase BUNDLED WITH 2.7.0 diff --git a/lib/tasks/fizzy/saas_tasks.rake b/lib/tasks/fizzy/saas_tasks.rake index ea60d04..6b423e3 100644 --- a/lib/tasks/fizzy/saas_tasks.rake +++ b/lib/tasks/fizzy/saas_tasks.rake @@ -9,10 +9,9 @@ namespace :test do # end desc "Run tests for fizzy-saas gem" - Rake::TestTask.new(:saas => :environment) do |t| + Rake::TestTask.new(saas: :environment) do |t| t.libs << "test" t.test_files = FileList[Fizzy::Saas::Engine.root.join("test/**/*_test.rb")] t.warning = false end end -