From c07b6cd5f8fa081e44eb9013c4394ed24eb6fef6 Mon Sep 17 00:00:00 2001 From: Peter Wagner <1559510+thepwagner@users.noreply.github.com> Date: Thu, 17 Jun 2021 19:01:38 -0400 Subject: [PATCH] enable Lint/* and autoformat --- .rubocop.yml | 34 +++++++++++++++++++ .../dependabot/file_fetchers/base_spec.rb | 2 +- .../message_builder_spec.rb | 16 ++++----- gradle/spec/dependabot/gradle/version_spec.rb | 2 +- maven/spec/dependabot/maven/version_spec.rb | 2 +- .../terraform/registry_client_spec.rb | 12 +++---- 6 files changed, 51 insertions(+), 17 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 18def914a1..77468bf061 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -21,38 +21,72 @@ Layout/RescueEnsureAlignment: Enabled: false Layout/SpaceAroundMethodCallOperator: Enabled: false +Lint/AmbiguousAssignment: + Enabled: true Lint/BinaryOperatorWithIdenticalOperands: Enabled: true +Lint/DeprecatedConstants: + Enabled: true Lint/DeprecatedOpenSSLConstant: Enabled: false +Lint/DuplicateBranch: + Enabled: false Lint/DuplicateElsifCondition: Enabled: false +Lint/DuplicateRegexpCharacterClassElement: + Enabled: true Lint/DuplicateRequire: Enabled: true Lint/DuplicateRescueException: Enabled: true +Lint/EmptyBlock: + Enabled: true +Lint/EmptyClass: + Enabled: true Lint/EmptyConditionalBody: Enabled: true Lint/EmptyFile: Enabled: true +Lint/EmptyInPattern: + Enabled: true Lint/FloatComparison: Enabled: true +Lint/LambdaWithoutLiteralBlock: + Enabled: true Lint/MissingSuper: Enabled: false Lint/MixedRegexpCaptureTypes: Enabled: false +Lint/NoReturnInBeginEndBlocks: + Enabled: false +Lint/NumberedParameterAssignment: + Enabled: true +Lint/OrAssignmentToConstant: + Enabled: true Lint/OutOfRangeRegexpRef: Enabled: true Lint/RaiseException: Enabled: false +Lint/RedundantDirGlobSort: + Enabled: true Lint/SelfAssignment: Enabled: true Lint/StructNewOverride: Enabled: false +Lint/SymbolConversion: + Enabled: true +Lint/ToEnumArguments: + Enabled: true Lint/TopLevelReturnWithArgument: Enabled: true Lint/TrailingCommaInAttributeDeclaration: Enabled: true +Lint/TripleQuotes: + Enabled: true +Lint/UnexpectedBlockArity: + Enabled: true +Lint/UnmodifiedReduceAccumulator: + Enabled: true Lint/UnreachableLoop: Enabled: true Lint/UselessMethodDefinition: diff --git a/common/spec/dependabot/file_fetchers/base_spec.rb b/common/spec/dependabot/file_fetchers/base_spec.rb index 913bb5ac06..e0956d2895 100644 --- a/common/spec/dependabot/file_fetchers/base_spec.rb +++ b/common/spec/dependabot/file_fetchers/base_spec.rb @@ -1332,7 +1332,7 @@ def fetch_files # `git clone` against a file:// URL that is filled by the test let(:repo_path) { Dir.mktmpdir } after { FileUtils.rm_rf(repo_path) } - let(:fill_repo) {} + let(:fill_repo) { nil } before do Dir.chdir(repo_path) do `git init .` diff --git a/common/spec/dependabot/pull_request_creator/message_builder_spec.rb b/common/spec/dependabot/pull_request_creator/message_builder_spec.rb index 2100108d50..51a3bff4ff 100644 --- a/common/spec/dependabot/pull_request_creator/message_builder_spec.rb +++ b/common/spec/dependabot/pull_request_creator/message_builder_spec.rb @@ -210,7 +210,7 @@ def commits_details(base:, head:) end context "with a security vulnerability fixed" do - let(:vulnerabilities_fixed) { { "business": [{}] } } + let(:vulnerabilities_fixed) { { business: [{}] } } it { is_expected.to start_with("[Security] Bump business") } end @@ -446,7 +446,7 @@ def commits_details(base:, head:) end context "with a security vulnerability fixed" do - let(:vulnerabilities_fixed) { { "business": [{}] } } + let(:vulnerabilities_fixed) { { business: [{}] } } it { is_expected.to start_with("chore(deps): [security] bump") } end @@ -489,7 +489,7 @@ def commits_details(base:, head:) end context "with a security vulnerability fixed" do - let(:vulnerabilities_fixed) { { "business": [{}] } } + let(:vulnerabilities_fixed) { { business: [{}] } } it { is_expected.to start_with("Upgrade: [Security] Bump") } end end @@ -505,7 +505,7 @@ def commits_details(base:, head:) it { is_expected.to start_with("⬆️ Bump business") } context "with a security vulnerability fixed" do - let(:vulnerabilities_fixed) { { "business": [{}] } } + let(:vulnerabilities_fixed) { { business: [{}] } } it { is_expected.to start_with("⬆️🔒 Bump business") } end end @@ -613,7 +613,7 @@ def commits_details(base:, head:) end context "with a security vulnerability fixed" do - let(:vulnerabilities_fixed) { { "business": [{}] } } + let(:vulnerabilities_fixed) { { business: [{}] } } it { is_expected.to start_with("[Security] Update business") } end @@ -667,7 +667,7 @@ def commits_details(base:, head:) end context "with a security vulnerability fixed" do - let(:vulnerabilities_fixed) { { "business": [{}] } } + let(:vulnerabilities_fixed) { { business: [{}] } } it { is_expected.to start_with("chore(deps): [security] update") } end end @@ -687,7 +687,7 @@ def commits_details(base:, head:) end context "with a security vulnerability fixed" do - let(:vulnerabilities_fixed) { { "business": [{}] } } + let(:vulnerabilities_fixed) { { business: [{}] } } it { is_expected.to start_with("Upgrade: [Security] Update") } end end @@ -1807,7 +1807,7 @@ def commits_details(base:, head:) it { is_expected.to start_with(":arrow_up: Bump ") } context "with a security vulnerability fixed" do - let(:vulnerabilities_fixed) { { "business": [{}] } } + let(:vulnerabilities_fixed) { { business: [{}] } } it { is_expected.to start_with(":arrow_up::lock: Bump ") } end end diff --git a/gradle/spec/dependabot/gradle/version_spec.rb b/gradle/spec/dependabot/gradle/version_spec.rb index f89a4bb590..a2082e678b 100644 --- a/gradle/spec/dependabot/gradle/version_spec.rb +++ b/gradle/spec/dependabot/gradle/version_spec.rb @@ -105,7 +105,7 @@ end describe "#<=>" do - subject { version.send(:"<=>", other_version) } + subject { version.send(:<=>, other_version) } context "compared to a Gem::Version" do context "that is lower" do diff --git a/maven/spec/dependabot/maven/version_spec.rb b/maven/spec/dependabot/maven/version_spec.rb index 4056c65616..97bda1c27c 100644 --- a/maven/spec/dependabot/maven/version_spec.rb +++ b/maven/spec/dependabot/maven/version_spec.rb @@ -110,7 +110,7 @@ end describe "#<=>" do - subject { version.send(:"<=>", other_version) } + subject { version.send(:<=>, other_version) } context "compared to a Gem::Version" do context "that is lower" do diff --git a/terraform/spec/dependabot/terraform/registry_client_spec.rb b/terraform/spec/dependabot/terraform/registry_client_spec.rb index 94050ccb94..8cac392f10 100644 --- a/terraform/spec/dependabot/terraform/registry_client_spec.rb +++ b/terraform/spec/dependabot/terraform/registry_client_spec.rb @@ -52,8 +52,8 @@ stub_request(:get, "https://#{hostname}/v1/providers/hashicorp/aws/versions").and_return( status: 200, body: { - "id": "hashicorp/aws", - "versions": [{ "version": "3.42.0" }, { "version": "3.41.0" }] + id: "hashicorp/aws", + versions: [{ version: "3.42.0" }, { version: "3.41.0" }] }.to_json ) client = described_class.new(hostname: hostname) @@ -97,7 +97,7 @@ "providers.v1": "/v1/providers/" }.to_json) stub_request(:get, "https://#{hostname}/v1/providers/x/y/versions"). - and_return(body: { "id": "x/y", "versions": [{ "version": "0.1.0" }] }.to_json) + and_return(body: { id: "x/y", versions: [{ version: "0.1.0" }] }.to_json) client = described_class.new(hostname: hostname, credentials: credentials) expect(client.all_provider_versions(identifier: "x/y")).to match_array([ @@ -126,10 +126,10 @@ }.to_json) stub_request(:get, "https://#{hostname}/api/registry/v1/modules/hashicorp/consul/aws/versions"). and_return(status: 200, body: { - "modules": [ + modules: [ { - "source": "hashicorp/consul/aws", - "versions": [{ "version": "0.1.0" }, { "version": "0.2.0" }] + source: "hashicorp/consul/aws", + versions: [{ version: "0.1.0" }, { version: "0.2.0" }] } ] }.to_json)