Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update rubocop and related gems #7

Merged
merged 12 commits into from
Feb 26, 2025
18 changes: 16 additions & 2 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
# Omakase Ruby styling for Rails
inherit_gem: { rubocop-rails-omakase: rubocop.yml }

require:
- rubocop-factory_bot
plugins:
- rubocop-performance
- rubocop-rails
- rubocop-rspec
require:
- rubocop-factory_bot
- rubocop-rspec_rails

AllCops:
Expand Down Expand Up @@ -39,10 +40,23 @@ Naming/VariableNumber:
- "spec/**/*.rb"

# Rspec
RSpec/ExampleLength:
Enabled: false
RSpec/ImplicitExpect:
Enabled: false
RSpec/ImplicitSubject:
Enabled: false
RSpec/IndexedLet:
Enabled: false
RSpec/LetSetup:
Enabled: false
RSpec/MessageSpies:
Enabled: false
RSpec/MultipleExpectations:
Enabled: false
RSpec/MultipleMemoizedHelpers:
AllowSubject: true
Max: 10

Style/StringLiterals:
EnforcedStyle: "double_quotes"
Expand Down
35 changes: 16 additions & 19 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ GEM
diff-lcs (1.6.0)
drb (2.2.1)
dsfr-assets (1.13.0.1)
dsfr-form_builder (0.0.3)
dsfr-form_builder (0.0.4)
actionview (>= 6.1, < 9.0)
activemodel (>= 6.1, < 9.0)
activesupport (>= 6.1, < 9.0)
Expand Down Expand Up @@ -301,9 +301,6 @@ GEM
net-smtp (0.5.1)
net-protocol
nio4r (2.7.4)
nokogiri (1.18.2)
mini_portile2 (~> 2.8.2)
racc (~> 1.4)
nokogiri (1.18.2-aarch64-linux-gnu)
racc (~> 1.4)
nokogiri (1.18.2-aarch64-linux-musl)
Expand All @@ -320,6 +317,9 @@ GEM
racc (~> 1.4)
nokogiri (1.18.2-x86_64-linux-musl)
racc (~> 1.4)
nokogiri (1.18.3)
mini_portile2 (~> 2.8.2)
racc (~> 1.4)
notiffany (0.1.3)
nenv (~> 0.1)
shellany (~> 0.0)
Expand Down Expand Up @@ -424,7 +424,7 @@ GEM
rspec-mocks (~> 3.13)
rspec-support (~> 3.13)
rspec-support (3.13.2)
rubocop (1.72.2)
rubocop (1.73.0)
json (~> 2.3)
language_server-protocol (~> 3.17.0.2)
lint_roller (~> 1.1.0)
Expand All @@ -435,29 +435,26 @@ GEM
rubocop-ast (>= 1.38.0, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 4.0)
rubocop-ast (1.38.0)
rubocop-ast (1.38.1)
parser (>= 3.3.1.0)
rubocop-capybara (2.21.0)
rubocop (~> 1.41)
rubocop-factory_bot (2.26.1)
rubocop (~> 1.61)
rubocop-minitest (0.36.0)
rubocop (>= 1.61, < 2.0)
rubocop-ast (>= 1.31.1, < 2.0)
rubocop-performance (1.23.1)
rubocop (>= 1.48.1, < 2.0)
rubocop-ast (>= 1.31.1, < 2.0)
rubocop-rails (2.30.1)
rubocop-performance (1.24.0)
lint_roller (~> 1.1)
rubocop (>= 1.72.1, < 2.0)
rubocop-ast (>= 1.38.0, < 2.0)
rubocop-rails (2.30.2)
activesupport (>= 4.2.0)
lint_roller (~> 1.1)
rack (>= 1.1)
rubocop (>= 1.72.1, < 2.0)
rubocop-ast (>= 1.38.0, < 2.0)
rubocop-rails-omakase (1.0.0)
rubocop
rubocop-minitest
rubocop-performance
rubocop-rails
rubocop-rails-omakase (1.1.0)
rubocop (>= 1.72)
rubocop-performance (>= 1.24)
rubocop-rails (>= 2.30)
rubocop-rspec (3.5.0)
lint_roller (~> 1.1)
rubocop (~> 1.72, >= 1.72.1)
Expand Down Expand Up @@ -533,7 +530,7 @@ GEM
unicode-display_width (3.1.4)
unicode-emoji (~> 4.0, >= 4.0.4)
unicode-emoji (4.0.4)
uri (1.0.2)
uri (1.0.3)
useragent (0.16.11)
view_component (3.21.0)
activesupport (>= 5.2.0, < 8.1)
Expand Down
1 change: 1 addition & 0 deletions spec/components/dsfr/table_component_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
[:sm, :md, :lg].each do |size|
context "when size is :#{size}" do
let(:params) { { caption: "Test Table", size: size } }

it "renders with correct size class" do
render_inline(component)
if size == :md
Expand Down
6 changes: 3 additions & 3 deletions spec/models/analyzers/accessibility_page_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,14 @@
let(:unrelated_link) { build(:link, text: "Contact", href: "/contact") }

it "returns nil for non-Link objects" do
expect(analyzer.likelihood_of("not a link")).to eq(nil)
expect(analyzer.likelihood_of("not a link")).to be_nil
end

it "returns 1 for links not matching any criteria" do
it "returns 1 for links not matching any criteria" do
expect(analyzer.likelihood_of(unrelated_link)).to eq(1)
end

it "returns 0 for links matching only one criteria" do
it "returns 0 for links matching only one criteria" do
expect(analyzer.likelihood_of(basic_link)).to eq(0)
end

Expand Down
8 changes: 6 additions & 2 deletions spec/models/audit_spec.rb
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
require "rails_helper"

RSpec.describe Audit do
let(:site) { create(:site) }
subject(:audit) { build(:audit, site: nil) }

let(:site) { create(:site) }

it "has a valid factory" do
audit = build(:audit)
expect(audit).to be_valid
end

describe "associations" do
it { is_expected.to belong_to(:site).touch(true) }

Check.names.each do |name|
it { is_expected.to have_one(name).dependent(:destroy) }
end
Expand Down Expand Up @@ -80,13 +82,14 @@
it "memoizes the result" do
audit.url = "https://example.com"
first_result = audit.url_without_scheme
allow(audit).to receive(:hostname).and_return("different.com")
allow(audit).to receive(:hostname).and_return("different.com") # rubocop:disable RSpec/SubjectStub
expect(audit.url_without_scheme).to eq(first_result)
end
end

describe "#all_checks" do
let(:audit) { build(:audit) }

it "returns all checks, building missing ones" do
checks = audit.all_checks
expect(checks.size).to eq(Check.types.size)
Expand All @@ -96,6 +99,7 @@

describe "#create_checks" do
let(:audit) { create(:audit) }

it "creates all check types" do
expect(audit.create_checks.size).to eq(Check.types.size)

Expand Down
Loading