Showing 126 of 199 total issues

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

  post(url, dataOrForm = {}, options = {}) {
    let postData;
    if (dataOrForm instanceof jQuery && dataOrForm.is('form')) {
      // $form
      postData = dataOrForm.serialize();
Severity: Minor
Found in vj4/ui/utils/request.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 can_view has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def can_view(self, udoc, key):
    privacy = udoc.get('show_' + key, next(iter(setting.SETTINGS_BY_KEY['show_' + key].range)))
    return udoc['_id'] == self.user['_id'] \
           or (privacy == constant.setting.PRIVACY_PUBLIC and True) \
           or (privacy == constant.setting.PRIVACY_REGISTERED_ONLY
Severity: Minor
Found in vj4/handler/user.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 reducer has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export default function reducer(state = {
  rows: [],
  items: {},
}, action) {
  switch (action.type) {
Severity: Minor
Found in vj4/ui/components/scratchpad/reducers/records.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 _parse_dag_json has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def _parse_dag_json(dag):
  try:
    dag = json.decode(dag)
  except decoder.JSONDecodeError:
    raise error.ValidationError('dag') from None
Severity: Minor
Found in vj4/handler/training.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 _get_exist_node has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def _get_exist_node(nodes, node_name):
  for category in nodes.values():
    assert type(category) is list
    for node in category:
      if node['name'] == node_name:
Severity: Minor
Found in vj4/model/adaptor/discussion.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 hotkeyPage has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

const hotkeyPage = new AutoloadPage('hotkeyPage', () => {
  $(document).on('keydown', ev => {
    const hotkey = ['alt', 'ctrl', 'shift'].filter(modifyKey => ev[`${modifyKey}Key`]);
    if (ev.metaKey && !ev.ctrlKey) {
      hotkey.push('ctrl');
Severity: Minor
Found in vj4/ui/components/hotkey/hotkey.page.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

Severity
Category
Status
Source
Language