Revert "correct rubocop offenses"

This reverts commit a4f4f0d5f9.
This commit is contained in:
Jon Ruskin 2022-12-22 15:24:46 -07:00
Родитель a4f4f0d5f9
Коммит 3054bc2f96
26 изменённых файлов: 47 добавлений и 47 удалений

Просмотреть файл

@ -15,7 +15,7 @@ module Licensed
method_option :format, aliases: "-f", enum: ["yaml", "json"], method_option :format, aliases: "-f", enum: ["yaml", "json"],
desc: "Output format" desc: "Output format"
def cache def cache
run Licensed::Commands::Cache.new(config:), run Licensed::Commands::Cache.new(config: config),
force: options[:force], sources: options[:sources], reporter: options[:format] force: options[:force], sources: options[:sources], reporter: options[:format]
end end
@ -30,7 +30,7 @@ module Licensed
enum: ["files", "configuration"], default: "files", enum: ["files", "configuration"], default: "files",
desc: "Whether to check compliance status from cached records or the configuration file" desc: "Whether to check compliance status from cached records or the configuration file"
def status def status
run Licensed::Commands::Status.new(config:), sources: options[:sources], reporter: options[:format], data_source: options[:data_source] run Licensed::Commands::Status.new(config: config), sources: options[:sources], reporter: options[:format], data_source: options[:data_source]
end end
desc "list", "List dependencies" desc "list", "List dependencies"
@ -43,7 +43,7 @@ module Licensed
method_option :licenses, aliases: "-l", type: :boolean, method_option :licenses, aliases: "-l", type: :boolean,
desc: "Include detected licenses in output" desc: "Include detected licenses in output"
def list def list
run Licensed::Commands::List.new(config:), sources: options[:sources], reporter: options[:format], licenses: options[:licenses] run Licensed::Commands::List.new(config: config), sources: options[:sources], reporter: options[:format], licenses: options[:licenses]
end end
desc "notices", "Generate a NOTICE file with dependency data" desc "notices", "Generate a NOTICE file with dependency data"
@ -54,7 +54,7 @@ module Licensed
method_option :computed, aliases: "-l", type: :boolean, method_option :computed, aliases: "-l", type: :boolean,
desc: "Whether to generate a NOTICE file using computed data or cached records" desc: "Whether to generate a NOTICE file using computed data or cached records"
def notices def notices
run Licensed::Commands::Notices.new(config:), sources: options[:sources], computed: options[:computed] run Licensed::Commands::Notices.new(config: config), sources: options[:sources], computed: options[:computed]
end end
map "-v" => :version map "-v" => :version
@ -70,7 +70,7 @@ module Licensed
method_option :config, aliases: "-c", type: :string, method_option :config, aliases: "-c", type: :string,
desc: "Path to licensed configuration file" desc: "Path to licensed configuration file"
def env def env
run Licensed::Commands::Environment.new(config:), reporter: options[:format] run Licensed::Commands::Environment.new(config: config), reporter: options[:format]
end end
desc "migrate", "Migrate from a previous version of licensed" desc "migrate", "Migrate from a previous version of licensed"

Просмотреть файл

@ -74,7 +74,7 @@ module Licensed
# Is the given dependency reviewed? # Is the given dependency reviewed?
def reviewed?(dependency, match_version: false) def reviewed?(dependency, match_version: false)
any_list_pattern_matched? self["reviewed"][dependency["type"]], dependency, match_version: any_list_pattern_matched? self["reviewed"][dependency["type"]], dependency, match_version: match_version
end end
# Find all reviewed dependencies that match the provided dependency's name # Find all reviewed dependencies that match the provided dependency's name

Просмотреть файл

@ -37,7 +37,7 @@ module Licensed
raise ArgumentError, "dependency path #{path} must be absolute" raise ArgumentError, "dependency path #{path} must be absolute"
end end
super(path, search_root:, detect_readme: true, detect_packages: true) super(path, search_root: search_root, detect_readme: true, detect_packages: true)
end end
# Returns whether the dependency exists locally # Returns whether the dependency exists locally

Просмотреть файл

