ComplianceAsCode/content

View on GitHub

Showing 231 of 1,039 total issues

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

    def compare_platforms(self, old_rule, new_rule, old_benchmark, new_benchmark, identifier):
Severity: Minor
Found in ssg/content_diff.py - About 35 mins to fix

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

    def fill_queue(benchmarks, benchmark_profile_pairs, input_path, path_base,
    Severity: Minor
    Found in ssg/build_guides.py - About 35 mins to fix

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

          def generate_diff_text(self, old_r, new_r,
      Severity: Minor
      Found in ssg/content_diff.py - About 35 mins to fix

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

        def add_cpe_item_to_dictionary(
        Severity: Minor
        Found in ssg/build_derivatives.py - About 35 mins to fix

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

          def print_stats(status_count, control_list, rules_count, vars_count, args):
          Severity: Minor
          Found in utils/controleval.py - About 35 mins to fix

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

            def _process_controls_manager(controls_manager, env_yaml, product_yaml, profile, rule_dirs):
            Severity: Minor
            Found in utils/refchecker.py - About 35 mins to fix

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

                  def create_playbook(self, snippet_path, rule_id, variables,
              Severity: Minor
              Found in ssg/playbook_builder.py - About 35 mins to fix

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

                    def compare_ovals(self, old_oval_def_doc, old_oval_def_id,
                Severity: Minor
                Found in ssg/content_diff.py - About 35 mins to fix

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

                  def _walk_rule(args, rule_obj, oval_func, remediation_func, verbose_output):
                  Severity: Minor
                  Found in ssg/rule_dir_stats.py - About 35 mins to fix

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

                    def walk_rules_diff(args, left_rules, right_rules, oval_func, remediation_func):
                    Severity: Minor
                    Found in ssg/rule_dir_stats.py - About 35 mins to fix

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

                      def rewrite_section_value(file_contents, yaml_contents, section, keys, transform):
                      Severity: Minor
                      Found in utils/fix_rules.py - About 35 mins to fix

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

                        def handle_rule_yaml(args, rule_id, rule_dir, guide_dir, env_yaml):
                        Severity: Minor
                        Found in utils/build_stig_control.py - About 35 mins to fix

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

                          def _add_cce(directory, cce_pool, rules, product_yaml, args):
                          Severity: Minor
                          Found in utils/fix_rules.py - About 35 mins to fix

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

                            def handle_rule_yaml(product_list, product_yamls, rule_id, rule_dir, guide_dir):
                            Severity: Minor
                            Found in utils/rule_dir_json.py - About 35 mins to fix

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

                                  def _check_rule(self, rule, scenarios, remote_dir, state, remediation_available):
                              Severity: Minor
                              Found in tests/ssg_test_suite/rule.py - About 35 mins to fix

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

                                def find_fix_in_benchmark(datastream, benchmark_id, rule_id, fix_type='bash', logging=None):
                                Severity: Minor
                                Found in tests/ssg_test_suite/xml_operations.py - About 35 mins to fix

                                  Function choose_variable_value has a Cognitive Complexity of 9 (exceeds 7 allowed). Consider refactoring.
                                  Open

                                      def choose_variable_value(self, var_id, variables, refinements):
                                          """
                                          Determine value of variable based on profile refinements.
                                          """
                                          if refinements and var_id in refinements:
                                  Severity: Minor
                                  Found in ssg/playbook_builder.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_affected has a Cognitive Complexity of 9 (exceeds 7 allowed). Consider refactoring.
                                  Open

                                  def parse_affected(oval_contents):
                                      """
                                      Returns the tuple (start_affected, end_affected, platform_indents) for the passed OVAL file contents.
                                  
                                      Args:
                                  Severity: Minor
                                  Found in ssg/oval.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 split_remediation_content_and_metadata has a Cognitive Complexity of 9 (exceeds 7 allowed). Consider refactoring.
                                  Open

                                  def split_remediation_content_and_metadata(fix_file):
                                      remediation_contents = []
                                      config = defaultdict(lambda: None)
                                  
                                      # Assignment automatically escapes shell characters for XML
                                  Severity: Minor
                                  Found in ssg/build_remediations.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 __init__ has a Cognitive Complexity of 9 (exceeds 7 allowed). Consider refactoring.
                                  Open

                                      def __init__(self, filepath, product=""):
                                          self.tree = None
                                          try:
                                              with open(filepath, 'r') as xccdf_file:
                                                  file_string = xccdf_file.read()
                                  Severity: Minor
                                  Found in ssg/build_profile.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

                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language