code4game/libgltf

View on GitHub

Showing 92 of 92 total issues

Similar blocks of code found in 3 locations. Consider refactoring.
Open

        for schema_value in schemaDefaultValues:
            if len(code_default_value) > 0:
                code_default_value = code_default_value + u', '
            code_default_value = code_default_value + u'%d' % schema_value
Severity: Major
Found in tools/jsonschematoc11/c11types/c11typeinteger.py and 2 other locations - About 1 hr to fix
tools/jsonschematoc11/c11types/c11typenumber.py on lines 24..27
tools/jsonschematoc11/c11types/c11typestring.py on lines 26..29

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 48.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 3 locations. Consider refactoring.
Open

        for schema_value in schemaDefaultValues:
            if len(code_default_value) > 0:
                code_default_value = code_default_value + u', '
            code_default_value = code_default_value + u'"%s"' % schema_value
Severity: Major
Found in tools/jsonschematoc11/c11types/c11typestring.py and 2 other locations - About 1 hr to fix
tools/jsonschematoc11/c11types/c11typeinteger.py on lines 22..25
tools/jsonschematoc11/c11types/c11typenumber.py on lines 24..27

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 48.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

        if withDeclare:
            if withDocument:
                codeLine = u'TDataDoc<%s>' % codeLine
            else:
                codeLine = u'%s' % codeLine
Severity: Major
Found in tools/jsonschematoc11/c11types/c11typestruct.py and 1 other location - About 1 hr to fix
tools/jsonschematoc11/c11types/c11typenone.py on lines 15..22

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 47.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

        if withDeclare:
            if withDocument:
                codeLine = u'TDataDoc<struct %s>' % codeLine
            else:
                codeLine = u'struct %s' % codeLine
Severity: Major
Found in tools/jsonschematoc11/c11types/c11typenone.py and 1 other location - About 1 hr to fix
tools/jsonschematoc11/c11types/c11typestruct.py on lines 100..107

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 47.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    def codeTypeName(self, withDeclare=False, asVariable=False, withDocument=False):
        #if withDocument:
        #    return u'TDataDoc<%s<%s>>' % (self.typeName, self.c11Type.codeTypeName(withDeclare=withDeclare, asVariable=True))
        return u'%s<%s>' % (self.typeName, self.c11Type.codeTypeName(withDeclare=withDeclare, asVariable=asVariable, withDocument=withDocument))
Severity: Major
Found in tools/jsonschematoc11/c11types/c11typearray.py and 1 other location - About 1 hr to fix
tools/jsonschematoc11/c11types/c11typemap.py on lines 61..64

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 43.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Function codeTypeName has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def codeTypeName(self, withDeclare=False, asVariable=False, withDocument=False):
        codeLine = self.typeName
        if self.typeName is None:
            #TODO:
            print(u':todo:')
Severity: Minor
Found in tools/jsonschematoc11/c11types/c11typestruct.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 JSONSchemaToC11 has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

def JSONSchemaToC11(argv):
    parser = argparse.ArgumentParser(description=u'Generate c11 code by json schema.')
    parser.add_argument(u'configFile', metavar=u'config_file', type=open, help=u'The configuration file')
    args = parser.parse_args(argv)

Severity: Minor
Found in tools/jsonschematoc11/jsonschematoc11.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

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    def codeTypeName(self, withDeclare=False, asVariable=False, withDocument=False):
        #if withDocument:
        #    return u'TDataDoc<%s<std::string, %s>>' % (self.typeName, self.c11Type.codeTypeName(withDeclare=withDeclare, asVariable=True))
        return u'%s<std::string, %s>' % (self.typeName, self.c11Type.codeTypeName(withDeclare=withDeclare, asVariable=asVariable, withDocument=withDocument))
Severity: Major
Found in tools/jsonschematoc11/c11types/c11typemap.py and 1 other location - About 1 hr to fix
tools/jsonschematoc11/c11types/c11typearray.py on lines 96..99

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 43.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Function codeParserSource has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def codeParserSource(self):
        codeLines = []
        codeLines.append(u'bool operator<<(%s& _rData, const JSONCharValue& _JsonValue)' % (self.codeTypeName()))
        codeLines.append(u'{')
        if self.manualCodeParsersFrom is not None and len(self.manualCodeParsersFrom) > 0:
