glittergallery/GlitterGallery

View on GitHub

Showing 25 of 25 total issues

Class Project has 40 methods (exceeds 20 allowed). Consider refactoring.
Open

class Project < ActiveRecord::Base

  include Sortable
  after_create :set_path, :init, :add_tags
  after_destroy :deletefiles
Severity: Minor
Found in app/models/project.rb - About 5 hrs to fix

    File projects_controller.rb has 343 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    class ProjectsController < ApplicationController
      before_filter :store_return_to
    
      before_filter :return_context, except: [:new,
                                              :create,
    Severity: Minor
    Found in app/controllers/projects_controller.rb - About 4 hrs to fix

      File project.rb has 328 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      class Project < ActiveRecord::Base
      
        include Sortable
        after_create :set_path, :init, :add_tags
        after_destroy :deletefiles
      Severity: Minor
      Found in app/models/project.rb - About 3 hrs to fix

        Class ProjectsController has 31 methods (exceeds 20 allowed). Consider refactoring.
        Open

        class ProjectsController < ApplicationController
          before_filter :store_return_to
        
          before_filter :return_context, except: [:new,
                                                  :create,
        Severity: Minor
        Found in app/controllers/projects_controller.rb - About 3 hrs to fix

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

            def traverse
              return [nil, [], []] if project.barerepo.empty?
              images = []
              directories = []
              readme = nil
          Severity: Minor
          Found in app/models/tree.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 commit_touches_path? has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

              def commit_touches_path?(commit, walker)
                entry = tree_entry(commit)
          
                num_treesame = 0
                if commit.parents.empty?
          Severity: Minor
          Found in lib/gg/diff.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 nested_projects has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

            def nested_projects(roots, project)
              content_tag :ul, class: 'nested_projects' do
                roots.each do |root|
                  user_link = link_to(root.user.username, "/#{root.user.username}")
                  project_link = link_to(root.name, root.urlbase)
          Severity: Minor
          Found in app/helpers/projects_helper.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_by_path has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              def project_by_path(path)
                if m = /^([\w\.\/-]+)\.git/.match(path).to_a
                  path_with_namespace = m.last
                  path_with_namespace[0] = '' if path_with_namespace.start_with?('/')
                  return nil unless path_with_namespace.include?('/')
          Severity: Minor
          Found in lib/rack/grack_auth.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 create has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

            def create
              @issue = Issue.new(issue_params)
              @issue.user = current_user
              @issue.project = @project
              @issue.status = 0
          Severity: Minor
          Found in app/controllers/issues_controller.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 generate_images_between has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              def generate_images_between(old_sha, new_sha, branch)
                head = @sat_repo.lookup("#{new_sha}")
                # tails won't exist if previously repo was empty
                tail = @sat_repo.lookup("#{old_sha}") unless old_sha[0..5] == '000000'
                walker = Rugged::Walker.new(@sat_repo)
          Severity: Minor
          Found in lib/gg/sync.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 authorized_request? has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              def authorized_request?
                case git_cmd
                when *%w( git-upload-pack git-upload-archive )
                  if user
                    ProjectMember.member?(project, user)
          Severity: Minor
          Found in lib/rack/grack_auth.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 update_image has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

            def update_image(branch, old_path, new_file, author, message)
          Severity: Minor
          Found in app/models/project.rb - About 35 mins to fix

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

              def create_directory
                if params[:directory].empty?
                  flash[:alert] = 'No name provided for the directory!'
                  redirect_to :back
                else
            Severity: Minor
            Found in app/controllers/projects_controller.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 find_file_types has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

              def find_file_types(project)
                formats = { '.svg' => 0, '.jpg' => 0, '.png' => 0, 'other' => 0 }
                path = File.join project.satellitedir, '/**/*'
                files = Dir[path]
                files.each do |f|
            Severity: Minor
            Found in app/helpers/projects_helper.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 tree_entry has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                def tree_entry(commit)
                  pathname = Pathname.new(path)
                  tmp_entry = nil
            
                  pathname.each_filename do |dir|
            Severity: Minor
            Found in lib/gg/diff.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 file_upload has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

              def file_upload
                branch = params[:branch] || 'master'
                if params[:file]
                  if user_signed_in? && @project.add_images(
                    branch,
            Severity: Minor
            Found in app/controllers/projects_controller.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 breadcrumb has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

              def breadcrumb
                res = link_to(@project.name,
                              project_tree_path(@project, params[:oid], ''))
                dest = ''
                arr = params[:destination].split('/')
            Severity: Minor
            Found in app/helpers/projects_helper.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

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

                def call(env)
                  @env = env
                  @request = Rack::Request.new(env)
                  @auth = Request.new(env)
            
            
            Severity: Minor
            Found in lib/rack/grack_auth.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

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

                def find_files(query, project)
                  images = []
                  dir = []
                  path = File.join project.satellitedir, '/**/*'
                  files = Dir[path]
            Severity: Minor
            Found in lib/gg/search.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

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

              def create
                new_member = ProjectMember.new(
                  gallery_id: @project.id,
                  member_id: params[:member_id],
                  role: params[:role]
            Severity: Minor
            Found in app/controllers/project_members_controller.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