@ -17,7 +17,7 @@ module Licensed
Dependency.new( Dependency.new(
name: package["name"], name: package["name"],
version: package["version"] || package["_release"], version: package["version"] || package["_release"],
path:, path: path,
metadata: { metadata: {
"type" => Bower.type, "type" => Bower.type,
"summary" => package["description"], "summary" => package["description"],

Просмотреть файл

@ -15,7 +15,7 @@ module Licensed
def initialize(name:, version:, path:, loaded_from:, errors: [], metadata: {}) def initialize(name:, version:, path:, loaded_from:, errors: [], metadata: {})
@loaded_from = loaded_from @loaded_from = loaded_from
super name:, version:, path:, errors:, metadata: super name: name, version: version, path: path, errors: errors, metadata: metadata
end end
# Load a package manager file from the base Licensee::Projects::FsProject # Load a package manager file from the base Licensee::Projects::FsProject

Просмотреть файл

@ -44,14 +44,14 @@ module Licensed
spec = super(*args) spec = super(*args)
return spec unless spec.is_a?(LazySpecification) return spec unless spec.is_a?(LazySpecification)
Licensed::Bundler::MissingSpecification.new(name:, version:, platform:, source:) Licensed::Bundler::MissingSpecification.new(name: name, version: version, platform: platform, source: source)
end end
def __materialize__(*args) def __materialize__(*args)
spec = super(*args) spec = super(*args)
return spec if spec return spec if spec
Licensed::Bundler::MissingSpecification.new(name:, version:, platform:, source:) Licensed::Bundler::MissingSpecification.new(name: name, version: version, platform: platform, source: source)
end end
end end
end end

Просмотреть файл

@ -17,8 +17,8 @@ module Licensed
Dependency.new( Dependency.new(
name: package["name"], name: package["name"],
version: package["version"], version: package["version"],
path:, path: path,
search_root:, search_root: search_root,
errors: Array(package["error"]), errors: Array(package["error"]),
metadata: { metadata: {
"type" => Cabal.type, "type" => Cabal.type,

Просмотреть файл

@ -20,9 +20,9 @@ module Licensed
version = lockfile.version(name).version version = lockfile.version(name).version
Dependency.new( Dependency.new(
path:, path: path,
name:, name: name,
version:, version: version,
metadata: { "type" => Cocoapods.type } metadata: { "type" => Cocoapods.type }
) )
end end

Просмотреть файл

@ -31,7 +31,7 @@ module Licensed
Licensed::Dependency.new( Licensed::Dependency.new(
name: submodule_path, name: submodule_path,
version:, version: version,
path: config.pwd.join(displaypath), path: config.pwd.join(displaypath),
metadata: { metadata: {
"type" => self.class.type, "type" => self.class.type,

Просмотреть файл

@ -31,10 +31,10 @@ module Licensed
def load_csv(path, executable, configurations) def load_csv(path, executable, configurations)
@csv ||= begin @csv ||= begin
gradle_licenses_dir = File.join(path, GRADLE_LICENSES_PATH) gradle_licenses_dir = File.join(path, GRADLE_LICENSES_PATH)
Licensed::Sources::Gradle.gradle_command("generateLicenseReport", path:, executable:, configurations:) Licensed::Sources::Gradle.gradle_command("generateLicenseReport", path: path, executable: executable, configurations: configurations)
CSV.foreach(File.join(gradle_licenses_dir, GRADLE_LICENSES_CSV_NAME), headers: true).each_with_object({}) do |row, hsh| CSV.foreach(File.join(gradle_licenses_dir, GRADLE_LICENSES_CSV_NAME), headers: true).each_with_object({}) do |row, hsh|
name, _, version = row["artifact"].rpartition(":") name, _, version = row["artifact"].rpartition(":")
key = csv_key(name:, version:) key = csv_key(name: name, version: version)
hsh[key] = row["moduleLicenseUrl"] hsh[key] = row["moduleLicenseUrl"]
end end
ensure ensure
@ -56,7 +56,7 @@ module Licensed
def initialize(name:, version:, path:, executable:, configurations:, metadata: {}) def initialize(name:, version:, path:, executable:, configurations:, metadata: {})
@configurations = configurations @configurations = configurations
@executable = executable @executable = executable
super(name:, version:, path:, metadata:) super(name: name, version: version, path: path, metadata: metadata)
end end
# Returns whether the dependency content exists # Returns whether the dependency content exists
@ -84,14 +84,14 @@ module Licensed
end end
def enumerate_dependencies def enumerate_dependencies
JSON.parse(self.class.gradle_command("printDependencies", path: config.pwd, executable: gradle_executable, configurations:)).map do |package| JSON.parse(self.class.gradle_command("printDependencies", path: config.pwd, executable: gradle_executable, configurations: configurations)).map do |package|
name = "#{package["group"]}:#{package["name"]}" name = "#{package["group"]}:#{package["name"]}"
Dependency.new( Dependency.new(
name:, name: name,
version: package["version"], version: package["version"],
path: config.pwd, path: config.pwd,
executable: gradle_executable, executable: gradle_executable,
configurations:, configurations: configurations,
metadata: { metadata: {
"type" => Gradle.type "type" => Gradle.type
} }

Просмотреть файл

@ -17,7 +17,7 @@ module Licensed
name: package_name, name: package_name,
version: contents_version(*sources), version: contents_version(*sources),
path: configured_license_path(package_name) || sources_license_path(sources), path: configured_license_path(package_name) || sources_license_path(sources),
sources:, sources: sources,
metadata: { metadata: {
"type" => Manifest.type, "type" => Manifest.type,
"name" => package_name "name" => package_name
@ -180,7 +180,7 @@ module Licensed
def initialize(name:, version:, path:, sources:, metadata: {}) def initialize(name:, version:, path:, sources:, metadata: {})
@sources = sources @sources = sources
super(name:, version:, path:, metadata:) super(name: name, version: version, path: path, metadata: metadata)
end end
def project_files def project_files

Просмотреть файл

@ -40,7 +40,7 @@ module Licensed
Dependency.new( Dependency.new(
name: pkg[:name], name: pkg[:name],
version: pkg[:version], version: pkg[:version],
path:, path: path,
metadata: pkg[:metadata].merge("type" => self.class.type), metadata: pkg[:metadata].merge("type" => self.class.type),
errors: errors + Array(pkg[:error]) errors: errors + Array(pkg[:error])
) )

Просмотреть файл

@ -33,7 +33,7 @@ module Licensed
errors = package["problems"] unless package["path"] errors = package["problems"] unless package["path"]
Dependency.new( Dependency.new(
name:, name: name,
version: package["version"] || package["required"], version: package["version"] || package["required"],
path: package["path"], path: package["path"],
errors: Array(errors), errors: Array(errors),

Просмотреть файл

@ -202,8 +202,8 @@ module Licensed
NuGetDependency.new( NuGetDependency.new(
name: id, name: id,
version:, version: version,
path:, path: path,
errors: Array(error), errors: Array(error),
metadata: { metadata: {
"type" => NuGet.type, "type" => NuGet.type,

Просмотреть файл

@ -19,9 +19,9 @@ module Licensed
error = "Unable to determine project path from #{url}" unless path error = "Unable to determine project path from #{url}" unless path
Dependency.new( Dependency.new(
name:, name: name,
path:, path: path,
version:, version: version,
errors: Array(error), errors: Array(error),
metadata: { metadata: {
"type" => Swift.type, "type" => Swift.type,

Просмотреть файл

@ -13,7 +13,7 @@ module Licensed
def enumerate_dependencies def enumerate_dependencies
packages.map do |name, package| packages.map do |name, package|
Dependency.new( Dependency.new(
name:, name: name,
version: package["version"], version: package["version"],
path: package["path"], path: package["path"],
metadata: { metadata: {

Просмотреть файл

@ -20,7 +20,7 @@ module Licensed
def enumerate_dependencies def enumerate_dependencies
packages.map do |name, package| packages.map do |name, package|
Dependency.new( Dependency.new(
name:, name: name,
version: package["version"], version: package["version"],
path: package["path"], path: package["path"],
metadata: { metadata: {

Просмотреть файл

@ -10,7 +10,7 @@ describe Licensed::Commands::Cache do
let(:source_config) { {} } let(:source_config) { {} }
let(:config) { Licensed::Configuration.new("apps" => apps, "cache_path" => cache_path, "sources" => { "test" => true }, "test" => source_config) } let(:config) { Licensed::Configuration.new("apps" => apps, "cache_path" => cache_path, "sources" => { "test" => true }, "test" => source_config) }
let(:reporter) { TestReporter.new } let(:reporter) { TestReporter.new }
let(:command) { Licensed::Commands::Cache.new(config:) } let(:command) { Licensed::Commands::Cache.new(config: config) }
let(:fixtures) { File.expand_path("../../fixtures", __FILE__) } let(:fixtures) { File.expand_path("../../fixtures", __FILE__) }
after do after do

Просмотреть файл

@ -172,7 +172,7 @@ describe Licensed::Commands::Command do
it "uses a passed in reporter if given" do it "uses a passed in reporter if given" do
reporter = Licensed::Reporters::StatusReporter.new reporter = Licensed::Reporters::StatusReporter.new
assert_equal reporter, command.create_reporter(reporter:) assert_equal reporter, command.create_reporter(reporter: reporter)
end end
it "uses the commands default_reporter by default" do it "uses the commands default_reporter by default" do

Просмотреть файл

@ -18,7 +18,7 @@ describe Licensed::Commands::Environment do
] ]
} }
let(:config) { Licensed::Configuration.new("apps" => apps, "sources" => { "test" => true }) } let(:config) { Licensed::Configuration.new("apps" => apps, "sources" => { "test" => true }) }
let(:command) { Licensed::Commands::Environment.new(config:) } let(:command) { Licensed::Commands::Environment.new(config: config) }
describe "#run" do describe "#run" do
let(:reporter) { TestReporter.new } let(:reporter) { TestReporter.new }

Просмотреть файл

@ -9,7 +9,7 @@ describe Licensed::Commands::List do
let(:apps) { [] } let(:apps) { [] }
let(:source_config) { {} } let(:source_config) { {} }
let(:config) { Licensed::Configuration.new("apps" => apps, "sources" => { "test" => true }, "test" => source_config) } let(:config) { Licensed::Configuration.new("apps" => apps, "sources" => { "test" => true }, "test" => source_config) }
let(:command) { Licensed::Commands::List.new(config:) } let(:command) { Licensed::Commands::List.new(config: config) }
let(:fixtures) { File.expand_path("../../fixtures", __FILE__) } let(:fixtures) { File.expand_path("../../fixtures", __FILE__) }
each_source do |source_class| each_source do |source_class|

Просмотреть файл

@ -8,7 +8,7 @@ describe Licensed::Commands::Notices do
let(:cache_path) { Dir.mktmpdir } let(:cache_path) { Dir.mktmpdir }
let(:reporter) { TestReporter.new } let(:reporter) { TestReporter.new }
let(:config) { Licensed::Configuration.new("cache_path" => cache_path, "sources" => { "test" => true }) } let(:config) { Licensed::Configuration.new("cache_path" => cache_path, "sources" => { "test" => true }) }
let(:command) { Licensed::Commands::Notices.new(config:) } let(:command) { Licensed::Commands::Notices.new(config: config) }
before do before do
generator_config = Marshal.load(Marshal.dump(config)) generator_config = Marshal.load(Marshal.dump(config))

Просмотреть файл

@ -11,7 +11,7 @@ describe Licensed::Commands::Status do
let(:source_config) { {} } let(:source_config) { {} }
let(:config) { Licensed::Configuration.new("apps" => apps, "cache_path" => cache_path, "sources" => { "test" => true }, "test" => source_config) } let(:config) { Licensed::Configuration.new("apps" => apps, "cache_path" => cache_path, "sources" => { "test" => true }, "test" => source_config) }
let(:fixtures) { File.expand_path("../../fixtures", __FILE__) } let(:fixtures) { File.expand_path("../../fixtures", __FILE__) }
let(:command) { Licensed::Commands::Status.new(config:) } let(:command) { Licensed::Commands::Status.new(config: config) }
def dependency_errors(app, source, dependency_name = "dependency") def dependency_errors(app, source, dependency_name = "dependency")
app_report = reporter.report.reports.find { |r| r.name == app["name"] } app_report = reporter.report.reports.find { |r| r.name == app["name"] }

Просмотреть файл

@ -162,7 +162,7 @@ if Licensed::Shell.tool_available?("dotnet")
dep = Licensed::Sources::NuGet::NuGetDependency.new( dep = Licensed::Sources::NuGet::NuGetDependency.new(
name: "test", name: "test",
version: "1.0", version: "1.0",
path:, path: path,
metadata: { metadata: {
"name" => "test" "name" => "test"
} }

Просмотреть файл

@ -4,7 +4,7 @@ module CommandTestHelpers
def run_command(**options) def run_command(**options)
if defined?(reporter) && !options.key?(:reporter) if defined?(reporter) && !options.key?(:reporter)
# automatically set the defined reporter if a reporter is not explicitly set # automatically set the defined reporter if a reporter is not explicitly set
options = options.merge(reporter:) options = options.merge(reporter: reporter)
end end
# expects the test class to define "command" # expects the test class to define "command"

Просмотреть файл

@ -12,7 +12,7 @@ class TestShell < Licensed::UI::Shell
return unless level?("debug") return unless level?("debug")
@messages << { @messages << {
message: msg, message: msg,
newline:, newline: newline,
style: :debug style: :debug
} }
end end
@ -21,7 +21,7 @@ class TestShell < Licensed::UI::Shell
return unless level?("info") return unless level?("info")
@messages << { @messages << {
message: msg, message: msg,
newline:, newline: newline,
style: :info style: :info
} }
end end
@ -30,7 +30,7 @@ class TestShell < Licensed::UI::Shell
return unless level?("confirm") return unless level?("confirm")
@messages << { @messages << {
message: msg, message: msg,
newline:, newline: newline,
style: :confirm style: :confirm
} }
end end
@ -39,7 +39,7 @@ class TestShell < Licensed::UI::Shell
return unless level?("warn") return unless level?("warn")
@messages << { @messages << {
message: msg, message: msg,
newline:, newline: newline,
style: :warn style: :warn
} }
end end
@ -48,7 +48,7 @@ class TestShell < Licensed::UI::Shell
return unless level?("error") return unless level?("error")
@messages << { @messages << {
message: msg, message: msg,
newline:, newline: newline,
style: :error style: :error
} }
end end