quran/quran.com-frontend

View on GitHub

Showing 77 of 176 total issues

Avoid too many return statements within this function.
Open

      return {
        ...state,
        loaded: false,
        loading: true
      };
Severity: Major
Found in src/redux/modules/verses.js - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

          if (!state.segments[chapterId][nextId].words[position]) return state;
    Severity: Major
    Found in src/redux/modules/audioplayer.js - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

            return {
              ...state,
              current,
              loaded: true,
              loading: false,
      Severity: Major
      Found in src/redux/modules/verses.js - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

              return {
                ...state,
                loadingTranslations: true
              };
        Severity: Major
        Found in src/redux/modules/options.js - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                  return {
                    ...state,
                    currentWord: action.word,
                    currentTime
                  };
          Severity: Major
          Found in src/redux/modules/audioplayer.js - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                  return {
                    ...state,
                    currentWord: word
                  };
            Severity: Major
            Found in src/redux/modules/audioplayer.js - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                    return {
                      ...state,
                      currentVerse: nextId,
                      currentFile: state.files[chapterId][nextId],
                      currentTime: 0
              Severity: Major
              Found in src/redux/modules/audioplayer.js - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                      return {
                        ...state,
                        currentFile: action.file
                      };
                Severity: Major
                Found in src/redux/modules/audioplayer.js - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                        return {
                          ...state,
                          loadingTranslations: false,
                          options: {
                            ...state.options,
                  Severity: Major
                  Found in src/redux/modules/options.js - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                          return {
                            ...state,
                            currentWord: action.word,
                            currentVerse: nextId,
                            isPlaying: false,
                    Severity: Major
                    Found in src/redux/modules/audioplayer.js - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                        return {};
                      Severity: Major
                      Found in src/containers/Surah/connect.js - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                              return {
                                ...state,
                                isPlaying: true
                              };
                        Severity: Major
                        Found in src/redux/modules/audioplayer.js - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                                if (!state.segments[chapterId][nextId]) return state;
                          Severity: Major
                          Found in src/redux/modules/audioplayer.js - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                  if (!action.payload) return state;
                            Severity: Major
                            Found in src/redux/modules/audioplayer.js - About 30 mins to fix

                              Avoid too many return statements within this function.
                              Open

                                    return {
                                      ...state,
                                      shouldScroll: !state.shouldScroll
                                    };
                              Severity: Major
                              Found in src/redux/modules/audioplayer.js - About 30 mins to fix

                                Avoid too many return statements within this function.
                                Open

                                      return {
                                        ...state,
                                        currentVerse: action.id
                                      };
                                Severity: Major
                                Found in src/redux/modules/audioplayer.js - About 30 mins to fix

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

                                  function prepareParams(params, options) {
                                    // NOTE: first priority to options in URL, second to options and lastly fallback to defaultOptions
                                    let translations;
                                  
                                    if (params.translations && params.translations.length) {
                                  Severity: Minor
                                  Found in src/redux/actions/verses.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