Severity: Minor
Found in tools/jsonschematoc11/c11types/c11typestruct.py - About 1 hr to fix

    Function BuildC11Type has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

    def BuildC11Type(schemaName, schemaValue, isSchema=False, manualCodeHeaders=None, manualCodeSourcesVariable=None, manualCodeSourcesFunction=None, manualCodeParsersFrom=None, manualCodeParsersTo=None):
        if u'title' not in schemaValue:
            return (None, 1, u'can\'t get the attribute `title` in %s' % schemaName)
        c11Type = None
        if not isSchema and u'type' in schemaValue:
    Severity: Minor
    Found in tools/jsonschematoc11/c11types/__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 codeTypeName has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        def codeTypeName(self, withDeclare=False, asVariable=False, withDocument=False):
            codeLine = self.typeName
            if withDeclare:
                if withDocument:
                    codeLine = u'TDataDoc<struct %s>' % codeLine
    Severity: Minor
    Found in tools/jsonschematoc11/c11types/c11typenone.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 JSONSchemaToC11 has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    def JSONSchemaToC11(argv):
        parser = argparse.ArgumentParser(description=u'Generate c11 code by json schema.')
        parser.add_argument(u'configFile', metavar=u'config_file', type=open, help=u'The configuration file')
        args = parser.parse_args(argv)
    
    
    Severity: Minor
    Found in tools/jsonschematoc11/jsonschematoc11.py - About 1 hr to fix

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

              for parentTypeName in parentTypeNames:
                  if beginConstructorDefault:
                      codeLines.append(u'    : %s()' % parentTypeName)
                      beginConstructorDefault = False
                  else:
      Severity: Major
      Found in tools/jsonschematoc11/c11types/c11typestruct.py and 1 other location - About 1 hr to fix
      tools/jsonschematoc11/c11types/c11typestruct.py on lines 207..212

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 40.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

                  for variable in self.manualCodeSourcesVariable:
                      if beginConstructorDefault:
                          codeLines.append(u'    : %s' % variable)
                          beginConstructorDefault = False
                      else:
      Severity: Major
      Found in tools/jsonschematoc11/c11types/c11typestruct.py and 1 other location - About 1 hr to fix
      tools/jsonschematoc11/c11types/c11typestruct.py on lines 186..191

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 40.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

              if self.manualCodeParsersFrom is not None and len(self.manualCodeParsersFrom) > 0:
                  codeLines.append(u'    // Manual code lines')
                  for code_parser in self.manualCodeParsersFrom:
                      codeLines.append(u'    %s' % code_parser.replace(u'\n', u''))
      Severity: Major
      Found in tools/jsonschematoc11/c11types/c11typestruct.py and 1 other location - About 1 hr to fix
      tools/jsonschematoc11/c11types/c11typestruct.py on lines 280..283

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 40.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

              if self.manualCodeParsersTo is not None and len(self.manualCodeParsersTo) > 0:
                  codeLines.append(u'    // Manual code lines')
                  for code_parser in self.manualCodeParsersTo:
                      codeLines.append(u'    %s' % code_parser.replace(u'\n', u''))
      Severity: Major
      Found in tools/jsonschematoc11/c11types/c11typestruct.py and 1 other location - About 1 hr to fix
      tools/jsonschematoc11/c11types/c11typestruct.py on lines 252..255

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 40.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 3 locations. Consider refactoring.
      Open

                  if nameSpace != None:
                      header_file.write(u'namespace %s\n' % nameSpace)
                      header_file.write(u'{\n')
                      begin_space = u'    '
      Severity: Major
      Found in tools/jsonschematoc11/jsonschematoc11.py and 2 other locations - About 1 hr to fix
      tools/jsonschematoc11/jsonschematoc11.py on lines 271..274
      tools/jsonschematoc11/jsonschematoc11.py on lines 387..390

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 39.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 3 locations. Consider refactoring.
      Open

                  if nameSpace != None:
                      source_file.write(u'namespace %s\n' % nameSpace)
                      source_file.write(u'{\n')
                      begin_space = u'    '
      Severity: Major
      Found in tools/jsonschematoc11/jsonschematoc11.py and 2 other locations - About 1 hr to fix
      tools/jsonschematoc11/jsonschematoc11.py on lines 271..274
      tools/jsonschematoc11/jsonschematoc11.py on lines 335..338

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 39.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 3 locations. Consider refactoring.
      Open

                  if nameSpace != None:
                      source_file.write(u'namespace %s\n' % nameSpace)
                      source_file.write(u'{\n')
                      begin_space = u'    '
      Severity: Major
      Found in tools/jsonschematoc11/jsonschematoc11.py and 2 other locations - About 1 hr to fix
      tools/jsonschematoc11/jsonschematoc11.py on lines 335..338
      tools/jsonschematoc11/jsonschematoc11.py on lines 387..390

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 39.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Function addSchemaDirectory has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

          def addSchemaDirectory(self, schemaDirectory, config=None):
              schema_directory = os.path.normpath(schemaDirectory)
              if not os.path.isdir(schema_directory):
                  return (1, u'The schema directory (%s) is not a valid directory' % schema_directory)
      
      
      Severity: Minor
      Found in tools/jsonschematoc11/jsonschematoc11.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

      Severity
      Category
      Status
      Source
      Language