ComplianceAsCode/content

View on GitHub

Showing 229 of 962 total issues

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 checks has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def checks(env_yaml, yaml_path, sce_dirs, template_builder, output):
    Severity: Minor
    Found in ssg/build_sce.py - About 35 mins to fix

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

      def build_index(benchmarks, input_basename, index_links, index_options,
      Severity: Minor
      Found in ssg/build_guides.py - About 35 mins to fix

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

        def handle_rule_yaml(product, rule_id, rule_dir, guide_dir, env_yaml):
        Severity: Minor
        Found in utils/create_scap_delta_tailoring.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 render_policy has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            def render_policy(
            Severity: Minor
            Found in utils/render_all_policies.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 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 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 _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 _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 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 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 flatten_stig_results has a Cognitive Complexity of 9 (exceeds 7 allowed). Consider refactoring.
                              Open

                              def flatten_stig_results(stig_results: dict) -> dict:
                                  base_stig_flat_results = dict()
                                  for stig, results in stig_results.items():
                                      if len(results) == 1:
                                          base_stig_flat_results[stig] = results[0]
                              Severity: Minor
                              Found in utils/compare_results.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 load_entities has a Cognitive Complexity of 9 (exceeds 7 allowed). Consider refactoring.
                              Open

                                  def load_entities(self, rules_by_id, values_by_id, groups_by_id):
                                      for rid, val in self.rules.items():
                                          if not val:
                                              self.rules[rid] = rules_by_id[rid]
                              
                              
                              Severity: Minor
                              Found in ssg/build_yaml.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 _open_yaml has a Cognitive Complexity of 9 (exceeds 7 allowed). Consider refactoring.
                              Open

                              def _open_yaml(stream, original_file=None, substitutions_dict={}):
                                  """
                                  Open given file-like object and parse it as YAML.
                              
                                  Optionally, pass the path to the original_file for better error handling
                              Severity: Minor
                              Found in ssg/yaml.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. start_affected is the line number of
                                  starting tag of the <affected> element, end_affected is the line number of
                              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 fill_queue has a Cognitive Complexity of 9 (exceeds 7 allowed). Consider refactoring.
                              Open

                              def fill_queue(benchmarks, benchmark_profile_pairs, input_path, path_base,
                                             output_dir):
                                  """
                                  For each benchmark and profile in the benchmark, create a queue of
                                  tasks for later processing. A task is a named tuple (benchmark_id,
                              Severity: Minor
                              Found in ssg/build_guides.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