alainivars/utils2devops

View on GitHub
utils2devops/aws/__init__.py

Summary

Maintainability
C
1 day
Test Coverage

File __init__.py has 443 lines of code (exceeds 250 allowed). Consider refactoring.
Open

class BaseFormat:
    begin_block = '{\n'
    end_block = '}\n\n'

    def format_item(self, name, item, indent: int = 1):
Severity: Minor
Found in utils2devops/aws/__init__.py - About 6 hrs to fix

    Function add_str_tags has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

        def add_str_tags(self):
            the_str = '\ttags {\n'
            tags = self.tags
            if type(tags) == list:
                for tag in self.tags:
    Severity: Minor
    Found in utils2devops/aws/__init__.py - About 1 hr 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 __str__ has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def __str__(self):
            the_str = super(Lambda, self).__str__()
            the_str += self.format_item_cond('filename', self.ofilename)
            the_str += self.format_item_cond('s3_bucket', self.os3_bucket)
            the_str += self.format_item_cond('s3_key', self.os3_key)
    Severity: Minor
    Found in utils2devops/aws/__init__.py - About 1 hr to fix

      Function __str__ has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          def __str__(self):
              the_str = ''
              if not self.inserted:
                  the_str += super(Route, self).__str__()
              the_str += '\n\troute {\n'
      Severity: Minor
      Found in utils2devops/aws/__init__.py - About 55 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 __str__ has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          def __str__(self):
              if any('Name' in d['Key'] for d in self.tags):
                  for tag in self.tags:
                      if tag['Key'] == 'Name' and tag['Value'] not in self.name:
                          self.name = self.name + '-' + tag['Value']
      Severity: Minor
      Found in utils2devops/aws/__init__.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 __str__ has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def __str__(self):
              if any('Name' in d['Key'] for d in self.tags):
                  for tag in self.tags:
                      if tag['Key'] == 'Name':
                          self.name = self.name + '-' + tag['Value']
      Severity: Minor
      Found in utils2devops/aws/__init__.py - About 25 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 __str__ has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def __str__(self):
              the_str = super(Lambda, self).__str__()
              the_str += self.format_item_cond('filename', self.ofilename)
              the_str += self.format_item_cond('s3_bucket', self.os3_bucket)
              the_str += self.format_item_cond('s3_key', self.os3_key)
      Severity: Minor
      Found in utils2devops/aws/__init__.py - About 25 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

      There are no issues that match your filters.

      Category
      Status