code4game/libgltf

View on GitHub

Showing 40 of 92 total issues

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

    def buildC11Type(self, schemaValue):
        c11Type = None
        if u'type' in schemaValue:
            schemaValueType = schemaValue[u'type']
            if schemaValueType == u'bool' or schemaValueType == u'boolean':
Severity: Minor
Found in tools/jsonschematoc11/c11types/c11typemap.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 codeDefaultValueArray has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def codeDefaultValueArray(self, schemaDefaultValues):
        if schemaDefaultValues is None\
            or not isinstance(schemaDefaultValues, list)\
            or len(schemaDefaultValues) <= 0:
            return u''
Severity: Minor
Found in tools/jsonschematoc11/c11types/c11typebool.py - About 45 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

Avoid deeply nested control flow statements.
Open

                        for code_header_extra_line in code_header_extra_lines:
                            header_file.write(code_header_extra_line)
                        header_file.write(u'\n')
Severity: Major
Found in tools/jsonschematoc11/jsonschematoc11.py - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                            for code_file_line in code_file_lines:
                                header_file.write(u' * ' + code_file_line)
                            header_file.write(u' */\n')
    Severity: Major
    Found in tools/jsonschematoc11/jsonschematoc11.py - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                              for code_header_extra_line in code_header_extra_lines:
                                  header_file.write(code_header_extra_line)
                              header_file.write(u'\n')
      Severity: Major
      Found in tools/jsonschematoc11/jsonschematoc11.py - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                                for code_file_line in code_file_lines:
                                    header_file.write(u' * ' + code_file_line)
                                header_file.write(u' */\n')
        Severity: Major
        Found in tools/jsonschematoc11/jsonschematoc11.py - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                                  for code_file_line in code_file_lines:
                                      source_file.write(u' * ' + code_file_line)
                                  source_file.write(u' */')
          Severity: Major
          Found in tools/jsonschematoc11/jsonschematoc11.py - About 45 mins to fix

            Function getParentTypeNames has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                def getParentTypeNames(self, recursion=True, withDeclare=False, asVariable=False, withObject=False):
                    parentTypeNames = []
                    for key in self.parents:
                        parent = self.parents[key]
                        if recursion:
            Severity: Minor
            Found in tools/jsonschematoc11/c11types/c11typestruct.py - About 45 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

            Avoid deeply nested control flow statements.
            Open

                                    for code_header_extra_line in code_header_extra_lines:
                                        header_file.write(code_header_extra_line)
                                    header_file.write(u'\n')
            Severity: Major
            Found in tools/jsonschematoc11/jsonschematoc11.py - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                      for code_header_extra_line in code_header_extra_lines:
                                          header_file.write(code_header_extra_line)
                                      header_file.write(u'\n')
              Severity: Major
              Found in tools/jsonschematoc11/jsonschematoc11.py - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                        for code_file_line in code_file_lines:
                                            source_file.write(u' * ' + code_file_line)
                                        source_file.write(u' */\n')
                Severity: Major
                Found in tools/jsonschematoc11/jsonschematoc11.py - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                          for code_header_extra_line in code_header_extra_lines:
                                              header_file.write(code_header_extra_line)
                                          header_file.write(u'\n')
                  Severity: Major
                  Found in tools/jsonschematoc11/jsonschematoc11.py - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                            for code_header_extra_line in code_header_extra_lines:
                                                header_file.write(code_header_extra_line)
                                            header_file.write(u'\n')
                    Severity: Major
                    Found in tools/jsonschematoc11/jsonschematoc11.py - About 45 mins to fix

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

                          def setCodes(self, manualCodeHeaders, manualCodeSourcesVariable, manualCodeSourcesFunction, manualCodeParsersFrom, manualCodeParsersTo):
                      Severity: Minor
                      Found in tools/jsonschematoc11/c11types/c11type.py - About 35 mins to fix

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

                            def generate(self, codeFileName, outputHeaderPath=None, outputSourcePath=None, nameSpace=None, config=None):
                        Severity: Minor
                        Found in tools/jsonschematoc11/jsonschematoc11.py - About 35 mins to fix

                          Avoid too many return statements within this function.
                          Open

                                      return (error_code, error_message)
                          Severity: Major
                          Found in tools/jsonschematoc11/jsonschematoc11.py - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                    return (error_code, error_message)
                            Severity: Major
                            Found in tools/jsonschematoc11/jsonschematoc11.py - About 30 mins to fix

                              Avoid too many return statements within this function.
                              Open

                                      return (error_code, error_message)
                              Severity: Major
                              Found in tools/jsonschematoc11/jsonschematoc11.py - About 30 mins to fix

                                Avoid too many return statements within this function.
                                Open

                                    return (0, u'')
                                Severity: Major
                                Found in tools/jsonschematoc11/jsonschematoc11.py - About 30 mins to fix

                                  Function revise has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                      def revise(self, c11Types):
                                          for key in self.parents:
                                              if key not in c11Types:
                                                  return (1, u'Can\'t find the parent %s in %s' % (key, self.codeTypeName()))
                                              self.parents[key] = c11Types[key]
                                  Severity: Minor
                                  Found in tools/jsonschematoc11/c11types/c11typestruct.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

                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language