nvbn/thefuck

View on GitHub

Showing 49 of 106 total issues

Generic has 23 functions (exceeds 20 allowed). Consider refactoring.
Open

class Generic(object):
    friendly_name = 'Generic Shell'

    def get_aliases(self):
        return {}
Severity: Minor
Found in thefuck/shells/generic.py - About 2 hrs to fix

    Function _group_by_calls has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

    def _group_by_calls(log):
        ps1 = os.environ['PS1']
        ps1_newlines = ps1.count('\\n') + ps1.count('\n')
        ps1_counter = 0
    
    
    Severity: Minor
    Found in thefuck/output_readers/read_log.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

    File utils.py has 255 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import atexit
    import os
    import pickle
    import re
    import shelve
    Severity: Minor
    Found in thefuck/utils.py - About 2 hrs to fix

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

      def which(program):
          """Returns `program` path or `None`."""
          try:
              from shutil import which
      
      
      Severity: Minor
      Found in thefuck/utils.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 _get_available_commands has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

      def _get_available_commands(stdout):
          commands_listing = False
          for line in stdout.split('\n'):
              if line.startswith('where <command> is one of:'):
                  commands_listing = True
      Severity: Minor
      Found in thefuck/rules/npm_wrong_command.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 _decompose_korean has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

      def _decompose_korean(command):
          def _change_double(ch):
              if ch in DOUBLE_LIST:
                  return DOUBLE_MOD_LIST[DOUBLE_LIST.index(ch)]
              return ch
      Severity: Minor
      Found in thefuck/rules/switch_lang.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 _get_all_absolute_paths_from_history has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

      def _get_all_absolute_paths_from_history(command):
          counter = Counter()
      
          for line in get_valid_history_without_current(command):
              splitted = shell.split_command(line)
      Severity: Minor
      Found in thefuck/rules/path_from_history.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 get_new_command has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

      def get_new_command(command):
          """
          Attempt to rebuild the path string by spellchecking the directories.
          If it fails (i.e. no directories are a close enough match), then it
          defaults to the rules of cd_mkdir.
      Severity: Minor
      Found in thefuck/rules/cd_correction.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 get_all_matched_commands has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

      def get_all_matched_commands(stderr, separator='Did you mean'):
          if not isinstance(separator, list):
              separator = [separator]
          should_yield = False
          for line in stderr.split('\n'):
      Severity: Minor
      Found in thefuck/utils.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 main has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

      def main():
          parser = Parser()
          known_args = parser.parse(sys.argv)
      
          if known_args.help:
      Severity: Minor
      Found in thefuck/entrypoints/main.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 get_args has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

      def get_args(cls, dist, header=None):
          """
          Yield write_script() argument tuples for a distribution's
          console_scripts and gui_scripts entry points.
          """
      Severity: Minor
      Found in fastentrypoints.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 select_command has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

      def select_command(corrected_commands):
          """Returns:
      
           - the first command when confirmation disabled;
           - None when ctrl+c pressed;
      Severity: Minor
      Found in thefuck/ui.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 _get_aliases has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

      def _get_aliases(overridden):
          aliases = {}
          proc = Popen(['fish', '-ic', 'alias'], stdout=PIPE, stderr=DEVNULL)
          alias_out = proc.stdout.read().decode('utf-8').strip()
          if not alias_out:
      Severity: Minor
      Found in thefuck/shells/fish.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 main has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

      def main():
          import os
          import re
          import shutil
          import sys
      Severity: Minor
      Found in fastentrypoints.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

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

      def _get_raw_command(known_args):
          if known_args.force_command:
              return [known_args.force_command]
          elif not os.environ.get('TF_HISTORY'):
              return known_args.command
      Severity: Minor
      Found in thefuck/entrypoints/fix_command.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

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

      def _get_matched_layout(command):
          # don't use command.split_script here because a layout mismatch will likely
          # result in a non-splitable script as per shlex
          cmd = command.script.split(' ')
          for source_layout in source_layouts:
      Severity: Minor
      Found in thefuck/rules/switch_lang.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

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

          def __init__(self, name, match, get_new_command,
      Severity: Major
      Found in thefuck/types.py - About 50 mins to fix

        Function get_key has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

        def get_key():
            ch = getch()
        
            if ch in const.KEY_MAPPING:
                return const.KEY_MAPPING[ch]
        Severity: Minor
        Found in thefuck/system/unix.py - About 45 mins to fix

        Cognitive Complexity

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

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

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

        Further reading

        Function _get_all_tasks has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

        def _get_all_tasks():
            proc = Popen(['grunt', '--help'], stdout=PIPE)
            should_yield = False
            for line in proc.stdout.readlines():
                line = line.decode().strip()
        Severity: Minor
        Found in thefuck/rules/grunt_task_not_found.py - About 45 mins to fix

        Cognitive Complexity

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

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

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

        Further reading

        Function _get_between has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

        def _get_between(content, start, end=None):
            should_yield = False
            for line in content.split('\n'):
                if start in line:
                    should_yield = True
        Severity: Minor
        Found in thefuck/rules/fab_command_not_found.py - About 45 mins to fix

        Cognitive Complexity

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

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

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

        Further reading

        Severity
        Category
        Status
        Source
        Language