christoph2/pyA2L

View on GitHub

Showing 238 of 238 total issues

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

    def exitNoRescale4(self, ctx):
        position = ctx.position.value
        datatype = ctx.datatype.value
        ctx.value = model.NoRescale4(position=position, datatype=datatype)
        self.db.session.add(ctx.value)
Severity: Major
Found in pya2l/a2l_listener.py and 44 other locations - About 2 hrs to fix
pya2l/a2l_listener.py on lines 246..250
pya2l/a2l_listener.py on lines 285..289
pya2l/a2l_listener.py on lines 325..329
pya2l/a2l_listener.py on lines 346..350
pya2l/a2l_listener.py on lines 712..716
pya2l/a2l_listener.py on lines 1340..1344
pya2l/a2l_listener.py on lines 1624..1628
pya2l/a2l_listener.py on lines 1630..1634
pya2l/a2l_listener.py on lines 1636..1640
pya2l/a2l_listener.py on lines 1642..1646
pya2l/a2l_listener.py on lines 1648..1652
pya2l/a2l_listener.py on lines 1692..1696
pya2l/a2l_listener.py on lines 1698..1702
pya2l/a2l_listener.py on lines 1704..1708
pya2l/a2l_listener.py on lines 1710..1714
pya2l/a2l_listener.py on lines 1716..1720
pya2l/a2l_listener.py on lines 1722..1726
pya2l/a2l_listener.py on lines 1732..1736
pya2l/a2l_listener.py on lines 1738..1742
pya2l/a2l_listener.py on lines 1744..1748
pya2l/a2l_listener.py on lines 1756..1760
pya2l/a2l_listener.py on lines 1762..1766
pya2l/a2l_listener.py on lines 1768..1772
pya2l/a2l_listener.py on lines 1774..1778
pya2l/a2l_listener.py on lines 1780..1784
pya2l/a2l_listener.py on lines 1786..1790
pya2l/a2l_listener.py on lines 1792..1796
pya2l/a2l_listener.py on lines 1798..1802
pya2l/a2l_listener.py on lines 1804..1808
pya2l/a2l_listener.py on lines 1810..1814
pya2l/a2l_listener.py on lines 1816..1820
pya2l/a2l_listener.py on lines 1822..1826
pya2l/a2l_listener.py on lines 1828..1832
pya2l/a2l_listener.py on lines 1834..1838
pya2l/a2l_listener.py on lines 1840..1844
pya2l/a2l_listener.py on lines 1846..1850
pya2l/a2l_listener.py on lines 1852..1856
pya2l/a2l_listener.py on lines 1858..1862
pya2l/a2l_listener.py on lines 1864..1868
pya2l/a2l_listener.py on lines 1870..1874
pya2l/a2l_listener.py on lines 1876..1880
pya2l/a2l_listener.py on lines 1882..1886
pya2l/a2l_listener.py on lines 1888..1892
pya2l/a2l_listener.py on lines 1934..1938

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

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

    def exitA2mlVersion(self, ctx):
        versionNo = ctx.versionNo.value
        upgradeNo = ctx.upgradeNo.value
        ctx.value = model.A2mlVersion(versionNo=versionNo, upgradeNo=upgradeNo)
        self.db.session.add(ctx.value)
