ComplianceAsCode/content

View on GitHub
ssg/templates.py

Summary

Maintainability
B
5 hrs
Test Coverage
F
59%

File templates.py has 490 lines of code (exceeds 400 allowed). Consider refactoring.
Open

"""
Common functions for processing Templates in SSG
"""

from __future__ import absolute_import
Severity: Minor
Found in ssg/templates.py - About 4 hrs to fix

    Function __init__ has 7 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def __init__(self, env_yaml, resolved_rules_dir, templates_dir,
    Severity: Major
    Found in ssg/templates.py - About 50 mins to fix

      Method "__init__" has 8 parameters, which is greater than the 7 authorized.
      Open

          def __init__(self, env_yaml, resolved_rules_dir, templates_dir,
                       remediations_dir, checks_dir, platforms_dir, cpe_items_dir):
      Severity: Major
      Found in ssg/templates.py by sonar-python

      A long parameter list can indicate that a new structure should be created to wrap the numerous parameters or that the function is doing too many things.

      Noncompliant Code Example

      With a maximum number of 4 parameters:

      def do_something(param1, param2, param3, param4, param5):
          ...
      

      Compliant Solution

      def do_something(param1, param2, param3, param4):
          ...
      

      Line too long (103 > 99 characters)
      Open

                  FileNotFoundError: If the "extra_ovals.yml" file does not exist in the templates directory.
      Severity: Minor
      Found in ssg/templates.py by pep8

      Limit all lines to a maximum of 79 characters.

      There are still many devices around that are limited to 80 character
      lines; plus, limiting windows to 80 characters makes it possible to
      have several windows side-by-side.  The default wrapping on such
      devices looks ugly.  Therefore, please limit all lines to a maximum
      of 79 characters. For flowing long blocks of text (docstrings or
      comments), limiting the length to 72 characters is recommended.
      
      Reports error E501.

      Line too long (117 > 99 characters)
      Open

              1. Identifies languages affecting the platform by examining the symbols associated with the platform's tests.
      Severity: Minor
      Found in ssg/templates.py by pep8

      Limit all lines to a maximum of 79 characters.

      There are still many devices around that are limited to 80 character
      lines; plus, limiting windows to 80 characters makes it possible to
      have several windows side-by-side.  The default wrapping on such
      devices looks ugly.  Therefore, please limit all lines to a maximum
      of 79 characters. For flowing long blocks of text (docstrings or
      comments), limiting the length to 72 characters is recommended.
      
      Reports error E501.

      Line too long (116 > 99 characters)
      Open

              2. For each CPE that is templated, it builds the CPE and determines the languages that need to be generated.
      Severity: Minor
      Found in ssg/templates.py by pep8

      Limit all lines to a maximum of 79 characters.

      There are still many devices around that are limited to 80 character
      lines; plus, limiting windows to 80 characters makes it possible to
      have several windows side-by-side.  The default wrapping on such
      devices looks ugly.  Therefore, please limit all lines to a maximum
      of 79 characters. For flowing long blocks of text (docstrings or
      comments), limiting the length to 72 characters is recommended.
      
      Reports error E501.

      Line too long (102 > 99 characters)
      Open

              Processes a template for a given template name and language, and returns the rendered content.
      Severity: Minor
      Found in ssg/templates.py by pep8

      Limit all lines to a maximum of 79 characters.

      There are still many devices around that are limited to 80 character
      lines; plus, limiting windows to 80 characters makes it possible to
      have several windows side-by-side.  The default wrapping on such
      devices looks ugly.  Therefore, please limit all lines to a maximum
      of 79 characters. For flowing long blocks of text (docstrings or
      comments), limiting the length to 72 characters is recommended.
      
      Reports error E501.

      There are no issues that match your filters.

      Category
      Status