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)
- Read upRead up
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
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:
- Read upRead up
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:
- Read upRead up
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:
- Read upRead up
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
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':
- Read upRead up
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:
- Read upRead up
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:
- Read upRead up
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:
- Read upRead up
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)
- Read upRead up
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:
- Read upRead up
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)
- Read upRead up
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:')
- Read upRead up
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:
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:
- Read upRead up
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
- Read upRead up
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)
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)
- Read upRead up
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):