pointhi/kicad-footprint-generator

View on GitHub

Showing 257 of 257 total issues

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

            reference_nodes = list(filter(lambda node: node.type == 'reference', grouped_nodes['Text']))
Severity: Minor
Found in KicadModTree/KicadFileHandler.py and 1 other location - About 40 mins to fix
KicadModTree/KicadFileHandler.py on lines 130..130

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

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

            value_nodes = list(filter(lambda node: node.type == 'value', grouped_nodes['Text']))
Severity: Minor
Found in KicadModTree/KicadFileHandler.py and 1 other location - About 40 mins to fix
KicadModTree/KicadFileHandler.py on lines 124..124

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

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 _initPasteForAvoidingVias has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def _initPasteForAvoidingVias(self, **kwargs):
        self.via_clarance = kwargs.get('via_paste_clarance', 0.05)

        # check get against none to allow the caller to use None as the sign to ignore these.
        if kwargs.get('paste_between_vias') is not None\
Severity: Minor
Found in KicadModTree/nodes/specialized/ExposedPad.py - About 35 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

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

        if not self.kicad4_compatible:
            pad_side.chamferAvoidCircle(
                    center=self.top_left_via, diameter=self.via_drill,
                    clearance=self.via_clarance)
Severity: Minor
Found in KicadModTree/nodes/specialized/ExposedPad.py and 2 other locations - About 35 mins to fix
KicadModTree/nodes/specialized/ExposedPad.py on lines 361..364
KicadModTree/nodes/specialized/ExposedPad.py on lines 407..410

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

Function _compareAngles has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def _compareAngles(self, a1, a2, tolerance=1e-7):
        r""" compare which of the two angles given in the local coordinate system

        :params:
            * *a1* (``float``)
Severity: Minor
Found in KicadModTree/util/geometric_util.py - About 35 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

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

        if not self.kicad4_compatible:
            pad_side.chamferAvoidCircle(
                    center=self.top_left_via, diameter=self.via_drill,
                    clearance=self.via_clarance)
Severity: Minor
Found in KicadModTree/nodes/specialized/ExposedPad.py and 2 other locations - About 35 mins to fix
KicadModTree/nodes/specialized/ExposedPad.py on lines 407..410
KicadModTree/nodes/specialized/ExposedPad.py on lines 455..458

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

Function __init__ has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def __init__(self, **kwargs):
        if 'geometry' in kwargs:
            geometry = kwargs['geometry']
            self.center_pos = Vector2D(geometry.center_pos)
            self.start_pos = Vector2D(geometry.start_pos)
Severity: Minor
Found in KicadModTree/util/geometric_util.py - About 35 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

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

        x = self.top_left_via[0]-self.ring_size[0]/2
Severity: Major
Found in KicadModTree/nodes/specialized/ExposedPad.py and 3 other locations - About 35 mins to fix
KicadModTree/nodes/specialized/ExposedPad.py on lines 394..394
KicadModTree/nodes/specialized/ExposedPad.py on lines 434..434
KicadModTree/nodes/specialized/ExposedPad.py on lines 435..435

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

        y = self.top_left_via[1]-self.ring_size[1]/2
Severity: Major
Found in KicadModTree/nodes/specialized/ExposedPad.py and 3 other locations - About 35 mins to fix
KicadModTree/nodes/specialized/ExposedPad.py on lines 347..347
KicadModTree/nodes/specialized/ExposedPad.py on lines 434..434
KicadModTree/nodes/specialized/ExposedPad.py on lines 435..435

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

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

        if not self.kicad4_compatible:
            pad_side.chamferAvoidCircle(
                    center=self.top_left_via, diameter=self.via_drill,
                    clearance=self.via_clarance)
Severity: Minor
Found in KicadModTree/nodes/specialized/ExposedPad.py and 2 other locations - About 35 mins to fix
KicadModTree/nodes/specialized/ExposedPad.py on lines 361..364
KicadModTree/nodes/specialized/ExposedPad.py on lines 455..458

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

Function extend has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def extend(self, nodes):
        '''
        add list of nodes to child
        '''
        new_nodes = []
Severity: Minor
Found in KicadModTree/nodes/Node.py - About 35 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

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

        top = self.top_left_via[1]-self.ring_size[1]/2
Severity: Major
Found in KicadModTree/nodes/specialized/ExposedPad.py and 3 other locations - About 35 mins to fix
KicadModTree/nodes/specialized/ExposedPad.py on lines 347..347
KicadModTree/nodes/specialized/ExposedPad.py on lines 394..394
KicadModTree/nodes/specialized/ExposedPad.py on lines 434..434

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

Function _generateCopperPads has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def _generateCopperPads(self):
        # kicad_mod.append(c)
        layers = ['F.Cu']
        if self.num_paste_zones == 1:
            if self.solder_paste_margin == 0:
Severity: Minor
Found in KicadModTree/nodes/specialized/RingPad.py - About 35 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

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

        left = self.top_left_via[0]-self.ring_size[0]/2
Severity: Major
Found in KicadModTree/nodes/specialized/ExposedPad.py and 3 other locations - About 35 mins to fix
KicadModTree/nodes/specialized/ExposedPad.py on lines 347..347
KicadModTree/nodes/specialized/ExposedPad.py on lines 394..394
KicadModTree/nodes/specialized/ExposedPad.py on lines 435..435

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

Avoid too many return statements within this function.
Open

        return True
Severity: Major
Found in KicadModTree/nodes/base/Pad.py - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

                return "some string"
    Severity: Major
    Found in KicadModTree/ModArgparser.py - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

              return CornerSelection.__getitem__(self, item)
      Severity: Major
      Found in KicadModTree/nodes/specialized/ChamferedPadGrid.py - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                    return "??"
        Severity: Major
        Found in KicadModTree/ModArgparser.py - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                  return self.radius_ratio
          Severity: Major
          Found in KicadModTree/nodes/base/Pad.py - About 30 mins to fix

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

                def getRoundRadius(self):
                    if self.shape == Pad.SHAPE_CUSTOM:
                        r_max = 0
                        for p in self.primitives:
                            r = p.width/2
            Severity: Minor
            Found in KicadModTree/nodes/base/Pad.py - About 25 mins to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

            Severity
            Category
            Status
            Source
            Language