Severity: Major
Found in pya2l/a2l_listener.py and 44 other locations - About 2 hrs to fix
pya2l/a2l_listener.py on lines 246..250
pya2l/a2l_listener.py on lines 285..289
pya2l/a2l_listener.py on lines 325..329
pya2l/a2l_listener.py on lines 712..716
pya2l/a2l_listener.py on lines 1340..1344
pya2l/a2l_listener.py on lines 1624..1628
pya2l/a2l_listener.py on lines 1630..1634
pya2l/a2l_listener.py on lines 1636..1640
pya2l/a2l_listener.py on lines 1642..1646
pya2l/a2l_listener.py on lines 1648..1652
pya2l/a2l_listener.py on lines 1692..1696
pya2l/a2l_listener.py on lines 1698..1702
pya2l/a2l_listener.py on lines 1704..1708
pya2l/a2l_listener.py on lines 1710..1714
pya2l/a2l_listener.py on lines 1716..1720
pya2l/a2l_listener.py on lines 1722..1726
pya2l/a2l_listener.py on lines 1732..1736
pya2l/a2l_listener.py on lines 1738..1742
pya2l/a2l_listener.py on lines 1744..1748
pya2l/a2l_listener.py on lines 1750..1754
pya2l/a2l_listener.py on lines 1756..1760
pya2l/a2l_listener.py on lines 1762..1766
pya2l/a2l_listener.py on lines 1768..1772
pya2l/a2l_listener.py on lines 1774..1778
pya2l/a2l_listener.py on lines 1780..1784
pya2l/a2l_listener.py on lines 1786..1790
pya2l/a2l_listener.py on lines 1792..1796
pya2l/a2l_listener.py on lines 1798..1802
pya2l/a2l_listener.py on lines 1804..1808
pya2l/a2l_listener.py on lines 1810..1814
pya2l/a2l_listener.py on lines 1816..1820
pya2l/a2l_listener.py on lines 1822..1826
pya2l/a2l_listener.py on lines 1828..1832
pya2l/a2l_listener.py on lines 1834..1838
pya2l/a2l_listener.py on lines 1840..1844
pya2l/a2l_listener.py on lines 1846..1850
pya2l/a2l_listener.py on lines 1852..1856
pya2l/a2l_listener.py on lines 1858..1862
pya2l/a2l_listener.py on lines 1864..1868
pya2l/a2l_listener.py on lines 1870..1874
pya2l/a2l_listener.py on lines 1876..1880
pya2l/a2l_listener.py on lines 1882..1886
pya2l/a2l_listener.py on lines 1888..1892
pya2l/a2l_listener.py on lines 1934..1938

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

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

    def exitIdentification(self, ctx):
        position = ctx.position.value
        datatype = ctx.datatype.value
        ctx.value = model.Identification(position=position, datatype=datatype)
        self.db.session.add(ctx.value)
Severity: Major
Found in pya2l/a2l_listener.py and 44 other locations - About 2 hrs to fix
pya2l/a2l_listener.py on lines 246..250
pya2l/a2l_listener.py on lines 285..289
pya2l/a2l_listener.py on lines 325..329
pya2l/a2l_listener.py on lines 346..350
pya2l/a2l_listener.py on lines 712..716
pya2l/a2l_listener.py on lines 1340..1344
pya2l/a2l_listener.py on lines 1624..1628
pya2l/a2l_listener.py on lines 1630..1634
pya2l/a2l_listener.py on lines 1636..1640
pya2l/a2l_listener.py on lines 1642..1646
pya2l/a2l_listener.py on lines 1648..1652
pya2l/a2l_listener.py on lines 1698..1702
pya2l/a2l_listener.py on lines 1704..1708
pya2l/a2l_listener.py on lines 1710..1714
pya2l/a2l_listener.py on lines 1716..1720
pya2l/a2l_listener.py on lines 1722..1726
pya2l/a2l_listener.py on lines 1732..1736
pya2l/a2l_listener.py on lines 1738..1742
pya2l/a2l_listener.py on lines 1744..1748
pya2l/a2l_listener.py on lines 1750..1754
pya2l/a2l_listener.py on lines 1756..1760
pya2l/a2l_listener.py on lines 1762..1766
pya2l/a2l_listener.py on lines 1768..1772
pya2l/a2l_listener.py on lines 1774..1778
pya2l/a2l_listener.py on lines 1780..1784
pya2l/a2l_listener.py on lines 1786..1790
pya2l/a2l_listener.py on lines 1792..1796
pya2l/a2l_listener.py on lines 1798..1802
pya2l/a2l_listener.py on lines 1804..1808
pya2l/a2l_listener.py on lines 1810..1814
pya2l/a2l_listener.py on lines 1816..1820
pya2l/a2l_listener.py on lines 1822..1826
pya2l/a2l_listener.py on lines 1828..1832
pya2l/a2l_listener.py on lines 1834..1838
pya2l/a2l_listener.py on lines 1840..1844
pya2l/a2l_listener.py on lines 1846..1850
pya2l/a2l_listener.py on lines 1852..1856
pya2l/a2l_listener.py on lines 1858..1862
pya2l/a2l_listener.py on lines 1864..1868
pya2l/a2l_listener.py on lines 1870..1874
pya2l/a2l_listener.py on lines 1876..1880
pya2l/a2l_listener.py on lines 1882..1886
pya2l/a2l_listener.py on lines 1888..1892
pya2l/a2l_listener.py on lines 1934..1938

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

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

    def exitShiftOpX(self, ctx):
        position = ctx.position.value
        datatype = ctx.datatype.value
        ctx.value = model.ShiftOpX(position=position, datatype=datatype)
        self.db.session.add(ctx.value)
