mineworks/license_auto

View on GitHub

Showing 31 of 31 total issues

Method initialize has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

  def initialize(package, user, repo, ref=nil, auto_pagination=false)
Severity: Minor
Found in lib/license_auto/website/github_com.rb - About 35 mins to fix

    Method list_projects has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def list_projects
          cmd = "gradle -q project"
          LicenseAuto.logger.debug(@path)
          projects = []
          Dir.chdir(@path) do
    Severity: Minor
    Found in lib/license_auto/package_manager/gradle.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 parse_versions has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def parse_versions
          cmd = 'git submodule status'
          versions = {}
          LicenseAuto.logger.debug(@path)
          Dir.chdir(@path) do
    Severity: Minor
    Found in lib/license_auto/package_manager/git_module.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

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

        def parse_dependencies
          build_files = dependency_file_path_names
          if build_files.empty?
            LicenseAuto.logger.info("#{LANGUAGE}: #{dependency_file_pattern} file not exist")
            []
    Severity: Minor
    Found in lib/license_auto/package_manager/gradle.rb and 1 other location - About 30 mins to fix
    lib/license_auto/package_manager/maven.rb on lines 25..37

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 33.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

        def parse_dependencies
          build_files = dependency_file_path_names
          if build_files.empty?
            LicenseAuto.logger.info("#{LANGUAGE}: #{dependency_file_pattern} file not exist")
            []
    Severity: Minor
    Found in lib/license_auto/package_manager/maven.rb and 1 other location - About 30 mins to fix
    lib/license_auto/package_manager/gradle.rb on lines 23..36

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 33.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Method match_versioned_ref has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

      def match_versioned_ref()
        possible_ref = nil
        # If provided a Git SHA, use it directly
        if @package.version.size >= GIT_HASH_LENGTH
          possible_ref = @package.version
    Severity: Minor
    Found in lib/license_auto/website/github_com.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

    Similar blocks of code found in 3 locations. Consider refactoring.
    Open

        def self.check_cli
          cmd = 'mvn -v'
          stdout_str, stderr_str, _status = Open3.capture3(cmd)
          if stdout_str.include?('Apache Maven 3')
            true
    Severity: Minor
    Found in lib/license_auto/package_manager/maven.rb and 2 other locations - About 25 mins to fix
    lib/license_auto/package_manager/git_module.rb on lines 39..46
    lib/license_auto/package_manager/gradle.rb on lines 42..49

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 30.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 3 locations. Consider refactoring.
    Open

        def self.check_cli
          cmd = 'git version'
          stdout_str, stderr_str, _status = Open3.capture3(cmd)
          if stdout_str.include?('git version')
            true
    Severity: Minor
    Found in lib/license_auto/package_manager/git_module.rb and 2 other locations - About 25 mins to fix
    lib/license_auto/package_manager/gradle.rb on lines 42..49
    lib/license_auto/package_manager/maven.rb on lines 123..130

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 30.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 3 locations. Consider refactoring.
    Open

        def self.check_cli
          cmd = 'gradle --version'
          stdout_str, stderr_str, _status = Open3.capture3(cmd)
          if stdout_str.include?('Gradle 2.')
            true
    Severity: Minor
    Found in lib/license_auto/package_manager/gradle.rb and 2 other locations - About 25 mins to fix
    lib/license_auto/package_manager/git_module.rb on lines 39..46
    lib/license_auto/package_manager/maven.rb on lines 123..130

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 30.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

        def self.is_valid_semver?(semver)
          node_cmd = "node -e \"var semver = require('semver'); var valid = semver.validRange('#{semver}'); console.log(valid)\""
          # LicenseAuto.logger.debug(node_cmd)
          stdout_str, _stderr_str, _status = Open3.capture3(node_cmd)
          is_invalid = stdout_str.gsub(/\n/, '') == 'null'
    Severity: Minor
    Found in lib/license_auto/package_manager/bower.rb and 1 other location - About 15 mins to fix
    lib/license_auto/package_manager/npm.rb on lines 76..87

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 26.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

        def self.is_valid_semver?(semver)
          node_cmd = "node -e \"var semver = require('semver'); var valid = semver.validRange('#{semver}'); console.log(valid)\""
          # LicenseAuto.logger.debug(node_cmd)
          stdout_str, _stderr_str, _status = Open3.capture3(node_cmd)
          is_invalid = stdout_str.gsub(/\n/, '') == 'null'
    Severity: Minor
    Found in lib/license_auto/package_manager/npm.rb and 1 other location - About 15 mins to fix
    lib/license_auto/package_manager/bower.rb on lines 42..53

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 26.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Severity
    Category
    Status
    Source
    Language