Showing 66 of 1,565 total issues

Function runprocess has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

def runprocess(config_file, log_config_file):
    '''Get DNs both from the URL and the additional file.'''
    cfg = get_config(config_file)

    log = logging.getLogger('auth')
Severity: Minor
Found in bin/retrieve_dns.py - 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

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

    def get_ur(self, withhold_dns=False):
        '''
        Returns the JobRecord in CAR format. See
        https://twiki.cern.ch/twiki/bin/view/EMI/ComputeAccounting

Severity: Minor
Found in apel/db/records/job.py - 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

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

    def get_ur(self, withhold_dns=False):
        '''
        Returns the StorageRecord in StAR format. See
        http://cds.cern.ch/record/1452920/

Severity: Minor
Found in apel/db/records/storage.py - 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

Function get_msg has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    def get_msg(self, withhold_dns=False):
        '''
        Get the information about the record as a string in the format used
        for APEL's messages.  self._record_content holds the appropriate
        keys and values.
Severity: Minor
Found in apel/db/records/record.py - 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

Function get_ur has 41 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def get_ur(self, withhold_dns=False):
        '''
        Returns the StorageRecord in StAR format. See
        http://cds.cern.ch/record/1452920/

Severity: Minor
Found in apel/db/records/storage.py - About 1 hr to fix

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

        def _check_fields(self):
            '''
            Add extra checks to the ones in the parent class.
            '''
    
    
    Severity: Minor
    Found in apel/db/records/normalised_summary.py - 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

    Function create_records has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

        def create_records(self, msg_text):
            '''
            Given the text from a message, create a list of record objects and
            return that list.
            '''
    Severity: Minor
    Found in apel/db/loader/record_factory.py - 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

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

        def _check_fields(self):
            '''
            Add extra checks to the ones in the parent class.
            '''
    
    
    Severity: Minor
    Found in apel/db/records/summary.py - 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

    Function load_records has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

        def load_records(self, record_list, replace=True, source=None):
            '''
            Loads the records in the list into the DB.  This is transactional -
            either all or no records will be loaded.  Includes the DN of the
            sender.
    Severity: Minor
    Found in apel/db/backends/mysql.py - 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

    Function _check_factor has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        def _check_factor(self, sfu, sf):
            '''
            Check for the validity of the ScalingFactorUnit and ScalingFactor fields.
            We accept neither field included or both.  If only one of the fields is
            included, it doesn't really make sense so we reject it.
    Severity: Minor
    Found in apel/db/records/job.py - 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

    Function main has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

    def main():
        '''
        Parse command line arguments, set up logging and begin the client
        workflow.
        '''
    Severity: Minor
    Found in bin/client.py - 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

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

        def __init__(self, qpath, save_msgs, backend, host, port, db, user, pwd, pidfile):
    Severity: Major
    Found in apel/db/loader/loader.py - About 1 hr to fix

      Function main has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

      def main():
          '''
          Parse command line arguments, do initial setup, then initiate
          parsing process.
          '''
      Severity: Minor
      Found in bin/parser.py - 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

      Function check_dir has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

      def check_dir(root):
          '''
          Check the directory for incoming, outgoing, reject
          or accept directories.  If they exist, check them for
          messages.
      Severity: Minor
      Found in scripts/msg_status.py - 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

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

          def parse(self, line):
              '''
              Parses single line from PBS log file.
      
              Please notice, that we use two different separators: ';' and ' '
      Severity: Minor
      Found in apel/parsers/pbs.py - 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

      Function parseAurRecord has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          def parseAurRecord(self, xml_record):
              '''
              Main function for parsing AUR record.
      
              Interesting data can be fetched from 2 places:
      Severity: Minor
      Found in apel/db/loader/aur_parser.py - 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

      Function parseStarRecord has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          def parseStarRecord(self, xml_storage_record):
              """
              Parses single entry for Storage Accounting Record.
      
              Uses a dictionary containing fields from the storage record and methods
      Severity: Minor
      Found in apel/db/loader/star_parser.py - 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

      Function get_config has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

      def get_config(config_file):
          """Using the config file location, get a config object."""
          # Read configuration from file
          cp = ConfigParser.ConfigParser()
          cp.read(config_file)
      Severity: Minor
      Found in bin/retrieve_dns.py - 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

      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

        Severity
        Category
        Status
        Source
        Language