mineworks/license_auto

View on GitHub

Showing 22 of 31 total issues

Method parser_pom has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
Open

    def parser_pom(pom_url, pom_str)
      LicenseAuto.logger.debug("pom_str:\n#{pom_str[0..70]}")
      doc = Nokogiri::XML(pom_str).remove_namespaces!

      # Source Code Manager
Severity: Minor
Found in lib/license_auto/website/maven_central_repository.rb - About 4 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 parser_pom has 87 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def parser_pom(pom_url, pom_str)
      LicenseAuto.logger.debug("pom_str:\n#{pom_str[0..70]}")
      doc = Nokogiri::XML(pom_str).remove_namespaces!

      # Source Code Manager
Severity: Major
Found in lib/license_auto/website/maven_central_repository.rb - About 3 hrs to fix

    Method get_license_info has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
    Open

      def get_license_info()
        possible_ref = @ref || match_versioned_ref
        LicenseAuto.logger.debug("possible_ref: #{possible_ref}")
        # If possible_ref is nil, the Github API server will return the default branch contents
        contents = @server.repos.contents.get(path: '/', ref: possible_ref)
    Severity: Minor
    Found in lib/license_auto/website/github_com.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 get_license_info has 66 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def get_license_info()
        possible_ref = @ref || match_versioned_ref
        LicenseAuto.logger.debug("possible_ref: #{possible_ref}")
        # If possible_ref is nil, the Github API server will return the default branch contents
        contents = @server.repos.contents.get(path: '/', ref: possible_ref)
    Severity: Major
    Found in lib/license_auto/website/github_com.rb - About 2 hrs to fix

      Method get_license_info has 59 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def get_license_info()
            if @package.version.nil?
              begin
                @package.version = chose_latest_available_version('*')
              rescue Exception => e
      Severity: Major
      Found in lib/license_auto/website/npm_registry.rb - About 2 hrs to fix

        Method parse_dependencies has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
        Open

            def parse_dependencies
        
              package_json_files = dependency_file_path_names
              if package_json_files.empty?
                LicenseAuto.logger.info("#{LANGUAGE}: #{dependency_file_pattern} file not exist")
        Severity: Minor
        Found in lib/license_auto/package_manager/npm.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 parse_dependencies has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
        Open

            def parse_dependencies
              # gemfiles = dependency_file_path_names(pattern=gemfile_pattern)
              # definition = ::Bundler::Definition.build(gemfiles.first, nil, nil)
        
              # definition.dependencies.each {|dep|
        Severity: Minor
        Found in lib/license_auto/package_manager/bundler.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 parse_dependencies has 47 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def parse_dependencies
        
              package_json_files = dependency_file_path_names
              if package_json_files.empty?
                LicenseAuto.logger.info("#{LANGUAGE}: #{dependency_file_pattern} file not exist")
        Severity: Minor
        Found in lib/license_auto/package_manager/npm.rb - About 1 hr to fix

          Method chose_package_server has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
          Open

              def chose_package_server()
                begin
                  @server =
                      if self.language == 'Golang' and self.server
                        matcher = Matcher::SourceURL.new(self.server)
          Severity: Minor
          Found in lib/license_auto/package.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 get_license_info has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
          Open

              def get_license_info()
                if @package.version.nil?
                  begin
                    @package.version = chose_latest_available_version('*')
                  rescue Exception => e
          Severity: Minor
          Found in lib/license_auto/website/npm_registry.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 parse_dependencies has 41 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def parse_dependencies
                # gemfiles = dependency_file_path_names(pattern=gemfile_pattern)
                # definition = ::Bundler::Definition.build(gemfiles.first, nil, nil)
          
                # definition.dependencies.each {|dep|
          Severity: Minor
          Found in lib/license_auto/package_manager/bundler.rb - About 1 hr to fix

            Method get_license_info has 38 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def get_license_info()
                if @package.version.nil?
                  begin
                    @package.version = get_latest_version['number']
                  rescue Exception => e
            Severity: Minor
            Found in lib/license_auto/website/ruby_gems_org.rb - About 1 hr to fix

              Method get_license_info has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                  def get_license_info()
                    license_info = LicenseAuto::LicenseInfoWrapper.new
                    query_set = select
              
                    if query_set.nil?
              Severity: Minor
              Found in lib/license_auto/website/maven_central_repository.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 chose_package_server has 30 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  def chose_package_server()
                    begin
                      @server =
                          if self.language == 'Golang' and self.server
                            matcher = Matcher::SourceURL.new(self.server)
              Severity: Minor
              Found in lib/license_auto/package.rb - About 1 hr to fix

                Method list_dependencies has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                    def list_dependencies
                      if resolve_dependencies
                        deps = Set.new
                        Dir.chdir(@path) do
                          cmd = 'mvn dependency:list -T 4 -DincludeScope=runtime'
                Severity: Minor
                Found in lib/license_auto/package_manager/maven.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 list_dependencies has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                    def list_dependencies(project_name=nil)
                      Dir.chdir(@path) do
                        deps = Set.new
                        cmd = if project_name
                                "gradle -q #{project_name}:dependencies --configuration runtime"
                Severity: Minor
                Found in lib/license_auto/package_manager/gradle.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 get_license_info has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                  def get_license_info()
                    if @package.version.nil?
                      begin
                        @package.version = get_latest_version['number']
                      rescue Exception => e
                Severity: Minor
                Found in lib/license_auto/website/ruby_gems_org.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 parse_dependencies has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    def parse_dependencies
                      contents = list_contents
                      if contents.nil?
                        LicenseAuto.logger.info("Golang dependencies not exist")
                        return []
                Severity: Minor
                Found in lib/license_auto/package_manager/golang.rb - About 1 hr to fix

                  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

                    Severity
                    Category
                    Status
                    Source
                    Language