ergonomica/ergonomica

View on GitHub

Showing 65 of 154 total issues

Function eval has a Cognitive Complexity of 141 (exceeds 5 allowed). Consider refactoring.
Open

def eval(x, ns, at_top = False):
    global namespace, PRINT_OVERRIDE, ENV

    if at_top:
        PRINT_OVERRIDE = False
Severity: Minor
Found in ergonomica/lib/lang/interpreter.py - About 2 days 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 complete has a Cognitive Complexity of 60 (exceeds 5 allowed). Consider refactoring.
Open

def complete(verbs, text):
    """
    Return a completion for a command or directory.
    """

Severity: Minor
Found in ergonomica/lib/interface/completer.py - About 1 day 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 test_license.py has 531 lines of code (exceeds 250 allowed). Consider refactoring.
Open

#!/usr/bin/env python
# -*- coding: utf-8 -*-

"""
[tests/stdlib/test_license.py]
Severity: Major
Found in tests/stdlib/test_license.py - About 1 day to fix

    File ergo_license.py has 526 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    #!/usr/bin/env python
    # -*- coding: utf-8 -*-
    # -*- coding: utf-8 -*-
    
    # no real way to shorten license strings
    Severity: Major
    Found in ergonomica/lib/lib/ergo_license.py - About 1 day to fix

      Function parse has a Cognitive Complexity of 52 (exceeds 5 allowed). Consider refactoring.
      Open

      def parse(tokens, allow_unclosed_blocks=False):
          depth = 0
          L = []
          parsed_command = False # switch set to true on first atom parsed---ensures that
                                 # arguments after the command interpreted as strings
      Severity: Minor
      Found in ergonomica/lib/lang/parser.py - About 1 day 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

      TestBuiltins has 51 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class TestBuiltins(unittest.TestCase):
          """Tests the builtins."""
      
          def test_print(self):
              """
      Severity: Major
      Found in tests/lang/test_builtins.py - About 7 hrs to fix

        Function pipe has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
        Open

        def pipe(blocksizes, *functions):
        
            global ENV
            
            blocksizes = list(blocksizes)
        Severity: Minor
        Found in ergonomica/lib/lang/interpreter.py - About 6 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_arg_type has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
        Open

        def get_arg_type(verbs, text):
            """
            Get the type of the current argument to complete,
            given the buffer text and the verbs dictionary.
            """
        Severity: Minor
        Found in ergonomica/lib/interface/completer.py - About 5 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 interpreter.py has 413 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        #!/usr/bin/env python
        # -*- coding: utf-8 -*-
        
        from __future__ import absolute_import, print_function
        
        
        Severity: Minor
        Found in ergonomica/lib/lang/interpreter.py - About 5 hrs to fix

          Function obj_set has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
          Open

          def obj_set(arr, order=True):
              new_arr = []
              for i in arr:
                  contained = False
                  if not order:
          Severity: Minor
          Found in ergonomica/lib/lang/builtins.py - About 5 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 convert_piping_tokens has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
          Open

          def convert_piping_tokens(_tokens):
              tokens = [x for x in _tokens]
          
              if "{}" in tokens:
                  for i in range(len(tokens)):
          Severity: Minor
          Found in ergonomica/lib/lang/parser.py - About 3 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 test_builtins.py has 312 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          #!/usr/bin/env python
          # -*- coding: utf-8 -*-
          
          """
          [tests/stdlib/test_rprompt.py]
          Severity: Minor
          Found in tests/lang/test_builtins.py - About 3 hrs to fix

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

            def convert_piping_tokens(_tokens):
                tokens = [x for x in _tokens]
                if "{}" in tokens:
                    for i in range(len(tokens)):
                        if tokens[i] == "{}":
            Severity: Minor
            Found in ergonomica/lib/lang/tokenizer.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 load_key_bindings has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
            Open

            def load_key_bindings(env):
                """Return a KeyBindings object given an Ergonomica environment."""
                kb = KeyBindings()
            
                # for some reason Pylint doesn't think this function is "used"
            Severity: Minor
            Found in ergonomica/lib/interface/key_bindings_manager.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 run has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
            Open

            def run(file, argv):
                """The main Ergonomica runtime."""
            
                for line in file_lines(open(os.path.join(os.path.expanduser("~"), ".ergo", ".ergo_profile")).read()):
                    print_ergo(line)
            Severity: Minor
            Found in ergonomica/main.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 size has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
            Open

            def size(argc):
                """size: Return the sizes of files.
            
                Usage:
                    size [-h] FILE
            Severity: Minor
            Found in ergonomica/lib/lib/ergo_size.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 find has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
            Open

            def find(argc):
                """find: Find patterns.
            
                Usage:
                    find file [-f | --flat]
            Severity: Minor
            Found in ergonomica/lib/lib/ergo_find.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 quotesplit has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
            Open

            def quotesplit(string):
                """
                Quote respecting split (by spaces).
                
                Example:
            Severity: Minor
            Found in ergonomica/lib/lang/tokenizer.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 quotereplacechar has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
            Open

            def quotereplacechar(char, sub, string):
                """
                Quote respecting replace.
                """
            
            
            Severity: Minor
            Found in ergonomica/lib/lang/tokenizer.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 rm has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
            Open

            def rm(argc):
                """rm: Remove files and directories.
            
                Usage:
                   rm <file/directory>[FILES...]
            Severity: Minor
            Found in ergonomica/lib/lib/ergo_rm.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

            Severity
            Category
            Status
            Source
            Language