eregs/regulations-site

View on GitHub

Showing 86 of 405 total issues

Function initialize has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  initialize: function initialize() {
    this.dataTables = null;

    if (Router.hasPushState) {
      this.listenTo(MainEvents, 'search-results:open', this.openSection);
Severity: Minor
Found in regulations/static/regulations/js/source/views/main/main-view.js - About 25 mins 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

Function isAppendix has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  isAppendix: function isAppendix(id) {
    let parts;

    if (typeof id !== 'undefined') {
      parts = _.compact(id.split('-'));
Severity: Minor
Found in regulations/static/regulations/js/source/helpers.js - About 25 mins 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

Function is_child_of_requested has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def is_child_of_requested(self, label):
        """ Return true if the label is a child of the requested label.  """
        req = self.label_requested
        if 'Interp' in label and 'Interp' in req:
            # Sub-paragraph
Severity: Minor
Found in regulations/generator/layers/diff_applier.py - About 25 mins 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

Function generate_layers has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def generate_layers(layer_names, fetch_fn, **layer_attrs):
    """Return the three LayerApplier classes, populated with the appropriate
    layer data. Fetches this data in parallel.
    :param layer_names: list of layer short names
    :param fetch_fn: a function, which, when given a layer short name, returns
Severity: Minor
Found in regulations/generator/generator.py - About 25 mins 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

Function setChildOptions has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  setChildOptions: function setChildOptions(options) {
    this.childOptions = _.extend({
      id: this.sectionId,
      type: this.contentType,
      regVersion: this.regVersion,
Severity: Minor
Found in regulations/static/regulations/js/source/views/main/main-view.js - About 25 mins 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

Function add_combo_options has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def add_combo_options(fields):
    """Augment combo fields with dependency-contingent options. Adds a dict
    mapping contingent values to lists of options to each field of type
    "combo".
    """
Severity: Minor
Found in notice_comment/docket.py - About 25 mins 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

Severity
Category
Status
Source
Language