ComplianceAsCode/content

View on GitHub

Showing 231 of 1,039 total issues

File build_yaml.py has 1481 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 controls.py has 910 lines of code (exceeds 400 allowed). Consider refactoring.
        Open

        """
        Common functions for processing Controls in SSG
        """
        
        import collections
        Severity: Major
        Found in ssg/controls.py - About 1 day to fix

          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

            File xml.py has 726 lines of code (exceeds 400 allowed). Consider refactoring.
            Open

            """
            Common functions for processing XML in SSG
            """
            
            from __future__ import absolute_import
            Severity: Major
            Found in ssg/xml.py - About 1 day to fix

              File utils.py has 670 lines of code (exceeds 400 allowed). Consider refactoring.
              Open

              """
              Utils functions consumed by SSG
              """
              
              from __future__ import absolute_import
              Severity: Major
              Found in ssg/utils.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 606 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 rule.py has 577 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 6 hrs to fix

                    File oscap.py has 576 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 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

                        Rule has 37 functions (exceeds 20 allowed). Consider refactoring.
                        Open

                        class Rule(XCCDFEntity, Templatable):
                            """Represents XCCDF Rule
                            """
                            KEYS = dict(
                                description=lambda: "",
                        Severity: Minor
                        Found in ssg/build_yaml.py - About 4 hrs to fix

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