christoph2/pyA2L

View on GitHub

Showing 238 of 238 total issues

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

        ctx.value = model.MemoryLayout(
Severity: Major
Found in pya2l/a2l_listener.py and 1 other location - About 1 hr to fix
pya2l/a2l_listener.py on lines 915..915

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

        if ctx.ts0:
            taggedstructDefinition = ctx.ts0.value
        elif ctx.ts1:
            taggedstructDefinition = ctx.ts1.value
        else:
Severity: Minor
Found in pya2l/aml/listener.py and 1 other location - About 55 mins to fix
pya2l/aml/listener.py on lines 139..144

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

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 ctx.bl0:
            blockDefinition = ctx.bl0.value
        elif ctx.bl1:
            blockDefinition = ctx.bl1.value
        else:
Severity: Minor
Found in pya2l/aml/listener.py and 1 other location - About 55 mins to fix
pya2l/aml/listener.py on lines 133..138

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

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

class CustomBuildPy(setuptools.command.build_py.build_py):
    """Extended build_py which also runs ANTLR."""

    def run(self):
        self.run_command("antlr")
Severity: Minor
Found in setup.py and 1 other location - About 55 mins to fix
setup.py on lines 93..98

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

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

class CustomDevelop(setuptools.command.develop.develop):
    """Extended develop which also runs ANTLR"""

    def run(self):
        self.run_command("antlr")
Severity: Minor
Found in setup.py and 1 other location - About 55 mins to fix
setup.py on lines 85..90

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

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 import_a2l has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def import_a2l(
Severity: Major
Found in pya2l/__init__.py - About 50 mins to fix

    Avoid deeply nested control flow statements.
    Open

                            if definition.multiple:
                                tag_dict[tag].append(value)
                            else:
                                tag_dict[tag] = value
                            self.pop_element()
    Severity: Major
    Found in pya2l/if_data_parser.py - About 45 mins to fix

      Function doTemplateFromText has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      def doTemplateFromText(
      Severity: Minor
      Found in pya2l/templates.py - About 45 mins to fix

        Function __init__ has a Cognitive Complexity of 18 (exceeds 15 allowed). Consider refactoring.
        Open

            def __init__(self, session, module_name: str = None):
                self.variantCoding = session.query(model.VariantCoding).first()
                self._naming = self.variantCoding.var_naming.tag if self.variantCoding.var_naming else "NUMERIC"
                self._separator = self.variantCoding.var_separator.separator if self.variantCoding.var_separator else "."
        
        
        Severity: Minor
        Found in pya2l/api/inspect.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

        Function syntaxError has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def syntaxError(self, recognizer, offendingSymbol, line, column, msg, e):
        Severity: Minor
        Found in pya2l/parserlib.py - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                                  if match:
                                      s, e = match.span()
                                      if_data_end = (line_num, e - len(match.group("tail")))
                                      if_data_section.append("{}/end{}IF_DATA".format(match.group("section"), match.group("s0")))
                                      section = (
          Severity: Major
          Found in pya2l/preprocessor.py - About 45 mins to fix

            Function doTemplate has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            def doTemplate(
            Severity: Minor
            Found in pya2l/templates.py - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                      if ((self.current_token.type != self.lexer.IDENT) or (self.current_token.text not in tags)) and (
                                          self.current_token.type != self.lexer.BEGIN
                                      ):
                                          break
                                  else:
              Severity: Major
              Found in pya2l/if_data_parser.py - About 45 mins to fix

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

                    def __init__(
                Severity: Minor
                Found in pya2l/parserlib.py - About 35 mins to fix

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

                      def __init__(self, session, name=None, module_name: str = None, parent=None, *args):
                  Severity: Minor
                  Found in pya2l/api/inspect.py - About 35 mins to fix

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

                        def exitSignExtend(self, ctx):
                            ctx.value = model.SignExtend()
                            self.db.session.add(ctx.value)
                    Severity: Major
                    Found in pya2l/a2l_listener.py and 4 other locations - About 35 mins to fix
                    pya2l/a2l_listener.py on lines 424..426
                    pya2l/a2l_listener.py on lines 933..935
                    pya2l/a2l_listener.py on lines 1123..1125
                    pya2l/a2l_listener.py on lines 1728..1730

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

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

                        def exitRoot(self, ctx):
                            ctx.value = model.Root()
                            self.db.session.add(ctx.value)
                    Severity: Major
                    Found in pya2l/a2l_listener.py and 4 other locations - About 35 mins to fix
                    pya2l/a2l_listener.py on lines 424..426
                    pya2l/a2l_listener.py on lines 1104..1106
                    pya2l/a2l_listener.py on lines 1123..1125
                    pya2l/a2l_listener.py on lines 1728..1730

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

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

                        def exitReadWrite(self, ctx):
                            ctx.value = model.ReadWrite()
                            self.db.session.add(ctx.value)
                    Severity: Major
                    Found in pya2l/a2l_listener.py and 4 other locations - About 35 mins to fix
                    pya2l/a2l_listener.py on lines 424..426
                    pya2l/a2l_listener.py on lines 933..935
                    pya2l/a2l_listener.py on lines 1104..1106
                    pya2l/a2l_listener.py on lines 1728..1730

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

                    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

                            ctx.value = model.Unit(
                    Severity: Minor
                    Found in pya2l/a2l_listener.py and 1 other location - About 35 mins to fix
                    pya2l/a2l_listener.py on lines 1923..1923

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

                    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

                            ctx.value = model.SiExponents(
                    Severity: Minor
                    Found in pya2l/a2l_listener.py and 1 other location - About 35 mins to fix
                    pya2l/a2l_listener.py on lines 1904..1904

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

                    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