Schwolop/deriving_license

View on GitHub

Showing 8 of 8 total issues

Method describe has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
Open

  def self.describe(licenses)
    # Print link to description of each license type, then attempt to determine 
    # whether any notable restrictions apply (e.g. you can't sell this project, 
    # you must include a copy of the GPL, etc)
    unrecognized = []
Severity: Minor
Found in lib/deriving_license.rb - About 3 hrs to fix

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 find_deps has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

  def self.find_deps(path, content)
    deps = []
    if /gemspec/.match(path.downcase) # Gemspecs...
      deps = Gemnasium::Parser::Gemspec.new(content).dependencies
    else # Gemfiles...
Severity: Minor
Found in lib/deriving_license.rb - About 2 hrs to fix

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 from_license_file has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

  def self.from_license_file(dep)
    licenses = []

    yield_gem_source_directory(dep) do |gem_source_directory|

Severity: Minor
Found in lib/deriving_license.rb - About 2 hrs to fix

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 search_in_paths has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

  def self.search_in_paths(paths)
    licenses = []
    paths.each do |p|
      if File.exist?(p)
        File.open(p).each_line do |l|
Severity: Minor
Found in lib/deriving_license.rb - About 1 hr to fix

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 determine_licenses has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

  def self.determine_licenses(deps,detected_licenses,available_strategies)
    licenses = []
    deps.each do |d|
      print "Determining license for #{d.name}:\n"
      # Try each license finding strategy...
Severity: Minor
Found in lib/deriving_license.rb - About 1 hr to fix

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 from_scraping_homepage has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

  def self.from_scraping_homepage(dep)
    spec = get_gem_spec(dep)
    licenses = []
    unless spec["homepage"] and !spec["homepage"].empty?
      return []
Severity: Minor
Found in lib/deriving_license.rb - About 1 hr to fix

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 run has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def self.run(path=nil, strategies=[])
    unless path
      raise ArgumentError.new("Path to Gemfile or Gemspec required")
    end
    
Severity: Minor
Found in lib/deriving_license.rb - About 35 mins to fix

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 from_parsing_readme has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def self.from_parsing_readme(dep)
    licenses = []

    yield_gem_source_directory(dep) do |gem_source_directory|

Severity: Minor
Found in lib/deriving_license.rb - About 25 mins to fix

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

Severity
Category
Status
Source
Language