alot/completion/command.py

Summary

Maintainability
D
1 day
Test Coverage

Function complete has a Cognitive Complexity of 64 (exceeds 5 allowed). Consider refactoring.
Open

    def complete(self, original, pos):
        # remember how many preceding space characters we see until the command
        # string starts. We'll continue to complete from there on and will add
        # these whitespaces again at the very end
        whitespaceoffset = len(original) - len(original.lstrip())
Severity: Minor
Found in alot/completion/command.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

Consider simplifying this complex logical expression.
Open

                if all_optionals:
                    myarg = arguments_until_now[-1]
                    start_myarg = params.rindex(myarg)
                    beforeme = params[:start_myarg]
                    # set up local stringlist completer
Severity: Critical
Found in alot/completion/command.py - About 3 hrs to fix

    Avoid deeply nested control flow statements.
    Open

                            if header.lower() in ['to', 'cc', 'bcc']:
                                res = self._contactscompleter.complete(params,
                                                                       localpos)
                            elif header.lower() == 'from':
                                res = self._accountscompleter.complete(params,
    Severity: Major
    Found in alot/completion/command.py - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                              if buf:
                                  if isinstance(buf, EnvelopeBuffer):
                                      available = buf.envelope.headers.keys()
                                      localcompleter = StringlistCompleter(available)
                                      localres = localcompleter.complete(localprefix,
      Severity: Major
      Found in alot/completion/command.py - About 45 mins to fix

        There are no issues that match your filters.

        Category
        Status