Severity: Major
Found in pya2l/a2l_listener.py and 44 other locations - About 2 hrs to fix
pya2l/a2l_listener.py on lines 246..250
pya2l/a2l_listener.py on lines 285..289
pya2l/a2l_listener.py on lines 325..329
pya2l/a2l_listener.py on lines 346..350
pya2l/a2l_listener.py on lines 712..716
pya2l/a2l_listener.py on lines 1340..1344
pya2l/a2l_listener.py on lines 1624..1628
pya2l/a2l_listener.py on lines 1630..1634
pya2l/a2l_listener.py on lines 1636..1640
pya2l/a2l_listener.py on lines 1642..1646
pya2l/a2l_listener.py on lines 1648..1652
pya2l/a2l_listener.py on lines 1692..1696
pya2l/a2l_listener.py on lines 1698..1702
pya2l/a2l_listener.py on lines 1704..1708
pya2l/a2l_listener.py on lines 1710..1714
pya2l/a2l_listener.py on lines 1716..1720
pya2l/a2l_listener.py on lines 1722..1726
pya2l/a2l_listener.py on lines 1732..1736
pya2l/a2l_listener.py on lines 1738..1742
pya2l/a2l_listener.py on lines 1744..1748
pya2l/a2l_listener.py on lines 1750..1754
pya2l/a2l_listener.py on lines 1756..1760
pya2l/a2l_listener.py on lines 1762..1766
pya2l/a2l_listener.py on lines 1768..1772
pya2l/a2l_listener.py on lines 1774..1778
pya2l/a2l_listener.py on lines 1780..1784
pya2l/a2l_listener.py on lines 1786..1790
pya2l/a2l_listener.py on lines 1792..1796
pya2l/a2l_listener.py on lines 1798..1802
pya2l/a2l_listener.py on lines 1804..1808
pya2l/a2l_listener.py on lines 1810..1814
pya2l/a2l_listener.py on lines 1816..1820
pya2l/a2l_listener.py on lines 1822..1826
pya2l/a2l_listener.py on lines 1828..1832
pya2l/a2l_listener.py on lines 1840..1844
pya2l/a2l_listener.py on lines 1846..1850
pya2l/a2l_listener.py on lines 1852..1856
pya2l/a2l_listener.py on lines 1858..1862
pya2l/a2l_listener.py on lines 1864..1868
pya2l/a2l_listener.py on lines 1870..1874
pya2l/a2l_listener.py on lines 1876..1880
pya2l/a2l_listener.py on lines 1882..1886
pya2l/a2l_listener.py on lines 1888..1892
pya2l/a2l_listener.py on lines 1934..1938

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

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

    def exitExtendedLimits(self, ctx):
        lowerLimit = ctx.lowerLimit.value
        upperLimit = ctx.upperLimit.value
        ctx.value = model.ExtendedLimits(lowerLimit=lowerLimit, upperLimit=upperLimit)
        self.db.session.add(ctx.value)
