Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ jobs:
run: |
docker run \
--env "CI=true" \
--env "RAISE_ON_WARNINGS=true" \
--env "DEPENDABOT_TEST_ACCESS_TOKEN=${{ secrets.GITHUB_TOKEN }}" \
--env "SUITE_NAME=${{ matrix.suite.name }}" \
--rm "$CORE_CI_IMAGE" bash -c \
Expand Down
2 changes: 1 addition & 1 deletion common/lib/dependabot/clients/bitbucket_with_retries.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def self.for_bitbucket_dot_org(credentials:)

def initialize(max_retries: 3, **args)
@max_retries = max_retries || 3
@client = Bitbucket.new(args)
@client = Bitbucket.new(**args)
end

def method_missing(method_name, *args, &block)
Expand Down
18 changes: 9 additions & 9 deletions common/spec/dependabot/dependency_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

RSpec.describe Dependabot::Dependency do
describe ".new" do
subject(:dependency) { described_class.new(args) }
subject(:dependency) { described_class.new(**args) }

let(:args) do
{
Expand Down Expand Up @@ -90,22 +90,22 @@
end

context "when two dependencies are equal" do
let(:dependency1) { described_class.new(args) }
let(:dependency2) { described_class.new(args) }
let(:dependency1) { described_class.new(**args) }
let(:dependency2) { described_class.new(**args) }

specify { expect(dependency1).to eq(dependency2) }
end

context "when two dependencies are not equal" do
let(:dependency1) { described_class.new(args) }
let(:dependency2) { described_class.new(args.merge(name: "dep2")) }
let(:dependency1) { described_class.new(**args) }
let(:dependency2) { described_class.new(**args.merge(name: "dep2")) }

specify { expect(dependency1).to_not eq(dependency2) }
end
end

describe "#production?" do
subject(:production?) { described_class.new(dependency_args).production? }
subject(:production?) { described_class.new(**dependency_args).production? }

let(:dependency_args) do
{
Expand Down Expand Up @@ -141,7 +141,7 @@
end

describe "#display_name" do
subject(:display_name) { described_class.new(dependency_args).display_name }
subject(:display_name) { described_class.new(**dependency_args).display_name }

let(:dependency_args) do
{
Expand All @@ -155,7 +155,7 @@
end

describe "#to_h" do
subject(:to_h) { described_class.new(dependency_args).to_h }
subject(:to_h) { described_class.new(**dependency_args).to_h }

context "with requirements" do
let(:dependency_args) do
Expand Down Expand Up @@ -221,7 +221,7 @@

describe "#subdependency_metadata" do
subject(:subdependency_metadata) do
described_class.new(dependency_args).subdependency_metadata
described_class.new(**dependency_args).subdependency_metadata
end

let(:dependency_args) do
Expand Down
2 changes: 1 addition & 1 deletion common/spec/dependabot/security_advisory_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
let(:vulnerable_versions) { [Gem::Requirement.new(">= 1")] }

describe ".new" do
subject(:security_advisory) { described_class.new(args) }
subject(:security_advisory) { described_class.new(**args) }

let(:args) do
{
Expand Down
4 changes: 2 additions & 2 deletions common/spec/dependabot/source_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

RSpec.describe Dependabot::Source do
describe ".new" do
subject { described_class.new(attrs) }
subject { described_class.new(**attrs) }

context "without a hostname or api_endpoint" do
let(:attrs) { { provider: "github", repo: "my/repo" } }
Expand Down Expand Up @@ -171,7 +171,7 @@
end

describe "#url_with_directory" do
let(:source) { described_class.new(attrs) }
let(:source) { described_class.new(**attrs) }
subject { source.url_with_directory }

let(:attrs) do
Expand Down
1 change: 1 addition & 0 deletions common/spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

require "dependabot/dependency_file"
require_relative "dummy_package_manager/dummy"
require_relative "warning_monkey_patch"

if ENV["COVERAGE"]
SimpleCov::Formatter::Console.output_style = "block"
Expand Down
23 changes: 23 additions & 0 deletions common/spec/warning_monkey_patch.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# frozen_string_literal: true

ALLOW_PATTERNS = [
# Ignore parser warnings for ruby 2.7 minor version mismatches
# TODO: Fix these by upgrading to ruby 2.7.3 (requires ubuntu upgrade)
%r{parser/current is loading parser/ruby27},
/2.7.\d-compliant syntax, but you are running 2.7.\d/,
%r{whitequark/parser}
].freeze

# Called internally by Ruby for all warnings
module Warning
def self.warn(message)
$stderr.print(message)

raise message if ENV["RAISE_ON_WARNINGS"].to_s == "true" && ALLOW_PATTERNS.none? { |pattern| pattern =~ message }

return unless ENV["DEBUG_WARNINGS"]

warn caller
$stderr.puts
end
end
2 changes: 1 addition & 1 deletion gradle/spec/dependabot/gradle_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

describe "Dependency#display_name" do
subject(:display_name) do
Dependabot::Dependency.new(dependency_args).display_name
Dependabot::Dependency.new(**dependency_args).display_name
end

let(:dependency_args) do
Expand Down
2 changes: 1 addition & 1 deletion maven/spec/dependabot/maven_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

describe "Dependency#display_name" do
subject(:display_name) do
Dependabot::Dependency.new(dependency_args).display_name
Dependabot::Dependency.new(**dependency_args).display_name
end

let(:dependency_args) do
Expand Down