ComplianceAsCode/content

View on GitHub

Showing 227 of 957 total issues

File build_yaml.py has 1458 lines of code (exceeds 400 allowed). Consider refactoring.
Open

from __future__ import absolute_import
from __future__ import print_function

from copy import deepcopy
import datetime
Severity: Major
Found in ssg/build_yaml.py - About 3 days to fix

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

        def parse(self, expr, simplify=False):
            """
            Return a boolean expression parsed from `expr` either a unicode string
            or tokens iterable.
    
    
    Severity: Minor
    Found in ssg/ext/boolean/boolean.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

    File boolean.py has 1126 lines of code (exceeds 400 allowed). Consider refactoring.
    Open

    """
    Boolean expressions algebra.
    
    This module defines a Boolean algebra over the set {TRUE, FALSE} with boolean
    variables called Symbols and the boolean functions AND, OR, NOT.
    Severity: Major
    Found in ssg/ext/boolean/boolean.py - About 2 days to fix

      File test_macros_oval.py has 1022 lines of code (exceeds 400 allowed). Consider refactoring.
      Open

      #!/usr/bin/python3
      
      import argparse
      
      import oval_tester
      Severity: Major
      Found in tests/test_macros_oval.py - About 2 days to fix

        Function show_profile_stats has a Cognitive Complexity of 103 (exceeds 7 allowed). Consider refactoring.
        Open

            def show_profile_stats(self, profile, options):
                """Displays statistics for specific profile"""
        
                profile_stats = self.get_profile_stats(profile)
                rules_count = profile_stats['rules_count']
        Severity: Minor
        Found in ssg/build_profile.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

        Function main has a Cognitive Complexity of 97 (exceeds 7 allowed). Consider refactoring.
        Open

        def main():
            global exit_value
            (options, args) = parse_options()
            xccdffilename = args[0]
        
        
        Severity: Minor
        Found in build-scripts/verify_references.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

        File build_profile.py has 736 lines of code (exceeds 400 allowed). Consider refactoring.
        Open

        from __future__ import absolute_import
        from __future__ import print_function
        
        import os
        import sys
        Severity: Major
        Found in ssg/build_profile.py - About 1 day to fix

          Function absorb has a Cognitive Complexity of 55 (exceeds 7 allowed). Consider refactoring.
          Open

              def absorb(self, args):
                  """
                  Given an `args` sequence of expressions, return a new list of expression
                  applying absorption and negative absorption.
          
          
          Severity: Minor
          Found in ssg/ext/boolean/boolean.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

          Function simplify has a Cognitive Complexity of 51 (exceeds 7 allowed). Consider refactoring.
          Open

              def simplify(self, sort=True):
                  """
                  Return a new simplified expression in canonical form from this
                  expression.
          
          
          Severity: Minor
          Found in ssg/ext/boolean/boolean.py - 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 release_helper.py has 583 lines of code (exceeds 400 allowed). Consider refactoring.
          Open

          #!/usr/bin/python3
          # -*- coding: utf-8 -*-
          
          """
          Script created to help maintainers during the release process by automating Github tasks.
          Severity: Major
          Found in utils/release_helper.py - About 6 hrs to fix

            File oscap.py has 578 lines of code (exceeds 400 allowed). Consider refactoring.
            Open

            #!/usr/bin/python3
            from __future__ import print_function
            
            import collections
            import datetime
            Severity: Major
            Found in tests/ssg_test_suite/oscap.py - About 6 hrs to fix

              Function print_report has a Cognitive Complexity of 42 (exceeds 7 allowed). Consider refactoring.
              Open

              def print_report(current_dict: dict, baseline_dict: dict = None) -> None:
                  """Print report with results of profiling to stdout"""
              
                  # If the targets/outputfiles have changed between baseline and current, we are using
                  # total_time_intersect to calculate delta (ratio of durations of targets) instead of total_time
              Severity: Minor
              Found in utils/build_profiler_report.py - About 6 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 _start_operation has a Cognitive Complexity of 41 (exceeds 7 allowed). Consider refactoring.
              Open

                  def _start_operation(self, ast, operation, precedence):
                      """
                      Return an AST where all operations of lower precedence are finalized.
                      """
                      if TRACE_PARSE:
              Severity: Minor
              Found in ssg/ext/boolean/boolean.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

              File rule.py has 557 lines of code (exceeds 400 allowed). Consider refactoring.
              Open

              from __future__ import print_function
              
              import collections
              import contextlib
              import fnmatch
              Severity: Major
              Found in tests/ssg_test_suite/rule.py - About 5 hrs to fix

                File fix_rules.py has 544 lines of code (exceeds 400 allowed). Consider refactoring.
                Open

                #!/usr/bin/python3
                
                from __future__ import print_function
                
                import sys
                Severity: Major
                Found in utils/fix_rules.py - About 5 hrs to fix

                  Function checks has a Cognitive Complexity of 35 (exceeds 7 allowed). Consider refactoring.
                  Open

                  def checks(env_yaml, yaml_path, sce_dirs, template_builder, output):
                      """
                      Walks the build system and builds all SCE checks (and metadata entry)
                      into the output directory.
                      """
                  Severity: Minor
                  Found in ssg/build_sce.py - About 4 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 data.py has 502 lines of code (exceeds 400 allowed). Consider refactoring.
                  Open

                  import string
                  
                  HEADERS = [
                      'IA Control', 'CCI', 'SRGID', 'STIGID', 'SRG Requirement', 'Requirement',
                      'SRG VulDiscussion', 'Vul Discussion', 'Status', 'SRG Check', 'Check', 'SRG Fix',
                  Severity: Major
                  Found in utils/srg_export/data.py - About 4 hrs to fix

                    Function to_xml_element has a Cognitive Complexity of 31 (exceeds 7 allowed). Consider refactoring.
                    Open

                        def to_xml_element(self, env_yaml=None):
                            rule = ET.Element('{%s}Rule' % XCCDF12_NS)
                            rule.set('selected', 'false')
                            rule.set('id', OSCAP_RULE + self.id_)
                            rule.set('severity', self.severity)
                    Severity: Minor
                    Found in ssg/build_yaml.py - About 4 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 common.py has 489 lines of code (exceeds 400 allowed). Consider refactoring.
                    Open

                    from __future__ import print_function
                    
                    import functools
                    import logging
                    import os
                    Severity: Minor
                    Found in tests/ssg_test_suite/common.py - About 4 hrs to fix

                      File ansible_playbook_to_role.py has 488 lines of code (exceeds 400 allowed). Consider refactoring.
                      Open

                      #!/usr/bin/python3
                      
                      from __future__ import print_function
                      
                      from tempfile import mkdtemp
                      Severity: Minor
                      Found in utils/ansible_playbook_to_role.py - About 4 hrs to fix
                        Severity
                        Category
                        Status
                        Source
                        Language