Severity: Major
Found in pya2l/a2l_listener.py and 44 other locations - About 2 hrs to fix
pya2l/a2l_listener.py on lines 285..289
pya2l/a2l_listener.py on lines 325..329
pya2l/a2l_listener.py on lines 346..350
pya2l/a2l_listener.py on lines 712..716
pya2l/a2l_listener.py on lines 1340..1344
pya2l/a2l_listener.py on lines 1624..1628
pya2l/a2l_listener.py on lines 1630..1634
pya2l/a2l_listener.py on lines 1636..1640
pya2l/a2l_listener.py on lines 1642..1646
pya2l/a2l_listener.py on lines 1648..1652
pya2l/a2l_listener.py on lines 1692..1696
pya2l/a2l_listener.py on lines 1698..1702
pya2l/a2l_listener.py on lines 1704..1708
pya2l/a2l_listener.py on lines 1710..1714
pya2l/a2l_listener.py on lines 1716..1720
pya2l/a2l_listener.py on lines 1722..1726
pya2l/a2l_listener.py on lines 1732..1736
pya2l/a2l_listener.py on lines 1738..1742
pya2l/a2l_listener.py on lines 1744..1748
pya2l/a2l_listener.py on lines 1750..1754
pya2l/a2l_listener.py on lines 1756..1760
pya2l/a2l_listener.py on lines 1762..1766
pya2l/a2l_listener.py on lines 1768..1772
pya2l/a2l_listener.py on lines 1774..1778
pya2l/a2l_listener.py on lines 1780..1784
pya2l/a2l_listener.py on lines 1786..1790
pya2l/a2l_listener.py on lines 1792..1796
pya2l/a2l_listener.py on lines 1798..1802
pya2l/a2l_listener.py on lines 1804..1808
pya2l/a2l_listener.py on lines 1810..1814
pya2l/a2l_listener.py on lines 1816..1820
pya2l/a2l_listener.py on lines 1822..1826
pya2l/a2l_listener.py on lines 1828..1832
pya2l/a2l_listener.py on lines 1834..1838
pya2l/a2l_listener.py on lines 1840..1844
pya2l/a2l_listener.py on lines 1846..1850
pya2l/a2l_listener.py on lines 1852..1856
pya2l/a2l_listener.py on lines 1858..1862
pya2l/a2l_listener.py on lines 1864..1868
pya2l/a2l_listener.py on lines 1870..1874
pya2l/a2l_listener.py on lines 1876..1880
pya2l/a2l_listener.py on lines 1882..1886
pya2l/a2l_listener.py on lines 1888..1892
pya2l/a2l_listener.py on lines 1934..1938

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

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

    def exitRipAddrY(self, ctx):
        position = ctx.position.value
        datatype = ctx.datatype.value
        ctx.value = model.RipAddrY(position=position, datatype=datatype)
        self.db.session.add(ctx.value)
Severity: Major
Found in pya2l/a2l_listener.py and 44 other locations - About 2 hrs to fix
pya2l/a2l_listener.py on lines 246..250
pya2l/a2l_listener.py on lines 285..289
pya2l/a2l_listener.py on lines 325..329
pya2l/a2l_listener.py on lines 346..350
pya2l/a2l_listener.py on lines 712..716
pya2l/a2l_listener.py on lines 1340..1344
pya2l/a2l_listener.py on lines 1624..1628
pya2l/a2l_listener.py on lines 1630..1634
pya2l/a2l_listener.py on lines 1636..1640
pya2l/a2l_listener.py on lines 1642..1646
pya2l/a2l_listener.py on lines 1648..1652
pya2l/a2l_listener.py on lines 1692..1696
pya2l/a2l_listener.py on lines 1698..1702
pya2l/a2l_listener.py on lines 1704..1708
pya2l/a2l_listener.py on lines 1710..1714
pya2l/a2l_listener.py on lines 1716..1720
pya2l/a2l_listener.py on lines 1722..1726
pya2l/a2l_listener.py on lines 1732..1736
pya2l/a2l_listener.py on lines 1738..1742
pya2l/a2l_listener.py on lines 1744..1748
pya2l/a2l_listener.py on lines 1750..1754
pya2l/a2l_listener.py on lines 1756..1760
pya2l/a2l_listener.py on lines 1762..1766
pya2l/a2l_listener.py on lines 1768..1772
pya2l/a2l_listener.py on lines 1774..1778
pya2l/a2l_listener.py on lines 1780..1784
pya2l/a2l_listener.py on lines 1786..1790
pya2l/a2l_listener.py on lines 1792..1796
pya2l/a2l_listener.py on lines 1798..1802
pya2l/a2l_listener.py on lines 1804..1808
pya2l/a2l_listener.py on lines 1816..1820
pya2l/a2l_listener.py on lines 1822..1826
pya2l/a2l_listener.py on lines 1828..1832
pya2l/a2l_listener.py on lines 1834..1838
pya2l/a2l_listener.py on lines 1840..1844
pya2l/a2l_listener.py on lines 1846..1850
pya2l/a2l_listener.py on lines 1852..1856
pya2l/a2l_listener.py on lines 1858..1862
pya2l/a2l_listener.py on lines 1864..1868
pya2l/a2l_listener.py on lines 1870..1874
pya2l/a2l_listener.py on lines 1876..1880
pya2l/a2l_listener.py on lines 1882..1886
pya2l/a2l_listener.py on lines 1888..1892
pya2l/a2l_listener.py on lines 1934..1938

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

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

    def exitShiftOp5(self, ctx):
        position = ctx.position.value
        datatype = ctx.datatype.value
        ctx.value = model.ShiftOp5(position=position, datatype=datatype)
        self.db.session.add(ctx.value)
