Showing 66 of 1,425 total issues

Function __new__ has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def __new__(cls, backend, host, port, username, pwd, db):
Severity: Minor
Found in apel/db/apeldb.py - About 45 mins to fix

    Function parse_fqan has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    def parse_fqan(fqan):
        '''
        We can get three pieces of information from a FQAN: role, group and VO.
        We return this as a 3-tuple.
        If it's not of the expected format, we put the whole string in the VO
    Severity: Minor
    Found in apel/common/parsing_utils.py - 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

    Function __init__ has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def __init__(self, db, qpath, inc_vos=None, exc_vos=None, local=False, withhold_dns=False):
    Severity: Minor
    Found in apel/db/unloader.py - About 45 mins to fix

      Function _get_records has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          def _get_records(self, record_type, query_string, records_per_message=1000):
      
              record_list = []
              try:
                  # prevent MySQLdb from raising
      Severity: Minor
      Found in apel/db/backends/mysql.py - 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

      Function get_db_tuple has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          def get_db_tuple(self, source=None):
              '''
              Returns record content as a tuple. Appends the source of the record
              (i.e. the sender's DN) if this is supplied.  Includes exactly the
              fields used in the DB by using the self._db_fields list.
      Severity: Minor
      Found in apel/db/records/record.py - 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

      Avoid deeply nested control flow statements.
      Open

                              if pf.get_field('Parsed') == 0:
                                  unparsed = True
                              break  # If we find a match, no need to keep checking.
      Severity: Major
      Found in bin/parser.py - About 45 mins to fix

        Function scan_dir has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        def scan_dir(parser, dirpath, reparse, expr, apel_db, processed):
        Severity: Minor
        Found in bin/parser.py - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                                              if method == open:
                                                  raise
                                      finally:
          Severity: Major
          Found in bin/parser.py - About 45 mins to fix

            Function __init__ has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                def __init__(self, host, port, username, pwd, db):
            Severity: Minor
            Found in apel/db/backends/mysql.py - About 35 mins to fix

              Function __init__ has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  def __init__(self, host, port, username, pwd, db):
              Severity: Minor
              Found in apel/db/backends/oracle.py - About 35 mins to fix

                Function _check_fields has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    def _check_fields(self):
                        '''
                        Add extra checks to those made in every record.
                        '''
                        # First, call the parent's version.
                Severity: Minor
                Found in apel/db/records/job.py - 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

                Function parse has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    def parse(self, line):
                        """Parse single line from accounting log file."""
                        # Some sites will use TotalCPU rather than CPUTimeRAW
                
                        # sacct -P -n --format=JobID,JobName,User,Group,Start,End,Elapsed,
                Severity: Minor
                Found in apel/parsers/slurm.py - 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

                Function shutdown has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    def shutdown(self):
                        """
                        Unlock current messsage queue element and remove pidfile.
                        """
                        # Check if self.current_msg is assigned as it may not have been before
                Severity: Minor
                Found in apel/db/loader/loader.py - 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

                Function _write_messages has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    def _write_messages(self, record_type, table_name, query, ur):
                        '''
                        Write messsages for all the records found in the specified table,
                        according to the logic contained in the query object.
                        '''
                Severity: Minor
                Found in apel/db/unloader.py - 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

                Function retrieve_rmem has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    def retrieve_rmem(self, nodes):
                        '''
                        Given all the nodes from the XML document, retrieve the appropriate values
                        for virtual and physical memory.
                
                
                Severity: Minor
                Found in apel/db/loader/car_parser.py - 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

                Avoid too many return statements within this function.
                Open

                                    return datetime.utcfromtimestamp(value)
                Severity: Major
                Found in apel/db/records/record.py - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                          return RECORDS_PER_MESSAGE_DEFAULT
                  Severity: Major
                  Found in bin/dbunloader.py - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                                    return value
                    Severity: Major
                    Found in apel/db/records/record.py - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                                              return dt
                      Severity: Major
                      Found in apel/db/records/record.py - About 30 mins to fix

                        Function get_ur has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                        Open

                            def get_ur(self):
                                '''
                                Returns the SummaryRecord in AUR format.  See
                                https://twiki.cern.ch/twiki/bin/view/EMI/ComputeAccounting
                        
                        
                        Severity: Minor
                        Found in apel/db/records/summary.py - 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