Showing 46 of 62 total issues
File definitions.rb
has 450 lines of code (exceeds 250 allowed). Consider refactoring. Open
module LicenseFinder
class License
module Definitions
extend self
Class Decisions
has 41 methods (exceeds 20 allowed). Consider refactoring. Open
class Decisions
######
# READ
######
Class Configuration
has 40 methods (exceeds 20 allowed). Consider refactoring. Open
class Configuration
def self.with_optional_saved_config(primary_config)
project_path = Pathname(primary_config.fetch(:project_path, Pathname.pwd)).expand_path
config_file = project_path.join('config', 'license_finder.yml')
saved_config = config_file.exist? ? YAML.safe_load(config_file.read) : {}
Class License
has 30 methods (exceeds 20 allowed). Consider refactoring. Open
class License
module Definitions
extend self
def all
Class Package
has 22 methods (exceeds 20 allowed). Consider refactoring. Open
class Package
attr_reader :logger, :name, :version, :authors, :summary, :description, :children, :parents, :groups, :manual_approval, :license_names_from_spec, :install_path
def self.license_names_from_standard_spec(spec)
licenses = spec['licenses'] || [spec['license']].compact
File decisions.rb
has 261 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'open-uri'
require 'license_finder/license'
require 'license_finder/manual_licenses'
module LicenseFinder
Method prepare
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def prepare
if prepare_command
stdout, stderr, status = Dir.chdir(project_path) { Cmd.run(prepare_command) }
unless status.success?
log_errors stderr
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method longest_common_paths
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def self.longest_common_paths(paths)
[].tap do |common_paths|
# organize by matching root paths
paths_with_roots = paths.group_by { |path| path.split('/').first }
paths_with_roots.each do |common_root, full_paths|
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method prepare
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def prepare
Dir.chdir(project_path) do
cmd = prepare_command
stdout, stderr, status = Cmd.run(cmd)
return if status.success?
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method shared_options
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.shared_options
method_option :debug,
aliases: '-d',
type: :boolean,
desc: 'Emit detailed info about what LicenseFinder is doing'
Method unassign_from_specific_versions
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def unassign_from_specific_versions(name, lic, versions)
return unless @specific_versions[name]
versions.each do |version|
if @specific_versions[name][version]
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method license_finder_config
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def license_finder_config
extract_options(
:project_path,
:decisions_file,
:enabled_package_managers,
Method current_packages
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def current_packages
# the licenses plugin supports the classic production flag
cmd = "#{Yarn::SHELL_COMMAND}#{classic_yarn_production_flag}"
if yarn_version == 1
cmd += ' --no-progress'
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method supported_pnpm?
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def supported_pnpm?
Dir.chdir(project_path) do
version_string, stderr_str, status = Cmd.run('pnpm --version')
raise "Command 'pnpm -v' failed to execute: #{stderr_str}" unless status.success?
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method newbsd
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def newbsd
template = Template.named('NewBSD')
alternate_content = template.content.gsub(
'Neither the name of <organization> nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.',
'The names of its contributors may not be used to endorse or promote products derived from this software without specific prior written permission.'
Method all
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def all
[
agpl3,
apache1_1,
apache2,
Method get_yarn_packages
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def get_yarn_packages(json_objects)
packages = []
incompatible_packages = []
json_objects.each do |json_object|
license = json_object['value']
Method current_packages
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def current_packages
unless File.exist?('pubspec.lock')
raise PubError, "No checked-out Pub packages found.
Please install your dependencies first."
end
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method current_packages
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def current_packages
# check if the minimum version of PNPM is met
raise 'The minimum PNPM version is not met, requires 7.17.0 or later' unless supported_pnpm?
# check if the project directory has workspace file
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method action_items
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def action_items
finder = LicenseAggregator.new(config, aggregate_paths)
any_packages = finder.any_packages?
unapproved = finder.unapproved
restricted = finder.restricted
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"