Severity: Major
Found in pya2l/a2l_listener.py and 44 other locations - About 2 hrs to fix
pya2l/a2l_listener.py on lines 246..250
pya2l/a2l_listener.py on lines 285..289
pya2l/a2l_listener.py on lines 325..329
pya2l/a2l_listener.py on lines 346..350
pya2l/a2l_listener.py on lines 712..716
pya2l/a2l_listener.py on lines 1340..1344
pya2l/a2l_listener.py on lines 1624..1628
pya2l/a2l_listener.py on lines 1630..1634
pya2l/a2l_listener.py on lines 1636..1640
pya2l/a2l_listener.py on lines 1642..1646
pya2l/a2l_listener.py on lines 1648..1652
pya2l/a2l_listener.py on lines 1692..1696
pya2l/a2l_listener.py on lines 1698..1702
pya2l/a2l_listener.py on lines 1704..1708
pya2l/a2l_listener.py on lines 1710..1714
pya2l/a2l_listener.py on lines 1716..1720
pya2l/a2l_listener.py on lines 1722..1726
pya2l/a2l_listener.py on lines 1732..1736
pya2l/a2l_listener.py on lines 1738..1742
pya2l/a2l_listener.py on lines 1744..1748
pya2l/a2l_listener.py on lines 1750..1754
pya2l/a2l_listener.py on lines 1756..1760
pya2l/a2l_listener.py on lines 1762..1766
pya2l/a2l_listener.py on lines 1768..1772
pya2l/a2l_listener.py on lines 1774..1778
pya2l/a2l_listener.py on lines 1780..1784
pya2l/a2l_listener.py on lines 1786..1790
pya2l/a2l_listener.py on lines 1792..1796
pya2l/a2l_listener.py on lines 1798..1802
pya2l/a2l_listener.py on lines 1804..1808
pya2l/a2l_listener.py on lines 1810..1814
pya2l/a2l_listener.py on lines 1816..1820
pya2l/a2l_listener.py on lines 1822..1826
pya2l/a2l_listener.py on lines 1828..1832
pya2l/a2l_listener.py on lines 1834..1838
pya2l/a2l_listener.py on lines 1840..1844
pya2l/a2l_listener.py on lines 1846..1850
pya2l/a2l_listener.py on lines 1852..1856
pya2l/a2l_listener.py on lines 1864..1868
pya2l/a2l_listener.py on lines 1870..1874
pya2l/a2l_listener.py on lines 1876..1880
pya2l/a2l_listener.py on lines 1882..1886
pya2l/a2l_listener.py on lines 1888..1892
pya2l/a2l_listener.py on lines 1934..1938

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

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

    def exitSrcAddrY(self, ctx):
        position = ctx.position.value
        datatype = ctx.datatype.value
        ctx.value = model.SrcAddrY(position=position, datatype=datatype)
        self.db.session.add(ctx.value)
