librariesio/license-compatibility

View on GitHub

Showing 5 of 5 total issues

Method has too many lines. [33/30]
Open

    def self.parse(args)
      options = {}
      option_parser = OptionParser.new do |opts|
        opts.banner = "#{USAGE}\n\n"
        opts.banner += "Arguments:\n"
Severity: Minor
Found in lib/license/compatibility.rb by rubocop

This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Method parse has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def self.parse(args)
      options = {}
      option_parser = OptionParser.new do |opts|
        opts.banner = "#{USAGE}\n\n"
        opts.banner += "Arguments:\n"
Severity: Minor
Found in lib/license/compatibility.rb - About 1 hr to fix

    Method parse_positional has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        def self.parse_positional(args)
          licenses = false
          packages = false
          prepared = []
    
    
    Severity: Minor
    Found in lib/license/compatibility.rb - About 55 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 parse has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def self.parse(args)
          options = {}
          option_parser = OptionParser.new do |opts|
            opts.banner = "#{USAGE}\n\n"
            opts.banner += "Arguments:\n"
    Severity: Minor
    Found in lib/license/compatibility.rb - About 45 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 license_type has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def self.license_type(license)
          license = license.delete('+')
          if license_data['public_domain'].include?(license)
            :public_domain
          elsif license_data['permissive'].include?(license)
    Severity: Minor
    Found in lib/license/compatibility.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