Showing 27 of 55 total issues
File config.py
has 496 lines of code (exceeds 250 allowed). Consider refactoring. Open
# -*- coding: utf-8 -*-
from __future__ import print_function, unicode_literals
from copy import deepcopy
import re
File vagrant.py
has 393 lines of code (exceeds 250 allowed). Consider refactoring. Open
# -*- coding: utf-8 -*-
from __future__ import print_function, unicode_literals
from urlparse import urlparse
import requests
Function stream_subprocess
has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
def stream_subprocess(command_list, quiet = False, working_dir = None, out_to_file = None):
process = subprocess.Popen(
command_list,
bufsize = 0,
stdout = subprocess.PIPE,
- 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 _read_config_includes
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
def _read_config_includes(self, config_loader):
config_data_list = config_loader.get_data()
for config_data in config_data_list:
if 'include' in config_data:
- 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 _refresh
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
def _refresh(self):
if self._box_lookup is None:
try:
box_lines = run_command('{} box list'.format(self._vagrant_command), quiet = True)
- 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 parse_parameters
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
def parse_parameters(param_list, config, output, config_lookup = None):
for param in param_list:
assert isinstance(param, TargetParameter)
if config_lookup and param.config_key in config_lookup:
- 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 parse_version
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def parse_version(version_val):
if not version_val:
raise BoxVersionException("Invalid version value: '{}'".format(version_val))
elif isinstance(version_val, Version):
- 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 _dump_config
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def _dump_config(cls, entry, indent = 0):
out_list = []
if isinstance(entry, dict):
for key in sorted(entry.keys()):
- 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 _parse
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def _parse(self, value):
lookup_start = value.find('((')
lookup_end = value.find('))')
if lookup_start >= 0 > lookup_end:
- 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_vagrant_output_file_names
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def get_vagrant_output_file_names(config, target_list, check_file = True):
target_file_lookup = {}
box_metadata_file_name = None
if config.vagrant_output is not None:
- 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 _process
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def _process(self, value):
value_list = map(lambda val_str: val_str.strip(), value.split('|'))
value_list_len = len(value_list)
process_func_list = []
- 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_lookup_value
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def _get_lookup_value(self, file_name, key_name, optional = False):
lookup = None
for file_name_full in get_path_names(file_name, self._path_list):
lookup = read_yaml_file(file_name_full)
- 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_tar_file_data
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def _get_tar_file_data(self, tar_type, tar_name, file_name):
tar_type_lookup = {
'tgz': 'r:gz'
}
tar_mode = tar_type_lookup.get(tar_type)
- 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 _load_url
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def _load_url(url):
result = urlparse(url)
if result.scheme == 'file':
try:
- 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 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(
Function add_vagrant_files_to_box_metadata
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def add_vagrant_files_to_box_metadata(config, box_metadata, target_file_lookup, box_inventory):
for provider_name, provider_file_name in target_file_lookup.iteritems():
if 'vagrant_publish_copy_command' in config:
copy_published_file(config, provider_file_name, provider_name)
- 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
Avoid deeply nested control flow statements. Open
if insert_at is not None:
version_list.insert(insert_at, installed_version)
else:
version_list.append(installed_version)
Function __setattr__
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def __setattr__(self, item, value):
if item in ('_path_list', '_config', '_re', '_uuid_cache'):
super(Config, self).__setattr__(item, value)
else:
- 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 parse_provisioners
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def parse_provisioners(provisioner_list, config, packer_config):
if not isinstance(provisioner_list, list):
raise ProvisionerException('Provisioners must be a list')
def to_expanded_json(val):
- 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_data
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def get_data(self):
config_data_list = []
path_list = self._path_list
if self._initial_config:
- 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"