gszathmari/munchkin

View on GitHub

Showing 22 of 22 total issues

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

    for j in range(midheight, height+1):
        line = []
        for j in range(width):
            # Even columns
            if j % 2 == 0:
Severity: Major
Found in munchkin/lib/passwordcard/passwordcard.py and 1 other location - About 1 day to fix
munchkin/lib/passwordcard/passwordcard.py on lines 80..89

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

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

    for i in range(1, midheight):
        line = []
        for j in range(width):
            # Even columns
            if j % 2 == 0:
Severity: Major
Found in munchkin/lib/passwordcard/passwordcard.py and 1 other location - About 1 day to fix
munchkin/lib/passwordcard/passwordcard.py on lines 90..99

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

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

    elif not symbols and digits:
        characters['top_odd'] = list(CHARSETS['original.alphanumeric'])
        characters['top_even'] = list(CHARSETS['original.alphanumeric'])
        characters['bottom_odd'] = list(CHARSETS['original.digits'])
        characters['bottom_even'] = list(CHARSETS['original.digits'])
Severity: Major
Found in munchkin/lib/passwordcard/passwordcard.py and 3 other locations - About 4 hrs to fix
munchkin/lib/passwordcard/passwordcard.py on lines 40..44
munchkin/lib/passwordcard/passwordcard.py on lines 45..49
munchkin/lib/passwordcard/passwordcard.py on lines 55..59

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

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

    elif not symbols and not digits:
        characters['top_odd'] = list(CHARSETS['original.alphanumeric'])
        characters['top_even'] = list(CHARSETS['original.alphanumeric'])
        characters['bottom_odd'] = list(CHARSETS['original.alphanumeric'])
        characters['bottom_even'] = list(CHARSETS['original.alphanumeric'])
Severity: Major
Found in munchkin/lib/passwordcard/passwordcard.py and 3 other locations - About 4 hrs to fix
munchkin/lib/passwordcard/passwordcard.py on lines 40..44
munchkin/lib/passwordcard/passwordcard.py on lines 45..49
munchkin/lib/passwordcard/passwordcard.py on lines 50..54

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

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

    elif symbols and digits:
        characters['top_odd'] = list(CHARSETS['original.alphanumeric'])
        characters['top_even'] = list(CHARSETS['original.alphanumeric_with_symbols'])
        characters['bottom_odd'] = list(CHARSETS['original.digits'])
        characters['bottom_even'] = list(CHARSETS['original.digits'])
Severity: Major
Found in munchkin/lib/passwordcard/passwordcard.py and 3 other locations - About 4 hrs to fix
munchkin/lib/passwordcard/passwordcard.py on lines 40..44
munchkin/lib/passwordcard/passwordcard.py on lines 50..54
munchkin/lib/passwordcard/passwordcard.py on lines 55..59

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

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

    if symbols and not digits:
        characters['top_odd'] = list(CHARSETS['original.alphanumeric'])
        characters['top_even'] = list(CHARSETS['original.alphanumeric_with_symbols'])
        characters['bottom_odd'] = list(CHARSETS['original.alphanumeric'])
        characters['bottom_even'] = list(CHARSETS['original.alphanumeric_with_symbols'])
Severity: Major
Found in munchkin/lib/passwordcard/passwordcard.py and 3 other locations - About 4 hrs to fix
munchkin/lib/passwordcard/passwordcard.py on lines 45..49
munchkin/lib/passwordcard/passwordcard.py on lines 50..54
munchkin/lib/passwordcard/passwordcard.py on lines 55..59

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

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

def generate_spiral_stream(card, posX, posY):
    """Generate spiral from a selected location on the card"""
    x = y = 0
    dx, dy = 0, -1
    data = []
Severity: Minor
Found in munchkin/core/strategies/spiral.py - About 2 hrs to fix

Cognitive Complexity

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

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

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

Further reading