Severity: Major
Found in pya2l/a2l_listener.py and 44 other locations - About 2 hrs to fix
pya2l/a2l_listener.py on lines 246..250
pya2l/a2l_listener.py on lines 285..289
pya2l/a2l_listener.py on lines 325..329
pya2l/a2l_listener.py on lines 346..350
pya2l/a2l_listener.py on lines 712..716
pya2l/a2l_listener.py on lines 1340..1344
pya2l/a2l_listener.py on lines 1624..1628
pya2l/a2l_listener.py on lines 1630..1634
pya2l/a2l_listener.py on lines 1636..1640
pya2l/a2l_listener.py on lines 1642..1646
pya2l/a2l_listener.py on lines 1648..1652
pya2l/a2l_listener.py on lines 1692..1696
pya2l/a2l_listener.py on lines 1698..1702
pya2l/a2l_listener.py on lines 1704..1708
pya2l/a2l_listener.py on lines 1710..1714
pya2l/a2l_listener.py on lines 1716..1720
pya2l/a2l_listener.py on lines 1722..1726
pya2l/a2l_listener.py on lines 1732..1736
pya2l/a2l_listener.py on lines 1738..1742
pya2l/a2l_listener.py on lines 1744..1748
pya2l/a2l_listener.py on lines 1750..1754
pya2l/a2l_listener.py on lines 1756..1760
pya2l/a2l_listener.py on lines 1762..1766
pya2l/a2l_listener.py on lines 1768..1772
pya2l/a2l_listener.py on lines 1774..1778
pya2l/a2l_listener.py on lines 1780..1784
pya2l/a2l_listener.py on lines 1786..1790
pya2l/a2l_listener.py on lines 1792..1796
pya2l/a2l_listener.py on lines 1798..1802
pya2l/a2l_listener.py on lines 1804..1808
pya2l/a2l_listener.py on lines 1810..1814
pya2l/a2l_listener.py on lines 1816..1820
pya2l/a2l_listener.py on lines 1822..1826
pya2l/a2l_listener.py on lines 1828..1832
pya2l/a2l_listener.py on lines 1834..1838
pya2l/a2l_listener.py on lines 1840..1844
pya2l/a2l_listener.py on lines 1846..1850
pya2l/a2l_listener.py on lines 1852..1856
pya2l/a2l_listener.py on lines 1858..1862
pya2l/a2l_listener.py on lines 1864..1868
pya2l/a2l_listener.py on lines 1876..1880
pya2l/a2l_listener.py on lines 1882..1886
pya2l/a2l_listener.py on lines 1888..1892
pya2l/a2l_listener.py on lines 1934..1938

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

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

Cyclomatic complexity is too high in method __init__. (11)
Open

    def __init__(self, session, name: str, module_name: str = None):
        self.layout = session.query(model.RecordLayout).filter(model.RecordLayout.name == name).first()
        if self.layout is None:
            print("RECORD_LAYOUT '{}' not found".format(name))
        self._mod_common = ModCommon.get(session)
Severity: Minor
Found in pya2l/api/inspect.py by radon

Cyclomatic Complexity

Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

Construct Effect on CC Reasoning
if +1 An if statement is a single decision.
elif +1 The elif statement adds another decision.
else +0 The else statement does not cause a new decision. The decision is at the if.
for +1 There is a decision at the start of the loop.
while +1 There is a decision at the while statement.
except +1 Each except branch adds a new conditional path of execution.
finally +0 The finally block is unconditionally executed.
with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
assert +1 The assert statement internally roughly equals a conditional statement.
Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

Source: http://radon.readthedocs.org/en/latest/intro.html

Cyclomatic complexity is too high in function detect_encoding. (10)
Open

