quran/quran.com-frontend

View on GitHub

Showing 176 of 176 total issues

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

export const bookmarkActions = PropTypes.shape({
  isLoaded: PropTypes.func.isRequired,
  load: PropTypes.func.isRequired,
  addBookmark: PropTypes.func.isRequired,
  removeBookmark: PropTypes.func.isRequired
Severity: Major
Found in src/customPropTypes.js and 3 other locations - About 1 hr to fix
src/customPropTypes.js on lines 10..15
src/customPropTypes.js on lines 46..51
src/customPropTypes.js on lines 221..226

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 71.

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

Function reducer has 45 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export default function reducer(state = initialState, action = {}) {
  switch (action.type) {
    case SAVE: {
      cookie.save('auth', {
        client: action.data.client_id,
Severity: Minor
Found in src/redux/modules/auth.js - About 1 hr to fix

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

    export const storeText = PropTypes.shape({
      ios: PropTypes.string.isRequired,
      android: PropTypes.string.isRequired,
      windows: PropTypes.string.isRequired,
      kindle: PropTypes.string.isRequired,
    Severity: Major
    Found in src/customPropTypes.js and 3 other locations - About 1 hr to fix
    src/customPropTypes.js on lines 3..8
    src/customPropTypes.js on lines 10..15
    src/customPropTypes.js on lines 46..51

    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 71.

    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

    Function reducer has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

    export default function reducer(state = initialState, action = {}) {
      switch (action.type) {
        case VERSES_CLEAR_CURRENT: {
          const stateFilesCurrent = state.files;
    
    
    Severity: Minor
    Found in src/redux/modules/audioplayer.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

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

              <li>
                <a
                  href="http://legacy.quran.com"
                  data-metrics-event-name="Sidebar:Link:Legacy"
                >
    Severity: Major
    Found in src/components/GlobalSidebar/index.js and 3 other locations - About 1 hr to fix
    src/components/GlobalSidebar/index.js on lines 58..69
    src/components/GlobalSidebar/index.js on lines 70..75
    src/components/GlobalSidebar/index.js on lines 76..87

    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 69.

    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

              <li>
                <Link
                  to="/donations"
                  data-metrics-event-name="Sidebar:Link:Contribute"
                >
    Severity: Major
    Found in src/components/GlobalSidebar/index.js and 3 other locations - About 1 hr to fix
    src/components/GlobalSidebar/index.js on lines 58..69
    src/components/GlobalSidebar/index.js on lines 70..75
    src/components/GlobalSidebar/index.js on lines 102..113

    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 69.

    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

              <li>
                <Link to="/apps" data-metrics-event-name="Sidebar:Link:Mobile">
                  <i className="ss-icon ss-cell vertical-align-middle" />{' '}
                  <LocaleFormattedMessage id="nav.mobile" defaultMessage="Mobile" />
                </Link>
    Severity: Major
    Found in src/components/GlobalSidebar/index.js and 3 other locations - About 1 hr to fix
    src/components/GlobalSidebar/index.js on lines 58..69
    src/components/GlobalSidebar/index.js on lines 76..87
    src/components/GlobalSidebar/index.js on lines 102..113

    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 69.

    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

              <li>
                <a
                  href="https://quran.zendesk.com/hc/en-us"
                  data-metrics-event-name="Sidebar:Link:Help"
                >
    Severity: Major
    Found in src/components/GlobalSidebar/index.js and 3 other locations - About 1 hr to fix
    src/components/GlobalSidebar/index.js on lines 70..75
    src/components/GlobalSidebar/index.js on lines 76..87
    src/components/GlobalSidebar/index.js on lines 102..113

    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 69.

    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

    Function render has 42 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      render() {
        const { repeat } = this.props;
    
        const popover = (
          <Popover
    Severity: Minor
    Found in src/components/Audioplayer/RepeatDropdown/index.js - About 1 hr to fix

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

              <div className="form-group">
                <h5 className="text-black">
                  <LocaleFormattedMessage id="setting.reciters.title" defaultMessage="Reciters" />
                </h5>
                <ReciterDropdown
      Severity: Major
      Found in src/components/SettingsModal/index.js and 1 other location - About 1 hr to fix
      src/components/SettingsModal/index.js on lines 51..58

      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 68.

      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

        if (title) {
          tags.title = title;
          tags.meta.push(
            { property: 'og:site_name', content: title },
            { property: 'og:title', content: title },
      Severity: Major
      Found in src/helpers/makeHeadTags.js and 1 other location - About 1 hr to fix
      src/helpers/makeHeadTags.js on lines 15..22

      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 68.

      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

          case LOAD_SUCCESS: {
            const entities = state.entities;
            const { chapters } = action.result.entities;
            return {
              ...state,
      Severity: Major
      Found in src/redux/modules/chapters.js and 1 other location - About 1 hr to fix
      src/redux/modules/bookmarks.js on lines 14..26

      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 68.

      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

              <div className="form-group">
                <h5 className="text-black">
                  <LocaleFormattedMessage id="setting.translations.title" defaultMessage="Translations" />
                </h5>
                <ContentDropdown
      Severity: Major
      Found in src/components/SettingsModal/index.js and 1 other location - About 1 hr to fix
      src/components/SettingsModal/index.js on lines 43..50

      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 68.

      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

        if (description) {
          tags.description = description;
          tags.meta.push(
            { name: 'description', content: description },
            { property: 'og:description', content: description },
      Severity: Major
      Found in src/helpers/makeHeadTags.js and 1 other location - About 1 hr to fix
      src/helpers/makeHeadTags.js on lines 6..13

      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 68.

      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

          case LOAD_SUCCESS: {
            const entities = state.entities;
            const { bookmarks } = action.result.entities;
            return {
              ...state,
      Severity: Major
      Found in src/redux/modules/bookmarks.js and 1 other location - About 1 hr to fix
      src/redux/modules/chapters.js on lines 26..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 68.

      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

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

        renderForm() {
          return (
            <form className="form-horizontal" onSubmit={this.submitSupport}>
              <div className="form-group">
                <label htmlFor="name" className="col-sm-2 control-label">Name</label>
      Severity: Minor
      Found in src/containers/Contact/index.js - About 1 hr to fix

        Function checkValidChapterOrVerse has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

        export default function checkValidChapterOrVerse(nextState, replaceState) {
          const chapterId = parseInt(nextState.params.chapterId, 10);
          filterValidChapter(replaceState, chapterId);
        
          if (nextState.params.range) {
        Severity: Minor
        Found in src/utils/routeFilters.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

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

              <div className="row">
                <div className="col-md-8 col-md-offset-2">
                  <h3>MECCAN SURAHS</h3>
                  <h4 className="source-sans">
                    The Meccan suras are the chronologically earlier chapters
        Severity: Major
        Found in src/containers/About/index.js and 1 other location - About 1 hr to fix
        src/containers/About/index.js on lines 38..50

        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 66.

        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

                {Object.keys(assets.styles).map((style, i) => (
                  <link
                    href={assets.styles[style]}
                    key={i}
                    rel="stylesheet"
        Severity: Major
        Found in src/helpers/Html.js and 1 other location - About 1 hr to fix
        src/helpers/PdfHtml.js on lines 20..27

        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 66.

        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

        export default connect(state => ({
          recitations: state.options.options.recitations,
          loadingRecitations: state.options.loadingRecitations,
          audio: state.options.audio
        }), { loadRecitations })(ReciterDropdown);
        Severity: Major
        Found in src/components/ReciterDropdown/index.js and 1 other location - About 1 hr to fix
        src/components/ContentDropdown/index.js on lines 133..137

        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 66.

        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

        Severity
        Category
        Status
        Source
        Language