Skip to content

Commit

Permalink
Enable RSpec Example cops (dependabot#9811)
Browse files Browse the repository at this point in the history
* Enable RSpec/ExampleLength

* Enable RSpec/ExampleWording

* removing rubocop files

* lint fix

---------

Co-authored-by: AbdulFattaah Popoola <abdulapopoola@github.com>
Co-authored-by: Garry L Hurley Jr <166545206+GarryHurleyJr@users.noreply.github.com>
  • Loading branch information
3 people authored Jun 5, 2024
1 parent f4751e5 commit 043c487
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 27 deletions.
14 changes: 0 additions & 14 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,6 @@ RSpec/BeforeAfterAll:
RSpec/ExampleLength:
Max: 98

# Offense count: 13
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: CustomTransform, IgnoredWords, DisallowedExamples.
# DisallowedExamples: works
RSpec/ExampleWording:
Exclude:
- 'bundler/spec/dependabot/bundler/file_updater/requirement_replacer_spec.rb'
- 'go_modules/spec/dependabot/go_modules/version_spec.rb'
- 'nuget/spec/dependabot/nuget/version_spec.rb'
- 'python/spec/dependabot/python/version_spec.rb'
- 'swift/spec/dependabot/swift/metadata_finder_spec.rb'
- 'updater/spec/dependabot/job_spec.rb'
- 'updater/spec/dependabot/update_files_command_spec.rb'

# Offense count: 17
# This cop supports safe autocorrection (--autocorrect).
RSpec/ExpectActual:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
let(:updated_requirement) { ">=3.2, <5.0" }
let(:content) { %(gem "devise", "~>3.2") }

it "should include spaces between enumerated requirements" do
it "includes spaces between enumerated requirements" do
is_expected.to include(%(gem "devise", ">=3.2", "<5.0"))
end
end
Expand Down
2 changes: 1 addition & 1 deletion go_modules/spec/dependabot/go_modules/version_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@
end

sorted_versions.each do |v|
it "should equal itself #{v}" do
it "equals itself #{v}" do
expect(described_class.new(v)).to eq v
end
end
Expand Down
4 changes: 2 additions & 2 deletions nuget/spec/dependabot/nuget/version_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,11 @@
end

sorted_versions.each do |v|
it "should equal itself #{v}" do
it "equals itself #{v}" do
expect(described_class.new(v)).to eq v
end

it "should ignore the build identifier #{v}+build" do
it "ignores the build identifier #{v}+build" do
expect(described_class.new(v)).to eq described_class.new("#{v}+build")
end
end
Expand Down
4 changes: 2 additions & 2 deletions python/spec/dependabot/python/version_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,11 @@
end

sorted_versions.each do |v|
it "should equal itself #{v}" do
it "equals itself #{v}" do
expect(described_class.new(v)).to eq v
end
end
it "should handle missing version segments" do
it "handles missing version segments" do
expect(described_class.new("1")).to eq "v1.0"
expect(described_class.new("1")).to eq "v1.0.0"
end
Expand Down
4 changes: 2 additions & 2 deletions swift/spec/dependabot/swift/metadata_finder_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
)
end

it "works" do
it "returns the correct source URL" do
expect(finder.source_url).to eq "https://github.com/reactivecocoa/reactiveswift"
end
end
Expand All @@ -67,7 +67,7 @@
)
end

it "works" do
it "returns the correct source URL" do
expect(finder.source_url).to eq "https://github.com/reactivecocoa/reactiveswift"
end
end
Expand Down
2 changes: 1 addition & 1 deletion updater/spec/dependabot/job_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@
]
end

it "should be allowed" do
it "is allowed" do
dependency.metadata[:all_versions] = [
Dependabot::Dependency.new(
name: dependency_name,
Expand Down
8 changes: 4 additions & 4 deletions updater/spec/dependabot/update_files_command_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@

it_behaves_like "a fast-failed job"

it "it captures the exception and records to a update job error api" do
it "captures the exception and records to a update job error api" do
expect(service).to receive(:capture_exception)
expect(service).to receive(:record_update_job_error).with(
error_type: "update_files_error",
Expand All @@ -144,7 +144,7 @@
perform_job
end

it "it captures the exception and records the a update job unknown error api" do
it "captures the exception and records the a update job unknown error api" do
expect(service).to receive(:capture_exception)
expect(service).to receive(:record_update_job_unknown_error).with(
error_type: "update_files_error",
Expand All @@ -168,7 +168,7 @@

it_behaves_like "a fast-failed job"

it "it captures the exception and records to a update job error api" do
it "captures the exception and records to a update job error api" do
expect(service).to receive(:capture_exception)
expect(service).to receive(:record_update_job_error).with(
error_type: "update_files_error",
Expand All @@ -185,7 +185,7 @@
perform_job
end

it "it captures the exception and does not records the update job unknown error api" do
it "captures the exception and does not records the update job unknown error api" do
expect(service).to receive(:capture_exception)
expect(service).to_not receive(:record_update_job_unknown_error)

Expand Down

0 comments on commit 043c487

Please sign in to comment.