tahnik/devRantron

View on GitHub

Showing 10 of 10 total issues

Function render has a Cognitive Complexity of 33 (exceeds 10 allowed). Consider refactoring.
Open

  render() {
    const {
      type, item, onDelete, theme,
    } = this.props;
    const { favorited } = this.state;
Severity: Minor
Found in app/src/js/components/item/bottom_bar.js - About 4 hrs 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 fetchFeed has a Cognitive Complexity of 24 (exceeds 10 allowed). Consider refactoring.
Open

(sort, type, id, range, refresh = false, week = 0) => (dispatch, getState) => {
  // First check if column that requested the fetch is part of custom columns
  const columns = getState().columns;
  let currentColumn = columns.filter(column => column.id === id)[0];

Severity: Minor
Found in app/src/js/actions/fetch.js - About 2 hrs 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 render has a Cognitive Complexity of 19 (exceeds 10 allowed). Consider refactoring.
Open

  render() {
    const {
      item, theme, vote, modal, itemType, auth, open, addMention,
    } = this.props;
    const { popup } = this.state;
Severity: Minor
Found in app/src/js/components/item/item_card.js - About 1 hr 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 handleArrowKeys has a Cognitive Complexity of 17 (exceeds 10 allowed). Consider refactoring.
Open

  static handleArrowKeys(e) {
    const { mentions, selectedMention } = component.state;
    const lastIndex = mentions.length - 1;
    switch (e.keyCode) {
      case 9:
Severity: Minor
Found in app/src/js/components/utilities/smart_area.js - About 1 hr 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 render has a Cognitive Complexity of 15 (exceeds 10 allowed). Consider refactoring.
Open

  render() {
    const { pickerActive, selectedMention } = this.state;
    const { theme } = this.props;
    const invalidContent = this.props.value.length < 5;
    const isPost = typeof this.props.tags !== 'undefined';
Severity: Minor
Found in app/src/js/components/utilities/smart_area.js - About 1 hr 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 showNotifs has a Cognitive Complexity of 14 (exceeds 10 allowed). Consider refactoring.
Open

const showNotifs = notif => (dispatch, getState) => {
  const notifSettings = getState().settings.general.notifications.options;

  /**
   * This is done to update the user score (and the profile)
Severity: Minor
Found in app/src/js/actions/notifs.js - About 55 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 getFilter has a Cognitive Complexity of 13 (exceeds 10 allowed). Consider refactoring.
Open

  getFilter(type) {
    const { filters, sort, range } = this.props;
    // Get the options from the given filter type i.e. algo, top and recent
    const options = filters[type];
    if (options) {
Severity: Minor
Found in app/src/js/components/columns/column_topbar.js - About 45 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 render has a Cognitive Complexity of 12 (exceeds 10 allowed). Consider refactoring.
Open

  render() {
    const {
      notifs, auth, open, clearNotifs, theme,
    } = this.props;

Severity: Minor
Found in app/src/js/components/notifs/notifs.js - About 35 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

Avoid too many return statements within this function.
Open

  return `${Math.floor(seconds)}s`;
Severity: Major
Found in app/src/js/consts/utils.js - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

          return DEFAULT_STATES.columns;
    Severity: Major
    Found in app/src/js/reducers/columns.js - About 30 mins to fix
      Severity
      Category
      Status
      Source
      Language