quran/quran.com-frontend

View on GitHub

Showing 176 of 176 total issues

Function createStore has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

export default function createStore(history, client, data) {
  const middleware = [createMiddleware(client), routerMiddleware(history)];

  let finalCreateStore;
  if (__DEVELOPMENT__ && __CLIENT__ && __DEVTOOLS__) {
Severity: Minor
Found in src/redux/create.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

Function mapStateToProps has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

function mapStateToProps(state, ownProps) {
  const chapters = state.chapters.entities;
  const chapterId = state.chapters.current;
  const suggestions = state.suggestResults.results[ownProps.value];
  let lang = 'en';
Severity: Minor
Found in src/components/SearchAutocomplete/index.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

Similar blocks of code found in 4 locations. Consider refactoring.
Open

export const footNoteType = PropTypes.shape({
  id: PropTypes.number,
  text: PropTypes.string,
  language_name: PropTypes.string
});
Severity: Major
Found in src/customPropTypes.js and 3 other locations - About 35 mins to fix
src/customPropTypes.js on lines 17..21
src/customPropTypes.js on lines 103..107
src/customPropTypes.js on lines 121..125

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 46.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    it('should have a single ayah input', () => {
      expect(overlay.find('FormControl').length).to.eql(2); // with the times
    });
Severity: Minor
Found in src/components/Audioplayer/RepeatDropdown/spec.js and 1 other location - About 35 mins to fix
src/components/Audioplayer/RepeatDropdown/spec.js on lines 60..62

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 46.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

  componentDidMount() {
    if (!this.props.translationOptions.length) {
      return this.props.loadTranslations();
    }

Severity: Minor
Found in src/components/ContentDropdown/index.js and 1 other location - About 35 mins to fix
src/components/ReciterDropdown/index.js on lines 13..19

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 46.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 4 locations. Consider refactoring.
Open

export const recitationTypes = PropTypes.shape({
  id: PropTypes.number,
  style: PropTypes.string,
  reciter_name_eng: PropTypes.string
});
Severity: Major
Found in src/customPropTypes.js and 3 other locations - About 35 mins to fix
src/customPropTypes.js on lines 17..21
src/customPropTypes.js on lines 23..27
src/customPropTypes.js on lines 121..125

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 46.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 4 locations. Consider refactoring.
Open

export const contentType = PropTypes.shape({
  id: PropTypes.number,
  authorName: PropTypes.string,
  languageName: PropTypes.string
});
Severity: Major
Found in src/customPropTypes.js and 3 other locations - About 35 mins to fix
src/customPropTypes.js on lines 23..27
src/customPropTypes.js on lines 103..107
src/customPropTypes.js on lines 121..125

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 46.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

  componentDidMount() {
    if (!this.props.recitations.length) {
      return this.props.loadRecitations();
    }

Severity: Minor
Found in src/components/ReciterDropdown/index.js and 1 other location - About 35 mins to fix
src/components/ContentDropdown/index.js on lines 32..38

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 46.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 4 locations. Consider refactoring.
Open

export const timeInterval = PropTypes.shape({
  from: PropTypes.number,
  to: PropTypes.number,
  time: PropTypes.number,
});
Severity: Major
Found in src/customPropTypes.js and 3 other locations - About 35 mins to fix
src/customPropTypes.js on lines 17..21
src/customPropTypes.js on lines 23..27
src/customPropTypes.js on lines 103..107

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 46.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    it('should have a range ayah input', () => {
      expect(overlay.find('FormControl').length).to.eql(3); // with the times
    });
Severity: Minor
Found in src/components/Audioplayer/RepeatDropdown/spec.js and 1 other location - About 35 mins to fix
src/components/Audioplayer/RepeatDropdown/spec.js on lines 46..48

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 46.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

    Similar blocks of code found in 10 locations. Consider refactoring.
    Open

                    <li>
                      <a
                        target="_blank"
                        rel="noopener noreferrer"
                        href="http://sunnah.com/"
    Severity: Major
    Found in src/components/Footer/index.js and 9 other locations - About 30 mins to fix
    src/components/Footer/index.js on lines 71..80
    src/components/Footer/index.js on lines 81..90
    src/components/Footer/index.js on lines 91..100
    src/components/GlobalNav/index.js on lines 52..61
    src/components/GlobalNav/index.js on lines 62..71
    src/components/GlobalNav/index.js on lines 72..81
    src/components/GlobalSidebar/index.js on lines 115..124
    src/components/GlobalSidebar/index.js on lines 125..134
    src/components/GlobalSidebar/index.js on lines 135..144

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 45.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Avoid too many return statements within this function.
    Open

          return {
            ...state,
            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 {
              ...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,
                  repeat
                };
          Severity: Major
          Found in src/redux/modules/audioplayer.js - About 30 mins to fix

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                expect(component.find('i').first().props().className).to.contain('repeat');
            Severity: Minor
            Found in src/components/Audioplayer/RepeatDropdown/spec.js and 1 other location - About 30 mins to fix
            src/components/Audioplayer/ScrollButton/spec.js on lines 24..24

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 45.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            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

                    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,
                        loadingTranslations: true
                      };
                Severity: Major
                Found in src/redux/modules/options.js - About 30 mins to fix
                  Severity
                  Category
                  Status
                  Source
                  Language