jbox-web/redmine_git_hosting

View on GitHub

Showing 133 of 168 total issues

File git_multimail.py has 2918 lines of code (exceeds 250 allowed). Consider refactoring.
Open

#! /usr/bin/env python

__version__ = '1.3.1'

# Copyright (c) 2015 Matthieu Moy and others
Severity: Major
Found in contrib/hooks/post-receive/lib/git_multimail.py - About 1 wk to fix

    Function generate_revision_change_summary has a Cognitive Complexity of 109 (exceeds 5 allowed). Consider refactoring.
    Open

        def generate_revision_change_summary(self, push):
            """Generate a summary of the revisions added/removed by this change."""
    
            if self.new.commit_sha1 and not self.old.commit_sha1:
                # A new reference was created.  List the new revisions
    Severity: Minor
    Found in contrib/hooks/post-receive/lib/git_multimail.py - About 2 days 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 revisions has a Cognitive Complexity of 77 (exceeds 5 allowed). Consider refactoring.
    Open

            def revisions(path, identifier_from, identifier_to, options = {})
              revs = Revisions.new
              cmd_args = %w|log --no-color --encoding=UTF-8 --raw --date=iso --pretty=fuller --parents --stdin|
              cmd_args << "--reverse" if options[:reverse]
              cmd_args << "-n" << "#{options[:limit].to_i}" if options[:limit]
    Severity: Minor
    Found in lib/redmine/scm/adapters/xitolite_adapter.rb - About 1 day 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

    Function generate_email has a Cognitive Complexity of 59 (exceeds 5 allowed). Consider refactoring.
    Open

        def generate_email(self, push, body_filter=None, extra_header_values={}):
            """Generate an email describing this change.
    
            Iterate over the lines (including the header lines) of an
            email describing this change.  If body_filter is not None,
    Severity: Minor
    Found in contrib/hooks/post-receive/lib/git_multimail.py - About 1 day 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 entries has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring.
    Open

            def entries(path = nil, identifier = nil, options = {})
              path ||= ''
              p = scm_iconv(@path_encoding, 'UTF-8', path)
              entries = Entries.new
              cmd_args = %w|ls-tree -l|
    Severity: Minor
    Found in lib/redmine/scm/adapters/xitolite_adapter.rb - About 7 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

    File xitolite_adapter.rb has 449 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require 'redmine/scm/adapters/abstract_adapter'
    
    # XitoliteAdapter inherits from GitAdapter but some classes which are define directly in GitAdapter are not inherited
    # (GitBranch, ScmCommandAborted and maybe others) so it raises NameError exception.
    # To fix this I had to reimplement (copy/past) the whole GitAdapter class in XitoliteAdapter...
    Severity: Minor
    Found in lib/redmine/scm/adapters/xitolite_adapter.rb - About 6 hrs to fix

      Function generate_revision_change_summary has 134 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def generate_revision_change_summary(self, push):
              """Generate a summary of the revisions added/removed by this change."""
      
              if self.new.commit_sha1 and not self.old.commit_sha1:
                  # A new reference was created.  List the new revisions
      Severity: Major
      Found in contrib/hooks/post-receive/lib/git_multimail.py - About 5 hrs to fix

        Function __init__ has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
        Open

            def __init__(self, envelopesender, smtpserver,
                         smtpservertimeout=10.0, smtpserverdebuglevel=0,
                         smtpencryption='none',
                         smtpuser='', smtppass='',
                         smtpcacerts=''
        Severity: Minor
        Found in contrib/hooks/post-receive/lib/git_multimail.py - About 5 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

        Class XitoliteAdapter has 34 methods (exceeds 20 allowed). Consider refactoring.
        Open

              class XitoliteAdapter < AbstractAdapter
        
                # Git executable name
                XITOLITE_BIN = Redmine::Configuration['scm_git_command'] || "git"
        
        
        Severity: Minor
        Found in lib/redmine/scm/adapters/xitolite_adapter.rb - About 4 hrs to fix

          Method revisions has 106 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  def revisions(path, identifier_from, identifier_to, options = {})
                    revs = Revisions.new
                    cmd_args = %w|log --no-color --encoding=UTF-8 --raw --date=iso --pretty=fuller --parents --stdin|
                    cmd_args << "--reverse" if options[:reverse]
                    cmd_args << "-n" << "#{options[:limit].to_i}" if options[:limit]
          Severity: Major
          Found in lib/redmine/scm/adapters/xitolite_adapter.rb - About 4 hrs to fix

            Function main has 101 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            def main(args):
                parser = optparse.OptionParser(
                    description=__doc__,
                    usage='%prog [OPTIONS]\n   or: %prog [OPTIONS] REFNAME OLDREV NEWREV',
                    )
            Severity: Major
            Found in contrib/hooks/post-receive/lib/git_multimail.py - About 4 hrs to fix

              Function __init__ has 86 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  def __init__(self, envelopesender, smtpserver,
                               smtpservertimeout=10.0, smtpserverdebuglevel=0,
                               smtpencryption='none',
                               smtpuser='', smtppass='',
                               smtpcacerts=''
              Severity: Major
              Found in contrib/hooks/post-receive/lib/git_multimail.py - About 3 hrs to fix

                Method diff_with_options has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
                Open

                        def diff_with_options
                          if params[:format] == 'diff'
                            @diff = @repository.diff(@path, @rev, @rev_to, bypass_cache: true)
                            (show_error_not_found; return) unless @diff
                            filename = "changeset_r#{@rev}"
                Severity: Minor
                Found in lib/redmine_git_hosting/patches/repositories_controller_patch.rb - About 3 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

                Function get_fromaddr has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
                Open

                    def get_fromaddr(self, change=None):
                        GL_USER = self.osenv.get('GL_USER')
                        if GL_USER is not None:
                            # Find the path to gitolite.conf.  Note that gitolite v3
                            # did away with the GL_ADMINDIR and GL_CONF environment
                Severity: Minor
                Found in contrib/hooks/post-receive/lib/git_multimail.py - About 3 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

                Function __init__ has 74 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    def __init__(self, config, **kw):
                        super(ConfigOptionsEnvironmentMixin, self).__init__(
                            config=config, **kw
                            )
                
                
                Severity: Major
                Found in contrib/hooks/post-receive/lib/git_multimail.py - About 2 hrs to fix

                  Function send_emails has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def send_emails(self, mailer, body_filter=None):
                          """Use send all of the notification emails needed for this push.
                  
                          Use send all of the notification emails (including reference
                          change emails and commit emails) needed for this push.  Send
                  Severity: Minor
                  Found in contrib/hooks/post-receive/lib/git_multimail.py - 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

                  Function __init__ has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def __init__(self, config, **kw):
                          super(ConfigOptionsEnvironmentMixin, self).__init__(
                              config=config, **kw
                              )
                  
                  
                  Severity: Minor
                  Found in contrib/hooks/post-receive/lib/git_multimail.py - 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

                  Function generate_email has 63 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      def generate_email(self, push, body_filter=None, extra_header_values={}):
                          """Generate an email describing this change.
                  
                          Iterate over the lines (including the header lines) of an
                          email describing this change.  If body_filter is not None,
                  Severity: Major
                  Found in contrib/hooks/post-receive/lib/git_multimail.py - About 2 hrs to fix

                    Function send_emails has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        def send_emails(self, mailer, body_filter=None):
                            """Use send all of the notification emails needed for this push.
                    
                            Use send all of the notification emails (including reference
                            change emails and commit emails) needed for this push.  Send
                    Severity: Major
                    Found in contrib/hooks/post-receive/lib/git_multimail.py - About 2 hrs to fix

                      Method find_project_repository has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                      Open

                              def find_project_repository
                                @project = Project.find(params[:id])
                                if params[:repository_id].present?
                                  @repository = @project.repositories.find_by_identifier_param(params[:repository_id])
                                else
                      Severity: Minor
                      Found in lib/redmine_git_hosting/patches/repositories_controller_patch.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

                      Severity
                      Category
                      Status
                      Source
                      Language