trendsales/redux-app-state

View on GitHub

Showing 7 of 25 total issues

Function enhancer has 89 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  const enhancer = (state = initState || {}, action) => {
    // We add a bit of safe guardin to avoid side effects
    state = {
      ...state,
    };
Severity: Major
Found in lib/enhancer.js - About 3 hrs to fix

    Function afterNavigate has 38 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const afterNavigate = (pages) => {
      // We start by getting the index of the current page
      const currentPageIndex = getCurrentPage(pages);
      // And the page itself
      const currentPage = pages[currentPageIndex];
    Severity: Minor
    Found in lib/strategies/trendsales.js - About 1 hr to fix

      Function onBack has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

      const onBack = (pages, meta) => {
        // if the request is to close the model
        if (meta.closeModal) {
          // we get the current page index
          const currentPage = getCurrentPage(pages);
      Severity: Minor
      Found in lib/strategies/trendsales.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 exports has 35 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      module.exports = (config) => {
        if (!process.env.SAUCE_USERNAME || !process.env.SAUCE_ACCESS_KEY) {
          console.log('Make sure the SAUCE_USERNAME and SAUCE_ACCESS_KEY environment variables are set.')
          process.exit(1)
        }
      Severity: Minor
      Found in karma.conf.js - About 1 hr to fix

        Function needsPatching has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

        export const needsPatching = (userAgent) => { // eslint-disable-line
          const result = /iPhone OS ([0-9_]+)/.exec(userAgent);
          if (result) {
            const version = result[1];
            const parts = (version || '').split('_');
        Severity: Minor
        Found in lib/utils/platform.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 value has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            value: function value(predicate) {
             // 1. Let O be ? ToObject(this value).
              if (this == null) {
                throw new TypeError('"this" is null or not defined');
              }
        Severity: Minor
        Found in lib/utils/array.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 afterNavigate has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

        const afterNavigate = (pages) => {
          // We start by getting the index of the current page
          const currentPageIndex = getCurrentPage(pages);
          // And the page itself
          const currentPage = pages[currentPageIndex];
        Severity: Minor
        Found in lib/strategies/trendsales.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

        Severity
        Category
        Status
        Source
        Language