Showing 1,557 of 1,564 total issues

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

            'SubGroup': lambda nodes: self.getText(self.getTagByAttr(
                nodes['SubGroup'], 'attributeType', 'subgroup')[0].childNodes),
Severity: Major
Found in apel/db/loader/star_parser.py and 4 other locations - About 45 mins to fix
apel/db/loader/car_parser.py on lines 115..117
apel/db/loader/car_parser.py on lines 119..121
apel/db/loader/car_parser.py on lines 122..124
apel/db/loader/star_parser.py on lines 105..106

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

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

Avoid deeply nested control flow statements.
Open

                    if len([x for x in values if x[0] == name]) == 0:
                        values.append((name, value))

Severity: Major
Found in apel/ldap/query.py - About 45 mins to fix

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

                'VORole'           : lambda nodes: self.getText(
                                            self.getTagByAttr(nodes['GroupAttribute'],
                                                              'type', 'role')[0].childNodes),
    Severity: Major
    Found in apel/db/loader/car_parser.py and 4 other locations - About 45 mins to fix
    apel/db/loader/car_parser.py on lines 115..117
    apel/db/loader/car_parser.py on lines 119..121
    apel/db/loader/star_parser.py on lines 103..104
    apel/db/loader/star_parser.py on lines 105..106

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

    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

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

            if not 1 <= int(self._record_content['Month']) <= 12:
                raise InvalidRecordException("Month value is out of range")
    Severity: Minor
    Found in apel/db/records/summary.py and 1 other location - About 45 mins to fix
    apel/db/records/normalised_summary.py on lines 124..125

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

    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

    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 _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

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

                  'FQAN'             : lambda nodes: self.getText(
                                              self.getTagByAttr(nodes['GroupAttribute'],
                                                                'type', 'FQAN')[0].childNodes),
      Severity: Major
      Found in apel/db/loader/car_parser.py and 4 other locations - About 45 mins to fix
      apel/db/loader/car_parser.py on lines 119..121
      apel/db/loader/car_parser.py on lines 122..124
      apel/db/loader/star_parser.py on lines 103..104
      apel/db/loader/star_parser.py on lines 105..106

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

      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

      Avoid deeply nested control flow statements.
      Open

                                      if method == open:
                                          raise
                          except IOError as e:
      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

          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

                                          with method(abs_file, 'rb') as fp:
                                              parsed, total = parse_file(parser, apel_db,
                                                                         fp, reparse)
                                          break
          Severity: Major
          Found in bin/parser.py - About 45 mins to fix

            Identical blocks of code found in 2 locations. Consider refactoring.
            Open

                    if not 1 <= int(self._record_content['Month']) <= 12:
                        raise InvalidRecordException("Month value is out of range")
            Severity: Minor
            Found in apel/db/records/normalised_summary.py and 1 other location - About 45 mins to fix
            apel/db/records/summary.py on lines 123..124

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

            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 5 locations. Consider refactoring.
            Open

                        'Role': lambda nodes: self.getText(self.getTagByAttr(
                            nodes['Role'], 'attributeType', 'role')[0].childNodes),
            Severity: Major
            Found in apel/db/loader/star_parser.py and 4 other locations - About 45 mins to fix
            apel/db/loader/car_parser.py on lines 115..117
            apel/db/loader/car_parser.py on lines 119..121
            apel/db/loader/car_parser.py on lines 122..124
            apel/db/loader/star_parser.py on lines 103..104

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

            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 5 locations. Consider refactoring.
            Open

                        'VOGroup'          : lambda nodes: self.getText(
                                                    self.getTagByAttr(nodes['GroupAttribute'],
                                                                      'type', 'group')[0].childNodes),
            Severity: Major
            Found in apel/db/loader/car_parser.py and 4 other locations - About 45 mins to fix
            apel/db/loader/car_parser.py on lines 115..117
            apel/db/loader/car_parser.py on lines 122..124
            apel/db/loader/star_parser.py on lines 103..104
            apel/db/loader/star_parser.py on lines 105..106

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

            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

            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

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

                                try:
                                    log.info('Parsing file: %s', abs_file)
                                    # try to open as a bzip2 file, then as a gzip file,
                                    # and if it fails try as a regular file
                                    #
            Severity: Minor
            Found in bin/parser.py and 1 other location - About 45 mins to fix
            apel/db/loader/aur_parser.py on lines 131..136

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

            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 2 locations. Consider refactoring.
            Open

                        try:
                            data[field] = functions[field](nodes)
                        except IndexError as e:
                            log.debug('Failed to parse field %s: %s', field, e)
                        except KeyError as e:
            Severity: Minor
            Found in apel/db/loader/aur_parser.py and 1 other location - About 45 mins to fix
            bin/parser.py on lines 193..215

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

            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 2 locations. Consider refactoring.
            Open

                elif log_type == 'SGE':
                    try:
                        parser.set_ms_timestamps(cp.getboolean('batch', 'ge_ms_timestamps'))
                    except ConfigParser.NoOptionError:
                        log.warning("Option 'ge_ms_timestamps' not found in section 'batch'"
            Severity: Minor
            Found in bin/parser.py and 1 other location - About 40 mins to fix
            bin/parser.py on lines 297..301

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

            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 2 locations. Consider refactoring.
            Open

                if log_type == 'LSF':
                    try:
                        parser.set_scaling(cp.getboolean('batch', 'scale_host_factor'))
                    except ConfigParser.NoOptionError:
                        log.warning("Option 'scale_host_factor' not found in section 'batch"
            Severity: Minor
            Found in bin/parser.py and 1 other location - About 40 mins to fix
            bin/parser.py on lines 303..307

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

            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

            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
              Severity
              Category
              Status
              Source
              Language