Function _generate_data_streams has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    def _generate_data_streams(self):
        """ Adds appropriate character streams based on the selected card reading strategies """
        # Create object to hold results
        streams = {
            'default': []
Severity: Minor
Found in munchkin/core/card.py - About 2 hrs to fix

Cognitive Complexity

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

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

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

Further reading

Consider simplifying this complex logical expression.
Open

    if (args.left_to_right or
        args.right_to_left or
        args.top_down or
        args.bottom_up or
        args.zig_zag or
Severity: Critical
Found in munchkin/munchkin.py - About 2 hrs to fix

    Function generate_card has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

    def generate_card(seed, width=29, height=8, symbols=False, digits=False):
        characters = generate_character_sets(symbols, digits)
    
        seed = int("0x%s" % seed, 16)
    
    
    Severity: Minor
    Found in munchkin/lib/passwordcard/passwordcard.py - About 1 hr 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 menu has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    def menu():
        """ Contains input arguments and launches controller """
        version_info = Fore.CYAN + "Munchkin wordlist generator version {0} by {1} {2}".format(__version__, __author__, __website__)
    
        parser = argparse.ArgumentParser()
    Severity: Minor
    Found in munchkin/munchkin.py - About 1 hr to fix

      Function _passwords_generator has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          def _passwords_generator(streams, pwlen):
              """ Generator that dumps the passwords for each card read strategy """
              # Iterate through streams (strategies)
              for stream in streams['default']:
                  counter = 0
      Severity: Minor
      Found in munchkin/core/card.py - About 55 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 7 locations. Consider refactoring.
      Open

              if self._args.get('left_to_right'):
                  #results = strategies.left_to_right(self.m)
                  results = left_to_right(self)
                  streams['default'].append(results)
      Severity: Major
      Found in munchkin/core/card.py and 6 other locations - About 50 mins to fix
      munchkin/core/card.py on lines 57..59
      munchkin/core/card.py on lines 60..62
      munchkin/core/card.py on lines 63..65
      munchkin/core/card.py on lines 66..68
      munchkin/core/card.py on lines 69..71
      munchkin/core/card.py on lines 72..74

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

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

              if self._args.get('zig_zag'):
                  results = zig_zag(self)
                  streams['default'].append(results)
      Severity: Major
      Found in munchkin/core/card.py and 6 other locations - About 50 mins to fix
      munchkin/core/card.py on lines 53..56
      munchkin/core/card.py on lines 57..59
      munchkin/core/card.py on lines 60..62
      munchkin/core/card.py on lines 63..65
      munchkin/core/card.py on lines 69..71
      munchkin/core/card.py on lines 72..74

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

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

              if self._args.get('diagonal'):
                  results = diagonal(self)
                  streams['default'].append(results)
      Severity: Major
      Found in munchkin/core/card.py and 6 other locations - About 50 mins to fix
      munchkin/core/card.py on lines 53..56
      munchkin/core/card.py on lines 57..59
      munchkin/core/card.py on lines 60..62
      munchkin/core/card.py on lines 63..65
      munchkin/core/card.py on lines 66..68
      munchkin/core/card.py on lines 69..71

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

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

              if self._args.get('right_to_left'):
                  results = right_to_left(self)
                  streams['default'].append(results)
      Severity: Major
      Found in munchkin/core/card.py and 6 other locations - About 50 mins to fix
      munchkin/core/card.py on lines 53..56
      munchkin/core/card.py on lines 60..62
      munchkin/core/card.py on lines 63..65
      munchkin/core/card.py on lines 66..68
      munchkin/core/card.py on lines 69..71
      munchkin/core/card.py on lines 72..74

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

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

              if self._args.get('bottom_up'):
                  results = bottom_to_top(self)
                  streams['default'].append(results)
      Severity: Major
      Found in munchkin/core/card.py and 6 other locations - About 50 mins to fix
      munchkin/core/card.py on lines 53..56
      munchkin/core/card.py on lines 57..59
      munchkin/core/card.py on lines 60..62
      munchkin/core/card.py on lines 66..68
      munchkin/core/card.py on lines 69..71
      munchkin/core/card.py on lines 72..74

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

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

              if self._args.get('zig_zag_rev'):
                  results = zig_zag_reverse(self)
                  streams['default'].append(results)
      Severity: Major
      Found in munchkin/core/card.py and 6 other locations - About 50 mins to fix
      munchkin/core/card.py on lines 53..56
      munchkin/core/card.py on lines 57..59
      munchkin/core/card.py on lines 60..62
      munchkin/core/card.py on lines 63..65
      munchkin/core/card.py on lines 66..68
      munchkin/core/card.py on lines 72..74

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

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

              if self._args.get('top_down'):
                  results = top_to_down(self)
                  streams['default'].append(results)
      Severity: Major
      Found in munchkin/core/card.py and 6 other locations - About 50 mins to fix
      munchkin/core/card.py on lines 53..56
      munchkin/core/card.py on lines 57..59
      munchkin/core/card.py on lines 63..65
      munchkin/core/card.py on lines 66..68
      munchkin/core/card.py on lines 69..71
      munchkin/core/card.py on lines 72..74

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

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

      def generate_card(seed, width=29, height=8, symbols=False, digits=False):
      Severity: Minor
      Found in munchkin/lib/passwordcard/passwordcard.py - About 35 mins to fix
        Severity
        Category
        Status
        Source
        Language