Skip to content

Commit

Permalink
Enable All RSpec empty line cops (#9791)
Browse files Browse the repository at this point in the history
* Enable RSpec/EmptyLineAfterExample

* Enable RSpec/EmptyLineAfterExampleGroup

* Enable RSpec/EmptyLineAfterFinalLet

* Enable RSpec/EmptyLineAfterHook

* Enable RSpec/EmptyLineAfterSubject
  • Loading branch information
robaiken authored May 23, 2024
1 parent 098e683 commit 13bf811
Show file tree
Hide file tree
Showing 224 changed files with 2,776 additions and 37 deletions.
37 changes: 0 additions & 37 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,43 +90,6 @@ RSpec/DescribedClass:
- 'updater/spec/dependabot/api_client_spec.rb'
- 'updater/spec/dependabot/job_spec.rb'

# Offense count: 173
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: AllowConsecutiveOneLiners.
RSpec/EmptyLineAfterExample:
Enabled: false

# Offense count: 25
# This cop supports safe autocorrection (--autocorrect).
RSpec/EmptyLineAfterExampleGroup:
Exclude:
- 'common/spec/dependabot/pull_request_creator/message_builder_spec.rb'
- 'composer/spec/dependabot/composer/file_fetcher_spec.rb'
- 'docker/spec/dependabot/docker/file_updater_spec.rb'
- 'github_actions/spec/dependabot/github_actions/file_updater_spec.rb'
- 'gradle/spec/dependabot/gradle/file_updater_spec.rb'
- 'npm_and_yarn/spec/dependabot/npm_and_yarn/update_checker_spec.rb'
- 'pub/spec/dependabot/pub/requirements_spec.rb'
- 'pub/spec/dependabot/pub/update_checker_spec.rb'
- 'terraform/spec/dependabot/terraform/requirement_spec.rb'
- 'terraform/spec/dependabot/terraform/requirements_updater_spec.rb'

# Offense count: 2162
# This cop supports safe autocorrection (--autocorrect).
RSpec/EmptyLineAfterFinalLet:
Enabled: false

# Offense count: 114
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: AllowConsecutiveOneLiners.
RSpec/EmptyLineAfterHook:
Enabled: false

# Offense count: 288
# This cop supports safe autocorrection (--autocorrect).
RSpec/EmptyLineAfterSubject:
Enabled: false

# Offense count: 1286
# Configuration parameters: CountAsOne.
RSpec/ExampleLength:
Expand Down
1 change: 1 addition & 0 deletions bundler/helpers/v2/spec/functions_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

describe "#git_specs" do
let(:project_name) { "git_source" }

subject(:git_specs) do
in_tmp_folder do
Functions.git_specs(
Expand Down
2 changes: 2 additions & 0 deletions bundler/helpers/v2/spec/ruby_version_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@
include_context "when stubbing rubygems compact index"

let(:project_name) { "ruby_version_implied" }

before do
@ui = Bundler.ui
Bundler.ui = Bundler::UI::Silent.new
end

after { Bundler.ui = @ui }

it "updates to the most recent version" do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,13 @@

context "when the file does not include any child Gemfiles" do
let(:gemfile) { bundler_project_dependency_file("gemfile", filename: "Gemfile") }

it { is_expected.to eq([]) }
end

context "when the file does include a child Gemfile" do
let(:gemfile) { bundler_project_dependency_file("eval_gemfile_gemfile", filename: "Gemfile") }

it { is_expected.to eq(["backend/Gemfile"]) }

context "when path must be eval-ed" do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

context "when the file does not include any gemspecs" do
let(:gemfile) { bundler_project_dependency_file("gemfile", filename: "Gemfile") }

it { is_expected.to eq([]) }
end

Expand All @@ -32,6 +33,7 @@

context "when the file does include a gemspec reference" do
let(:gemfile) { bundler_project_dependency_file("imports_gemspec", filename: "Gemfile") }

it { is_expected.to eq([Pathname.new(".")]) }

context "when that has a path specified" do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@

context "when the file does include a path gemspec" do
let(:gemfile) { bundler_project_dependency_file("path_source", filename: "Gemfile") }

it { is_expected.to eq([Pathname.new("plugins/example")]) }

context "when the path must be eval-ed" do
Expand All @@ -56,6 +57,7 @@

context "when that is behind a conditional that is false" do
let(:gemfile) { bundler_project_dependency_file("path_source_if", filename: "Gemfile") }

it { is_expected.to eq([Pathname.new("plugins/example")]) }
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

context "when the file does not include any relative paths" do
let(:file_body) { bundler_project_dependency_file("gemfile", filename: "Gemfile").content }

it { is_expected.to eq([]) }
end

Expand Down Expand Up @@ -46,6 +47,7 @@
let(:file_body) do
'require_relative "../some_other_file.rb"'
end

it { is_expected.to eq(["../some_other_file.rb"]) }
end

Expand All @@ -54,19 +56,22 @@
let(:file_body) do
'require_relative "./my_file_#{raise %(hell)}"'
end

it { is_expected.to eq([]) }

context "when it can't be" do
let(:file_body) do
'require_relative "./my_file_#{unknown_var}"'
end

it { is_expected.to eq([]) }
end
end
# rubocop:enable Lint/InterpolationCheck

context "when dealing with a file that is already nested" do
let(:file_name) { "deeply/nested/Gemfile" }

it { is_expected.to eq(["deeply/some_other_file.rb"]) }
end
end
Expand Down
1 change: 1 addition & 0 deletions bundler/spec/dependabot/bundler/file_fetcher_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
end

before { allow(file_fetcher_instance).to receive(:commit).and_return("sha") }

before do
stub_request(:get, File.join(url, ".ruby-version?ref=sha"))
.with(headers: { "Authorization" => "token token" })
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

describe "the updated Gemfile" do
subject { prepared_dependency_files.find { |f| f.name == "Gemfile" } }

its(:content) { is_expected.to include('gem "business", "~> 1.4.0"') }
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,21 @@

context "when the file does not include the dependency" do
let(:dependency_name) { "dependabot-core" }

it { is_expected.to eq(false) }
end

context "when the file is just comments" do
let(:gemfile) do
Dependabot::DependencyFile.new(content: "#Lol this is just a comment", name: "Gemfile")
end

it { is_expected.to eq(false) }
end

context "when the file does include the dependency" do
let(:dependency_name) { "business" }

it { is_expected.to eq(true) }

context "when it's in a source block" do
Expand All @@ -66,6 +69,7 @@

context "when the file does not include the dependency" do
let(:dependency_name) { "dependabot-core" }

it { is_expected.to be_nil }
end

Expand All @@ -80,6 +84,7 @@
context "when the file does include the dependency" do
let(:dependency_name) { "business" }
let(:dependency_requirement_sting) { "~> 1.4.0" }

it { is_expected.to eq("~> 1.4.0") }

context "when doesn't specify a requirement" do
Expand Down Expand Up @@ -109,6 +114,7 @@

context "when doesn't match the original string" do
let(:dependency_requirement_sting) { "~> 1.4.0.pre.rc2" }

it { is_expected.to eq("~> 1.4.0.pre.rc2") }
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,26 +31,31 @@

context "when the file does not include the dependency" do
let(:dependency_name) { "dependabot-core" }

it { is_expected.to eq(false) }
end

context "when the file does include the dependency as `add_dependency`" do
let(:dependency_name) { "excon" }

it { is_expected.to eq(true) }
end

context "when the file does include the dependency as `add_runtime_dependency`" do
let(:dependency_name) { "bundler" }

it { is_expected.to eq(true) }
end

context "when the file does include the dependency as `add_development_dependency`" do
let(:dependency_name) { "webmock" }

it { is_expected.to eq(true) }
end

context "when the file loads the dependency dynamically" do
let(:dependency_name) { "rake" }

it { is_expected.to eq(false) }
end
end
Expand Down
Loading

0 comments on commit 13bf811

Please sign in to comment.