OscarMichelH/repo-io

View on GitHub

Showing 20 of 20 total issues

Method set_initial_variables has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

  def set_initial_variables
    github = Octokit::Client.new access_token: current_user.oauth_token

    #Get the author that belongs to the user if there is one
    current_author = Author.find_by(username: current_user.email)
Severity: Minor
Found in app/controllers/repositories_controller.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 filter_org_repos_between has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

  def filter_org_repos_between(repos, start_date, end_date)
          #Filter local repos
          repos_stored = Array.new
          repos_after_start_date = Array.new
          if (!start_date.nil? && !end_date.nil?)
Severity: Minor
Found in app/controllers/organizations_controller.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 perform has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

        def perform()
            user = User.find(user_id)
            selfRepo = Repository.find(repo_id)
            github = Octokit::Client.new access_token: user.oauth_token
            remote_repo = github.repo selfRepo.full_name
Severity: Minor
Found in app/jobs/repo_updater/process_new_repos_content_job.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 show has 51 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def show
    @data_in_series = []
    if params[:from_date].present? && params[:until_date].present?
      @from_date = params[:from_date]
      @until_date = params[:until_date]
Severity: Major
Found in app/controllers/repositories_controller.rb - About 2 hrs to fix

    Method perform has 45 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            def perform()
                user = User.find(user_id)
                selfRepo = Repository.find(repo_id)
                github = Octokit::Client.new access_token: user.oauth_token
                remote_repo = github.repo selfRepo.full_name
    Severity: Minor
    Found in app/jobs/repo_updater/process_new_repos_content_job.rb - About 1 hr to fix

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

        def get_repos_from_orgs(org_name)
            org_repos_stored = Array.new
            org_repos_not_stored = Array.new
            org_repos = Array.new
      
      
      Severity: Minor
      Found in app/controllers/organizations_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 update has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

        def update
          respond_to do |format|
            #if @repository.update(repository_params)
            #  format.html { redirect_to @repository, notice: 'Repository was successfully updated.' }
            #  format.json { render :show, status: :ok, location: @repository }
      Severity: Minor
      Found in app/controllers/repositories_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 create has 39 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def create
          github = Octokit::Client.new access_token: current_user.oauth_token
      
          #if not exist an 'user organization' on db
          username = github.login
      Severity: Minor
      Found in app/controllers/repositories_controller.rb - About 1 hr to fix

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

          def set_initial_variables
            github = Octokit::Client.new access_token: current_user.oauth_token
        
            #Get the author that belongs to the user if there is one
            current_author = Author.find_by(username: current_user.email)
        Severity: Minor
        Found in app/controllers/repositories_controller.rb - About 1 hr to fix

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

            def get_repos_from_orgs(org_name)
                org_repos_stored = Array.new
                org_repos_not_stored = Array.new
                org_repos = Array.new
          
          
          Severity: Minor
          Found in app/controllers/organizations_controller.rb - About 1 hr to fix

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

              def update
                respond_to do |format|
                  #if @repository.update(repository_params)
                  #  format.html { redirect_to @repository, notice: 'Repository was successfully updated.' }
                  #  format.json { render :show, status: :ok, location: @repository }
            Severity: Minor
            Found in app/controllers/repositories_controller.rb - About 1 hr to fix

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

                def filter_org_repos_between(repos, start_date, end_date)
                        #Filter local repos
                        repos_stored = Array.new
                        repos_after_start_date = Array.new
                        if (!start_date.nil? && !end_date.nil?)
              Severity: Minor
              Found in app/controllers/organizations_controller.rb - About 1 hr to fix

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

                  def store_orgs_needed
                
                      github = Octokit::Client.new access_token: current_user.oauth_token
                      current_user_temp = current_user
                      #if not exist an 'user organization' on db save it
                Severity: Minor
                Found in app/controllers/sessions_controller.rb - About 1 hr to fix

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

                    def create
                      @author = Author.new(author_params)
                  
                      respond_to do |format|
                        if @author.save
                  Severity: Major
                  Found in app/controllers/authors_controller.rb and 2 other locations - About 1 hr to fix
                  app/controllers/commits_controller.rb on lines 26..35
                  app/controllers/organizations_controller.rb on lines 26..35

                  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 47.

                  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 create
                      @organization = Organization.new(organization_params)
                  
                      respond_to do |format|
                        if @organization.save
                  Severity: Major
                  Found in app/controllers/organizations_controller.rb and 2 other locations - About 1 hr to fix
                  app/controllers/authors_controller.rb on lines 26..35
                  app/controllers/commits_controller.rb on lines 26..35

                  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 47.

                  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 create
                      @commit = Commit.new(commit_params)
                  
                      respond_to do |format|
                        if @commit.save
                  Severity: Major
                  Found in app/controllers/commits_controller.rb and 2 other locations - About 1 hr to fix
                  app/controllers/authors_controller.rb on lines 26..35
                  app/controllers/organizations_controller.rb on lines 26..35

                  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 47.

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

                    def create
                      github = Octokit::Client.new access_token: current_user.oauth_token
                  
                      #if not exist an 'user organization' on db
                      username = github.login
                  Severity: Minor
                  Found in app/controllers/repositories_controller.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

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

                    def update
                      respond_to do |format|
                        if @organization.update(organization_params)
                          format.html { redirect_to @organization, notice: 'Organization was successfully updated.' }
                          format.json { render :show, status: :ok, location: @organization }
                  Severity: Major
                  Found in app/controllers/organizations_controller.rb and 2 other locations - About 55 mins to fix
                  app/controllers/authors_controller.rb on lines 42..49
                  app/controllers/commits_controller.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 44.

                  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 update
                      respond_to do |format|
                        if @author.update(author_params)
                          format.html { redirect_to @author, notice: 'Author was successfully updated.' }
                          format.json { render :show, status: :ok, location: @author }
                  Severity: Major
                  Found in app/controllers/authors_controller.rb and 2 other locations - About 55 mins to fix
                  app/controllers/commits_controller.rb on lines 42..49
                  app/controllers/organizations_controller.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 44.

                  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 update
                      respond_to do |format|
                        if @commit.update(commit_params)
                          format.html { redirect_to @commit, notice: 'Commit was successfully updated.' }
                          format.json { render :show, status: :ok, location: @commit }
                  Severity: Major
                  Found in app/controllers/commits_controller.rb and 2 other locations - About 55 mins to fix
                  app/controllers/authors_controller.rb on lines 42..49
                  app/controllers/organizations_controller.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 44.

                  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