def detect_encoding(file_name: str = None, text: str = None) -> str:
    """Detect encoding of a text file.

    Parameters
    ----------
Severity: Minor
Found in pya2l/utils.py by radon

Cyclomatic Complexity

Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

Construct Effect on CC Reasoning
if +1 An if statement is a single decision.
elif +1 The elif statement adds another decision.
else +0 The else statement does not cause a new decision. The decision is at the if.
for +1 There is a decision at the start of the loop.
while +1 There is a decision at the while statement.
except +1 Each except branch adds a new conditional path of execution.
finally +0 The finally block is unconditionally executed.
with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
assert +1 The assert statement internally roughly equals a conditional statement.
Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

Source: http://radon.readthedocs.org/en/latest/intro.html

Cyclomatic complexity is too high in method __init__. (10)
Open

    def __init__(self, session, name: str, module_name: str = None):
        self.axis = session.query(model.AxisPts).filter(model.AxisPts.name == name).first()
        self.name = name
        self.longIdentifier = self.axis.longIdentifier
        self.address = self.axis.address
Severity: Minor
Found in pya2l/api/inspect.py by radon

Cyclomatic Complexity

Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

Construct Effect on CC Reasoning
if +1 An if statement is a single decision.
elif +1 The elif statement adds another decision.
else +0 The else statement does not cause a new decision. The decision is at the if.
for +1 There is a decision at the start of the loop.
while +1 There is a decision at the while statement.
except +1 Each except branch adds a new conditional path of execution.
finally +0 The finally block is unconditionally executed.
with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
assert +1 The assert statement internally roughly equals a conditional statement.
Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

Source: http://radon.readthedocs.org/en/latest/intro.html

Cyclomatic complexity is too high in function findAntlr. (9)
Open

def findAntlr():
    """Try to find the ANTLR .jar-file."""
    if os.environ.get("APPVEYOR"):
        classpath = r"antlr-{}-complete.jar".format(ANTLR_VERSION)
    else:
Severity: Minor
Found in build.py by radon

Cyclomatic Complexity

Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

Construct Effect on CC Reasoning
if +1 An if statement is a single decision.
elif +1 The elif statement adds another decision.
else +0 The else statement does not cause a new decision. The decision is at the if.
for +1 There is a decision at the start of the loop.
while +1 There is a decision at the while statement.
except +1 Each except branch adds a new conditional path of execution.
finally +0 The finally block is unconditionally executed.
with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
assert +1 The assert statement internally roughly equals a conditional statement.
Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

Source: http://radon.readthedocs.org/en/latest/intro.html

Cyclomatic complexity is too high in method import_a2l. (8)
Open

    def import_a2l(
        self,
        file_name,
        debug=False,
        in_memory=False,
Severity: Minor
Found in pya2l/__init__.py by radon

Cyclomatic Complexity

Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

Construct Effect on CC Reasoning
if +1 An if statement is a single decision.
elif +1 The elif statement adds another decision.
else +0 The else statement does not cause a new decision. The decision is at the if.
for +1 There is a decision at the start of the loop.
while +1 There is a decision at the while statement.
except +1 Each except branch adds a new conditional path of execution.
finally +0 The finally block is unconditionally executed.
with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
assert +1 The assert statement internally roughly equals a conditional statement.
Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

Source: http://radon.readthedocs.org/en/latest/intro.html

Cyclomatic complexity is too high in class CompuMethod. (8)
Open

class CompuMethod(CachedBase):
    """"""

    __slots__ = (
        "compu_method",
Severity: Minor
Found in pya2l/api/inspect.py by radon

Cyclomatic Complexity

Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

Construct Effect on CC Reasoning
if +1 An if statement is a single decision.
elif +1 The elif statement adds another decision.
else +0 The else statement does not cause a new decision. The decision is at the if.
for +1 There is a decision at the start of the loop.
while +1 There is a decision at the while statement.
except +1 Each except branch adds a new conditional path of execution.
finally +0 The finally block is unconditionally executed.
with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
assert +1 The assert statement internally roughly equals a conditional statement.
Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

Source: http://radon.readthedocs.org/en/latest/intro.html

Cyclomatic complexity is too high in method _process_aml. (8)
Open

    def _process_aml(self, data):
        """Extract A2ML and IF_DATA sections."""
        result = []
        sections = []
        aml_section = []
Severity: Minor
Found in pya2l/preprocessor.py by radon

Cyclomatic Complexity

Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

Construct Effect on CC Reasoning
if +1 An if statement is a single decision.
elif +1 The elif statement adds another decision.
else +0 The else statement does not cause a new decision. The decision is at the if.
for +1 There is a decision at the start of the loop.
while +1 There is a decision at the while statement.
except +1 Each except branch adds a new conditional path of execution.
finally +0 The finally block is unconditionally executed.
with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
assert +1 The assert statement internally roughly equals a conditional statement.
Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

Source: http://radon.readthedocs.org/en/latest/intro.html

Cyclomatic complexity is too high in method __init__. (8)
Open

    def __init__(self, mapping, default=None, dtype=int):
        if not (dtype is int or dtype is float):
            raise ValueError("dtype must be either int or float")
        mapping = ((dtype(item[0]), dtype(item[1]), item[2]) for item in mapping)
        self.mapping = sorted(mapping, key=itemgetter(0))
Severity: Minor
Found in pya2l/functions.py by radon

Cyclomatic Complexity

Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

Construct Effect on CC Reasoning
if +1 An if statement is a single decision.
elif +1 The elif statement adds another decision.
else +0 The else statement does not cause a new decision. The decision is at the if.
for +1 There is a decision at the start of the loop.
while +1 There is a decision at the while statement.
except +1 Each except branch adds a new conditional path of execution.
finally +0 The finally block is unconditionally executed.
with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
assert +1 The assert statement internally roughly equals a conditional statement.
Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

Source: http://radon.readthedocs.org/en/latest/intro.html

Cyclomatic complexity is too high in method exitType_name. (8)
Open

    def exitType_name(self, ctx):
        if ctx.pr:
            tp = ctx.pr.value  # Predefined type.
        elif ctx.st:
            tp = ctx.st.value  # Struct.
Severity: Minor
Found in pya2l/aml/listener.py by radon

Cyclomatic Complexity

Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

Construct Effect on CC Reasoning
if +1 An if statement is a single decision.
elif +1 The elif statement adds another decision.
else +0 The else statement does not cause a new decision. The decision is at the if.
for +1 There is a decision at the start of the loop.
while +1 There is a decision at the while statement.
except +1 Each except branch adds a new conditional path of execution.
finally +0 The finally block is unconditionally executed.
with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
assert +1 The assert statement internally roughly equals a conditional statement.
Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

Source: http://radon.readthedocs.org/en/latest/intro.html

Cyclomatic complexity is too high in method type_name. (8)
Open

    def type_name(self, tree):
        if tree:
            tp = None
            if isinstance(tree.type_, classes.PredefinedType):
                tp = self.predefined_type(tree.type_)
Severity: Minor
Found in pya2l/aml/db.py by radon

Cyclomatic Complexity

Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

Construct Effect on CC Reasoning
if +1 An if statement is a single decision.
elif +1 The elif statement adds another decision.
else +0 The else statement does not cause a new decision. The decision is at the if.
for +1 There is a decision at the start of the loop.
while +1 There is a decision at the while statement.
except +1 Each except branch adds a new conditional path of execution.
finally +0 The finally block is unconditionally executed.
with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
assert +1 The assert statement internally roughly equals a conditional statement.
Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

Source: http://radon.readthedocs.org/en/latest/intro.html

Cyclomatic complexity is too high in method struct. (8)
Open

    def struct(self):
        self.enter("struct")
        members = self.current_element.members
        # name = self.current_element.name
        # print("struct: ", name)
Severity: Minor
Found in pya2l/if_data_parser.py by radon

Cyclomatic Complexity

Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

Construct Effect on CC Reasoning
if +1 An if statement is a single decision.
elif +1 The elif statement adds another decision.
else +0 The else statement does not cause a new decision. The decision is at the if.
for +1 There is a decision at the start of the loop.
while +1 There is a decision at the while statement.
except +1 Each except branch adds a new conditional path of execution.
finally +0 The finally block is unconditionally executed.
with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
assert +1 The assert statement internally roughly equals a conditional statement.
Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

Source: http://radon.readthedocs.org/en/latest/intro.html

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

        for inVal, outVal in pairs:
            pair = model.CompuVtabPair(inVal=inVal, outVal=outVal)
            self.db.session.add(pair)
            ctx.value.pairs.append(pair)
Severity: Major
Found in pya2l/a2l_listener.py and 2 other locations - About 2 hrs to fix
pya2l/a2l_listener.py on lines 761..764
pya2l/a2l_listener.py on lines 2023..2026

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

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