Showing 10 of 16 total issues
File cli.py
has 423 lines of code (exceeds 250 allowed). Consider refactoring. Open
#!/usr/bin/env python
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
Function list
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def list(ctx, value, timestamp):
for name, element in sorted(get_wva(ctx).get_vehicle_data_elements().items(), key=lambda (k, v): k):
if value:
try:
curval = element.sample()
- 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 _service_connected
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def _service_connected(self):
# grab new data
try:
data = self._socket.recv(1024)
except socket.timeout:
- 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 cli
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def cli(ctx, hostname, username, password, config_dir, https):
Function sample
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def sample(ctx, element, timestamp, repeat, delay):
Function add
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def add(ctx, short_name, uri, interval, buffer):
Function get_config_value
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def get_config_value(ctx, key, prompt, current_value, password=False):
Function run
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def run(self):
fig, ax = plt.subplots()
plt.suptitle("WVA Vehicle Data (Live Graph)")
x = np.arange(-200, self._seconds, 0.01)
plot_lines = {}
- 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 sample
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def sample(ctx, element, timestamp, repeat, delay):
"""Sample the value of a vehicle data element
This command allows for the current value of a vehicle data element
to be sampled:
- 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 get_wva
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def get_wva(ctx):
root_ctx = get_root_ctx(ctx)
if root_ctx.wva is None:
root_ctx.hostname = get_hostname(root_ctx)
root_ctx.username = get_username(root_ctx)
- 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"