alot/commands/envelope.py
File envelope.py
has 668 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
# Copyright (C) 2011-2012 Patrick Totzke <patricktotzke@gmail.com>
# Copyright © 2018 Dylan Baker
# This file is released under the GNU GPL, version 3 or a later revision.
# For further details see the COPYING file
import argparse
Function apply
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
Open
def apply(self, ui):
sign = None
envelope = ui.current_buffer.envelope
# sign status
if self.action == 'sign':
- Read upRead up
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 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def __init__(self, envelope=None, spawn=None, refocus=True, part=None,
Function apply
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Open
def apply(self, ui):
ebuffer = ui.current_buffer
envelope = ebuffer.envelope
if self.action == "txt2html":
- Read upRead up
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
FIXME found Open
Open
# FIXME: handle BCC as well
- Exclude checks
FIXME found Open
Open
# FIXME: handle BCC as well
- Exclude checks
Line break before binary operator Open
Open
and not self._is_encrypted_to_all_recipients()):
- Read upRead up
- Exclude checks
Avoid breaks before binary operators.
The preferred place to break around a binary operator is after the
operator, not before it.
W503: (width == 0\n + height == 0)
W503: (width == 0\n and height == 0)
W503: var = (1\n & ~2)
W503: var = (1\n / -2)
W503: var = (1\n + -1\n + -2)
Okay: foo(\n -x)
Okay: foo(x\n [])
Okay: x = '''\n''' + ''
Okay: foo(x,\n -y)
Okay: foo(x, # comment\n -y)