Showing 86 of 405 total issues
Function updateLinks
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
updateLinks: function updateLinks(initialSection) {
let section = initialSection;
let prefix = window.APP_PREFIX;
if (typeof prefix !== 'undefined' && prefix.substr(prefix.length - 1) !== '/') {
prefix += '/';
- 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 add_nodes_to_tree
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def add_nodes_to_tree(self, original, adds):
""" Add all the nodes from new_nodes into the original tree. """
tree_hash = tree_builder.build_tree_hash(original)
for node in tree_hash.values():
self.set_child_labels(node)
- 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 footer_nav
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def footer_nav(self, label, toc, versions):
nav = {}
for idx, toc_entry in enumerate(toc):
if toc_entry['section_id'] != label:
continue
- 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 make_preamble_nav
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def make_preamble_nav(nodes, depth=1, max_depth=3):
"""Generate NavItems specific to a notice's preamble.
:type nodes: iterable of Node (a dict)
:param int depth: Current nesting depth of navigation elements
:param int max_depth: We'll stop processing once we reach a certain depth
- 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 set_child_labels
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def set_child_labels(self, node):
"""As we display removed, added, and unchanged nodes, the children of
a node will contain all three types. Pull the 'child_ops' data to
derive the correct order of these combined children"""
instructs = self.diff.get('-'.join(node['label']), {})
- 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_node
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def process_node(self, node, indexes=None):
"""Every node passes through this function on the way to being
rendered. Importantly, this adds the `marked_up` field, which contains
the HTML version of node's text (after applying all relevant
layers) and the `template_name` field, which defines how this node
- 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 set
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
set: function set(sectionId, sectionValue) {
const cached = this.has(sectionId);
let section;
if (typeof sectionId !== 'undefined' && !(_.isEmpty(sectionId))) {
- 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 __new__
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def __new__(cls, url, title, markup_id, children=None, category=None,
Function setSection
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
setSection: function setSection(section, tocId, indexes, label, blank) {
Function test_get_context_data
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def test_get_context_data(self, nav, CFRHTMLBuilder, filter_by_subterp,
Function redirect_by_date
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def redirect_by_date(request, label_id, year, month, day):
Function layers
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def layers(layer_names, doc_type, label_id, sectional=False, version=None):
Function write
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
write: function write(section, tocId, indexes, label, parentEl) {
Function regtext_changes_context
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def regtext_changes_context(cls, amendments, version_info, label_id,
Function _input_files
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def _input_files(self):
"""Fetch all of the static files from the installed apps. Yield them
as pairs of (path, file)"""
files_seen = set()
pairs = (pr for finder in get_finders() for pr in finder.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 route
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
route: function route(options) {
if (Router.hasPushState && typeof options.noRoute === 'undefined') {
let url = this.url;
// if a hash has been passed in
- 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 order_diff_versions
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def order_diff_versions(label_id, version, new_version):
# Re-order if needed - History is sorted in reverse chronological order
for major_version in fetch_grouped_history(label_id.split('-')[0]):
for notice in major_version['notices']:
# Hit the "old" version first, meaning it's not actually the old
- 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_node
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def process_node(self, node, indexes=None):
"""Overrides with custom, additional processing"""
super(CFRHTMLBuilder, self).process_node(node, indexes=indexes)
if 'marked_up' in node:
node['marked_up'] = self.section_space(node['marked_up'])
- 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 modify_interp_node
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def modify_interp_node(self, node):
"""Add extra fields which only exist on interp nodes"""
# ['105', '22', 'Interp'] => section header
node['section_header'] = len(node['label']) == 3
- 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 modified_deleted_sections
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def modified_deleted_sections(diff):
modified, deleted = set(), set()
for label, diff_value in six.iteritems(diff):
label = tuple(label.split('-'))
if 'Interp' in label:
- 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"