magarcia/react-pokedex

View on GitHub

Showing 22 of 32 total issues

Function deepEqual has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

const deepEqual = (a, b) => {
  if (
    typeof a === 'object' &&
    a != null &&
    (typeof b === 'object' && b != null)
Severity: Minor
Found in src/utils.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 fixNames has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

const fixNames = name => {
  if (name === 'sceptile') {
    return 'sceptille';
  }
  if (name === 'jirachi') {
Severity: Minor
Found in src/components/PokemonImage.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 fixNames has 52 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const fixNames = name => {
  if (name === 'sceptile') {
    return 'sceptille';
  }
  if (name === 'jirachi') {
Severity: Major
Found in src/components/PokemonImage.js - About 2 hrs to fix

    Function selectColor has 40 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const selectColor = name => {
      switch (name) {
        case 'normal':
          return '#A8A77A';
        case 'fire':
    Severity: Minor
    Found in src/components/PokemonType.js - About 1 hr to fix

      Function getLimitsFromGeneration has 29 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const getLimitsFromGeneration = generation => {
        let limit;
        let offset;
        switch (generation) {
          case 'all':
      Severity: Minor
      Found in src/pages/Pokedex.js - About 1 hr to fix

        Function deepEqual has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        const deepEqual = (a, b) => {
          if (
            typeof a === 'object' &&
            a != null &&
            (typeof b === 'object' && b != null)
        Severity: Minor
        Found in src/utils.js - About 1 hr to fix

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

          const withFetching = getUrl => InnerComponent =>
            class WithFetching extends Component {
              constructor(props) {
                super(props);
                this.props = props;
          Severity: Minor
          Found in src/components/withFetching.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

          Avoid too many return statements within this function.
          Open

            return a === b;
          Severity: Major
          Found in src/utils.js - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                return 'hooh';
            Severity: Major
            Found in src/components/PokemonImage.js - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                  return 'deoxys';
              Severity: Major
              Found in src/components/PokemonImage.js - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                    return 'cherim-overcast';
                Severity: Major
                Found in src/components/PokemonImage.js - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                      return 'shellos-east';
                  Severity: Major
                  Found in src/components/PokemonImage.js - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                        return 'gastrodon-east';
                    Severity: Major
                    Found in src/components/PokemonImage.js - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                        return name;
                      Severity: Major
                      Found in src/components/PokemonImage.js - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                            return `${name}-1`;
                        Severity: Major
                        Found in src/components/PokemonImage.js - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                              return 'mimejr';
                          Severity: Major
                          Found in src/components/PokemonImage.js - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                return 'lickilicki';
                            Severity: Major
                            Found in src/components/PokemonImage.js - About 30 mins to fix

                              Avoid too many return statements within this function.
                              Open

                                  return `${name}-a`;
                              Severity: Major
                              Found in src/components/PokemonImage.js - About 30 mins to fix

                                Avoid too many return statements within this function.
                                Open

                                    return `${name}-normal`;
                                Severity: Major
                                Found in src/components/PokemonImage.js - About 30 mins to fix

                                  Avoid too many return statements within this function.
                                  Open

                                      return `${name}-plant`;
                                  Severity: Major
                                  Found in src/components/PokemonImage.js - About 30 mins to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language