code4game/libgltf

View on GitHub

Showing 40 of 92 total issues

Function generate has a Cognitive Complexity of 125 (exceeds 5 allowed). Consider refactoring.
Open

    def generate(self, codeFileName, outputHeaderPath=None, outputSourcePath=None, nameSpace=None, config=None):
        header_file_path = u'%s.h.cmakein' % codeFileName
        source_file_path = u'%s.cpp' % codeFileName
        if outputHeaderPath is not None:
            header_file_path = os.path.join(outputHeaderPath, header_file_path)
Severity: Minor
Found in tools/jsonschematoc11/jsonschematoc11.py - About 2 days 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

File jsonschematoc11.py has 550 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import sys
import os
import argparse
from configparser import SafeConfigParser
import logging
Severity: Major
Found in tools/jsonschematoc11/jsonschematoc11.py - About 1 day to fix

    Function codeParserSource has a Cognitive Complexity of 34 (exceeds 5 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 5 hrs 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 revise has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
    Open

        def revise(self, c11Types):
            variableSchemaValue = self.schemaValue
            if u'$ref' in self.schemaValue:
                schemaValueType = self.schemaValue[u'$ref']
            elif u'type' in self.schemaValue:
    Severity: Minor
    Found in tools/jsonschematoc11/c11types/c11variable.py - About 4 hrs 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 codeSource has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
    Open

        def codeSource(self, codeTypeNames):
            codeLines = []
            if self.codeTypeName() in codeTypeNames:
                return codeLines
            for key in self.parents:
    Severity: Minor
    Found in tools/jsonschematoc11/c11types/c11typestruct.py - About 4 hrs 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

    File c11typestruct.py has 307 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    from .c11type import C11Type
    from .c11typebool import C11TypeBool
    from .c11typeinteger import C11TypeInteger
    from .c11typenumber import C11TypeNumber
    from .c11typestring import C11TypeString
    Severity: Minor
    Found in tools/jsonschematoc11/c11types/c11typestruct.py - About 3 hrs to fix

      Function setSchema has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
      Open

          def setSchema(self, schemaName, schemaValue):
              C11Type.setSchema(self, schemaName, schemaValue)
              if u'type' in schemaValue:
                  schemaValueType = schemaValue[u'type']
                  if schemaValueType == u'bool' or schemaValueType == u'boolean':
      Severity: Minor
      Found in tools/jsonschematoc11/c11types/c11typestruct.py - About 3 hrs 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 addSchema has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
      Open

          def addSchema(self, rootPath, schemaFileName, config=None):
              schema_file_path = os.path.join(rootPath, schemaFileName)
              with open(schema_file_path, u'r') as schema_file:
                  schema = json.load(schema_file)
                  if schema is None:
      Severity: Minor
      Found in tools/jsonschematoc11/jsonschematoc11.py - About 2 hrs 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 codeHeader has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

          def codeHeader(self, codeTypeNames):
              codeLines = []
              if self.codeTypeName() in codeTypeNames:
                  return codeLines
              for key in self.parents:
      Severity: Minor
      Found in tools/jsonschematoc11/c11types/c11typestruct.py - About 2 hrs 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 buildC11Type has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

          def buildC11Type(self, schemaValue):
              c11Type = None
              schemaValueType = None
              variableSchemaValue = schemaValue
              if u'type' in schemaValue:
      Severity: Minor
      Found in tools/jsonschematoc11/c11types/c11typearray.py - About 2 hrs 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 revise has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

          def revise(self, c11Types):
              from .c11typestruct import C11TypeStruct
              from .c11typemap import C11TypeMap
              if not isinstance(self.c11Type, C11TypeStruct) and not isinstance(self.c11Type, C11TypeMap):
                  return (0, None)
      Severity: Minor
      Found in tools/jsonschematoc11/c11types/c11typearray.py - About 2 hrs 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 codeParser has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

          def codeParser(self, isSet=True):
              codeLines = []
              codeCheckLine = self.c11Type.codeJsonCheck()
              if isSet:
                  if codeCheckLine is None or len(codeCheckLine) <= 0:
      Severity: Minor
      Found in tools/jsonschematoc11/c11types/c11variable.py - About 2 hrs 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

      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 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

          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

          Function BuildC11Type has 8 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          def BuildC11Type(schemaName, schemaValue, isSchema=False, manualCodeHeaders=None, manualCodeSourcesVariable=None, manualCodeSourcesFunction=None, manualCodeParsersFrom=None, manualCodeParsersTo=None):
          Severity: Major
          Found in tools/jsonschematoc11/c11types/__init__.py - About 1 hr to fix
            Severity
            Category
            Status
            Source
            Language