code4game/libgltf

View on GitHub

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

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

                for key in self.c11Types:
                    c11_type = self.c11Types[key]
                    if c11_type.codeTypeName() in parent_type_names:
                        continue
    
    
    Severity: Major
    Found in tools/jsonschematoc11/jsonschematoc11.py and 1 other location - About 1 day to fix
    tools/jsonschematoc11/jsonschematoc11.py on lines 284..299

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

    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 key in self.c11Types:
                    c11_type = self.c11Types[key]
                    if c11_type.codeTypeName() in parent_type_names:
                        continue
    
    
    Severity: Major
    Found in tools/jsonschematoc11/jsonschematoc11.py and 1 other location - About 1 day to fix
    tools/jsonschematoc11/jsonschematoc11.py on lines 217..232

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

    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 config is not None and config.has_option(u'code', u'license'):
                    code_file_path = config.get(u'code', u'license')
                    if os.path.isfile(code_file_path):
                        with open(code_file_path, u'r') as code_file:
                            header_file.write(u'/*\n')
    Severity: Major
    Found in tools/jsonschematoc11/jsonschematoc11.py and 1 other location - About 7 hrs to fix
    tools/jsonschematoc11/jsonschematoc11.py on lines 372..381

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

    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 config is not None and config.has_option(u'code', u'license'):
                    code_file_path = config.get(u'code', u'license')
                    if os.path.isfile(code_file_path):
                        with open(code_file_path, u'r') as code_file:
                            source_file.write(u'/*\n')
    Severity: Major
    Found in tools/jsonschematoc11/jsonschematoc11.py and 1 other location - About 7 hrs to fix
    tools/jsonschematoc11/jsonschematoc11.py on lines 142..151

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

    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 config is not None and config.has_option(u'code', u'license'):
                    code_file_path = config.get(u'code', u'license')
                    if os.path.isfile(code_file_path):
                        with open(code_file_path, u'r') as code_file:
                            code_file_lines = code_file.readlines()
    Severity: Major
    Found in tools/jsonschematoc11/jsonschematoc11.py and 1 other location - About 7 hrs to fix
    tools/jsonschematoc11/jsonschematoc11.py on lines 311..320

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

    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 config is not None and config.has_option(u'code', u'license'):
                    code_file_path = config.get(u'code', u'license')
                    if os.path.isfile(code_file_path):
                        with open(code_file_path, u'r') as code_file:
                            code_file_lines = code_file.readlines()
    Severity: Major
    Found in tools/jsonschematoc11/jsonschematoc11.py and 1 other location - About 7 hrs to fix
    tools/jsonschematoc11/jsonschematoc11.py on lines 256..265

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

    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 key in self.c11Types:
                    c11_type = self.c11Types[key]
                    if not isinstance(c11_type, C11TypeStruct):
                        continue
    
    
    Severity: Major
    Found in tools/jsonschematoc11/jsonschematoc11.py and 1 other location - About 5 hrs to fix
    tools/jsonschematoc11/jsonschematoc11.py on lines 355..366

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

    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 key in self.c11Types:
                    c11_type = self.c11Types[key]
                    if not isinstance(c11_type, C11TypeStruct):
                        continue
    
    
    Severity: Major
    Found in tools/jsonschematoc11/jsonschematoc11.py and 1 other location - About 5 hrs to fix
    tools/jsonschematoc11/jsonschematoc11.py on lines 549..560

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

    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 6 locations. Consider refactoring.
    Open

                if config is not None and config.has_option(u'code.headers', u'header.begin'):
                    code_file_path = config.get(u'code.headers', u'header.begin')
                    if os.path.isfile(code_file_path):
                        with open(code_file_path, u'r') as code_file:
                            code_header_extra_lines = code_file.readlines()
    Severity: Major
    Found in tools/jsonschematoc11/jsonschematoc11.py and 5 other locations - About 5 hrs to fix
    tools/jsonschematoc11/jsonschematoc11.py on lines 162..169
    tools/jsonschematoc11/jsonschematoc11.py on lines 192..199
    tools/jsonschematoc11/jsonschematoc11.py on lines 234..241
    tools/jsonschematoc11/jsonschematoc11.py on lines 246..253
    tools/jsonschematoc11/jsonschematoc11.py on lines 325..332

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

    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 6 locations. Consider refactoring.
    Open

                if config is not None and config.has_option(u'code.headers', u'header.end'):
                    code_file_path = config.get(u'code.headers', u'header.end')
                    if os.path.isfile(code_file_path):
                        with open(code_file_path, u'r') as code_file:
                            code_header_extra_lines = code_file.readlines()
    Severity: Major
    Found in tools/jsonschematoc11/jsonschematoc11.py and 5 other locations - About 5 hrs to fix
    tools/jsonschematoc11/jsonschematoc11.py on lines 153..160
    tools/jsonschematoc11/jsonschematoc11.py on lines 162..169
    tools/jsonschematoc11/jsonschematoc11.py on lines 192..199
    tools/jsonschematoc11/jsonschematoc11.py on lines 234..241
    tools/jsonschematoc11/jsonschematoc11.py on lines 325..332

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

    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 6 locations. Consider refactoring.
    Open

                if config is not None and config.has_option(u'code.parser', u'header'):
                    code_file_path = config.get(u'code.parser', u'header')
                    if os.path.isfile(code_file_path):
                        with open(code_file_path, u'r') as code_file:
                            code_header_extra_lines = code_file.readlines()
    Severity: Major
    Found in tools/jsonschematoc11/jsonschematoc11.py and 5 other locations - About 5 hrs to fix
    tools/jsonschematoc11/jsonschematoc11.py on lines 153..160
    tools/jsonschematoc11/jsonschematoc11.py on lines 162..169
    tools/jsonschematoc11/jsonschematoc11.py on lines 192..199
    tools/jsonschematoc11/jsonschematoc11.py on lines 234..241
    tools/jsonschematoc11/jsonschematoc11.py on lines 246..253

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

    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 6 locations. Consider refactoring.
    Open

                if config is not None and config.has_option(u'code.headers', u'header.include'):
                    code_file_path = config.get(u'code.headers', u'header.include')
                    if os.path.isfile(code_file_path):
                        with open(code_file_path, u'r') as code_file:
                            code_header_extra_lines = code_file.readlines()
    Severity: Major
    Found in tools/jsonschematoc11/jsonschematoc11.py and 5 other locations - About 5 hrs to fix
    tools/jsonschematoc11/jsonschematoc11.py on lines 153..160
    tools/jsonschematoc11/jsonschematoc11.py on lines 192..199
    tools/jsonschematoc11/jsonschematoc11.py on lines 234..241
    tools/jsonschematoc11/jsonschematoc11.py on lines 246..253
    tools/jsonschematoc11/jsonschematoc11.py on lines 325..332

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

    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 6 locations. Consider refactoring.
    Open

                if config is not None and config.has_option(u'code.headers', u'header.namespace.end'):
                    code_file_path = config.get(u'code.headers', u'header.namespace.end')
                    if os.path.isfile(code_file_path):
                        with open(code_file_path, u'r') as code_file:
                            code_header_extra_lines = code_file.readlines()
    Severity: Major
    Found in tools/jsonschematoc11/jsonschematoc11.py and 5 other locations - About 5 hrs to fix
    tools/jsonschematoc11/jsonschematoc11.py on lines 153..160
    tools/jsonschematoc11/jsonschematoc11.py on lines 162..169
    tools/jsonschematoc11/jsonschematoc11.py on lines 192..199
    tools/jsonschematoc11/jsonschematoc11.py on lines 246..253
    tools/jsonschematoc11/jsonschematoc11.py on lines 325..332

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

    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 6 locations. Consider refactoring.
    Open

                if config is not None and config.has_option(u'code.headers', u'header.namespace.begin'):
                    code_file_path = config.get(u'code.headers', u'header.namespace.begin')
                    if os.path.isfile(code_file_path):
                        with open(code_file_path, u'r') as code_file:
                            code_header_extra_lines = code_file.readlines()
    Severity: Major
    Found in tools/jsonschematoc11/jsonschematoc11.py and 5 other locations - About 5 hrs to fix
    tools/jsonschematoc11/jsonschematoc11.py on lines 153..160
    tools/jsonschematoc11/jsonschematoc11.py on lines 162..169
    tools/jsonschematoc11/jsonschematoc11.py on lines 234..241
    tools/jsonschematoc11/jsonschematoc11.py on lines 246..253
    tools/jsonschematoc11/jsonschematoc11.py on lines 325..332

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

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

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

    Severity: Major
    Found in tools/jsonschematoc11/__main__.py and 1 other location - About 4 hrs to fix
    tools/jsonschematoc11/__init__.py on lines 0..13

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

    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

    Severity
    Category
    Status
    Source
    Language