librariesio/libraries.io

View on GitHub

Showing 110 of 146 total issues

Method download_owner has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    def download_owner
      return if repository.owner && repository.repository_user_id && repository.owner.login == repository.owner_name
      o = api_client.user(repository.owner_name)
      if o.type == "Organization"
        go = RepositoryOrganisation.create_from_host('GitHub', o)
Severity: Minor
Found in app/models/repository_host/github.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 search has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    def self.search(query, options = {})
      facet_limit = options.fetch(:facet_limit, 36)
      options[:filters] ||= []
      search_definition = {
        query: {
Severity: Minor
Found in app/models/concerns/project_search.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 download_owner has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    def download_owner
      return if repository.owner && repository.repository_user_id && repository.owner.login == repository.owner_name
      o = RepositoryOwner::Bitbucket.fetch_user(repository.owner_name)
      if o.type == "team"
        org = RepositoryOrganisation.create_from_host('Bitbucket', o)
Severity: Minor
Found in app/models/repository_host/bitbucket.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 save has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    def self.save(project)
      return unless project.present?
      mapped_project = mapping(project)
      mapped_project = mapped_project.delete_if { |_key, value| value.blank? } if mapped_project.present?
      return false unless mapped_project.present?
Severity: Minor
Found in app/models/package_manager/base.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 create_user has 38 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def self.create_user(user_hash)
      return if user_hash.nil?
      user_hash = user_hash.to_hash.with_indifferent_access
      user_hash = {
        id: user_hash[:id],
Severity: Minor
Found in app/models/repository_owner/gitlab.rb - About 1 hr to fix

    Method create_org has 37 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def self.create_org(org_hash)
          return if org_hash.nil?
          org_hash = org_hash.to_hash.with_indifferent_access
          org_hash = {
            id: org_hash[:id],
    Severity: Minor
    Found in app/models/repository_owner/gitlab.rb - About 1 hr to fix

      Method create_user has 37 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def self.create_user(user_hash)
            return if user_hash.nil?
            user_hash = user_hash.to_hash.with_indifferent_access
            user_hash = {
              id: user_hash[:uuid],
      Severity: Minor
      Found in app/models/repository_owner/bitbucket.rb - About 1 hr to fix

        Method create_org has 36 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def self.create_org(org_hash)
              return if org_hash.nil?
              org_hash = org_hash.to_hash.with_indifferent_access
              org_hash = {
                id: org_hash[:uuid],
        Severity: Minor
        Found in app/models/repository_owner/bitbucket.rb - About 1 hr to fix

          Method query has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

                  def query(params: {})
                    validate_params(params)
          
                    end_date = params.delete(:end_date)
          
          
          Severity: Minor
          Found in app/models/maintenance_stats/queries/github/releases_query.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 save_dependencies has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

              def self.save_dependencies(mapped_project)
                name = mapped_project[:name]
                proj = Project.find_by(name: name, platform: self.name.demodulize)
                proj.versions.includes(:dependencies).each do |version|
                  deps = dependencies(name, version.number, mapped_project) rescue []
          Severity: Minor
          Found in app/models/package_manager/base.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 show has 35 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def show
              @issues = @project.repository.try(:issues)
              @tags = @project.repository.try(:tags)
              @events = []
              @project.versions.each do |version|
          Severity: Minor
          Found in app/controllers/timeline_controller.rb - About 1 hr to fix

            Method mapping_from_pom_xml has 34 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                def self.mapping_from_pom_xml(version_xml, depth = 0)
                  if version_xml.respond_to?('project')
                    xml = version_xml.project
                  else
                    xml = version_xml
            Severity: Minor
            Found in app/models/package_manager/maven.rb - About 1 hr to fix

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

                  def self.issues_facet_filters(options, labels)
                    facet_limit = options.fetch(:facet_limit, 35)
                    {
                      language: {
                        aggs: {
              Severity: Minor
              Found in app/models/concerns/issue_search.rb - About 1 hr to fix

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

                  def breakdown
                    {
                      overall_score: overall_score,
                      popularity: {
                        score: popularity_score,
                Severity: Minor
                Found in app/models/project_score_calculator.rb - About 1 hr to fix

                  Method facets_options has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      def self.facets_options(facet_limit, options)
                        {
                          language: {
                            aggs: {
                              language: {
                  Severity: Minor
                  Found in app/models/concerns/project_search.rb - About 1 hr to fix

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

                      def create
                        auth = request.env['omniauth.auth']
                    
                        identity = Identity.find_with_omniauth(auth)
                    
                    
                    Severity: Minor
                    Found in app/controllers/sessions_controller.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 download_tags has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def download_tags(token = nil)
                          existing_tag_names = repository.tags.pluck(:name)
                          remote_tags = api_client(token).tags(repository.full_name).auto_paginate do |tag|
                            next if existing_tag_names.include?(tag.name)
                            next if tag.commit.nil?
                    Severity: Minor
                    Found in app/models/repository_host/gitlab.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 project has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def self.project(name)
                          if name.match(/^([-\w]+)\/([-.\w]+)$/)
                            begin
                              repo = AuthToken.client.repo(name, accept: 'application/vnd.github.drax-preview+json,application/vnd.github.mercy-preview+json')
                              return repo.to_hash
                    Severity: Minor
                    Found in app/models/package_manager/carthage.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 create_from_hash has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        def self.create_from_hash(name_with_owner, issue_hash, token = nil)
                          issue_hash = issue_hash.to_hash.with_indifferent_access
                          repository = Repository.host('Bitbucket').find_by_full_name(name_with_owner) || RepositoryHost::Bitbucket.create(name_with_owner)
                          return if repository.nil?
                          if issue_hash[:type] == 'pullrequest'
                    Severity: Minor
                    Found in app/models/repository_issue/bitbucket.rb - About 1 hr to fix

                      Method show has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        def show
                          find_platform
                      
                          top_projects = Project.platform(@platform_name).order('(dependent_repos_count) DESC NULLS LAST').limit(1000).includes(:repository)
                      
                      
                      Severity: Minor
                      Found in app/controllers/admin/platforms_controller.rb - About 1 hr to fix
                        Severity
                        Category
                        Status
                        Source
                        Language