bookbrainz/bookbrainz-site

View on GitHub
src/server/routes/revision.js

Summary

Maintainability
F
3 days
Test Coverage

File revision.js has 284 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*
 * Copyright (C) 2015-2016  Ben Ockmore
 *               2016       Sean Burke
 *
 * This program is free software; you can redistribute it and/or modify
Severity: Minor
Found in src/server/routes/revision.js - About 2 hrs to fix

    Function diffRevisionsWithParents has 46 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function diffRevisionsWithParents(orm, entityRevisions, entityType) {
        // entityRevisions - collection of *entityType*_revisions matching id
        const promises = entityRevisions.map(
            async (revision) => {
                const dataId = revision.get('dataId');
    Severity: Minor
    Found in src/server/routes/revision.js - About 1 hr to fix

      Function promises has 41 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              async (revision) => {
                  const dataId = revision.get('dataId');
                  const revisionEntity = revision.related('entity');
                  const entityBBID = revisionEntity.get('bbid');
                  const entity = await orm.func.entity.getEntity(orm, entityType, entityBBID);
      Severity: Minor
      Found in src/server/routes/revision.js - About 1 hr to fix

        Function formatEditionChange has 32 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function formatEditionChange(change) {
            if (_.isEqual(change.path, ['editionGroupBbid'])) {
                return baseFormatter.formatScalarChange(change, 'EditionGroup');
            }
        
        
        Severity: Minor
        Found in src/server/routes/revision.js - About 1 hr to fix

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

          function diffRevisionsWithParents(orm, entityRevisions, entityType) {
              // entityRevisions - collection of *entityType*_revisions matching id
              const promises = entityRevisions.map(
                  async (revision) => {
                      const dataId = revision.get('dataId');
          Severity: Minor
          Found in src/server/routes/revision.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 formatAuthorChange has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

          function formatAuthorChange(change) {
              if (_.isEqual(change.path, ['beginDate'])) {
                  return baseFormatter.formatScalarChange(change, 'Begin Date');
              }
          
          
          Severity: Minor
          Found in src/server/routes/revision.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 formatEditionChange has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

          function formatEditionChange(change) {
              if (_.isEqual(change.path, ['editionGroupBbid'])) {
                  return baseFormatter.formatScalarChange(change, 'EditionGroup');
              }
          
          
          Severity: Minor
          Found in src/server/routes/revision.js - About 45 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 baseFormatter.formatScalarChange(
                      change, _.startCase(change.path[0])
                  );
          Severity: Major
          Found in src/server/routes/revision.js - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                    return baseFormatter.formatAreaChange(change, 'End Area');
            Severity: Major
            Found in src/server/routes/revision.js - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                      return baseFormatter.formatScalarChange(change, 'Page Count');
              Severity: Major
              Found in src/server/routes/revision.js - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                    return null;
                Severity: Major
                Found in src/server/routes/revision.js - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                          return baseFormatter.formatTypeChange(change, 'Author Type');
                  Severity: Major
                  Found in src/server/routes/revision.js - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                            return baseFormatter.formatAreaChange(change);
                    Severity: Major
                    Found in src/server/routes/revision.js - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                              return baseFormatter.formatTypeChange(change, 'Edition Status');
                      Severity: Major
                      Found in src/server/routes/revision.js - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                                return baseFormatter.formatTypeChange(change, 'Edition Format');
                        Severity: Major
                        Found in src/server/routes/revision.js - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                                  return baseFormatter.formatAreaChange(change, 'Begin Area');
                          Severity: Major
                          Found in src/server/routes/revision.js - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                return null;
                            Severity: Major
                            Found in src/server/routes/revision.js - About 30 mins to fix

                              Avoid too many return statements within this function.
                              Open

                                  return null;
                              Severity: Major
                              Found in src/server/routes/revision.js - About 30 mins to fix

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

                                        const markup = ReactDOMServer.renderToString(
                                            <Layout {...propHelpers.extractLayoutProps(props)}>
                                                <RevisionPage
                                                    diffs={props.diffs}
                                                    revision={props.revision}
                                Severity: Major
                                Found in src/server/routes/revision.js and 1 other location - About 2 hrs to fix
                                src/server/routes/register.js on lines 78..86

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

                                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

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

                                                    entityAlias: dataId ?
                                                        revision.related('data').fetch({require: false, withRelated: ['aliasSet.defaultAlias', 'aliasSet.aliases']}) :
                                                        orm.func.entity.getEntityParentAlias(
                                                            orm, entityType, revision.get('bbid')
                                                        ),
                                Severity: Major
                                Found in src/server/routes/revision.js and 1 other location - About 1 hr to fix
                                src/server/routes/revision.js on lines 215..219

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

                                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

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

                                                    entityAlias: dataId ?
                                                        revision.related('data').fetch({require: false, withRelated: ['aliasSet.defaultAlias', 'aliasSet.aliases']}) :
                                                        orm.func.entity.getEntityParentAlias(
                                                            orm, entityType, revision.get('bbid')
                                                        ),
                                Severity: Major
                                Found in src/server/routes/revision.js and 1 other location - About 1 hr to fix
                                src/server/routes/revision.js on lines 199..203

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

                                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 9 locations. Consider refactoring.
                                Open

                                    if (_.isEqual(change.path, ['authorType']) ||
                                            _.isEqual(change.path, ['authorType', 'label'])) {
                                        return baseFormatter.formatTypeChange(change, 'Author Type');
                                    }
                                Severity: Major
                                Found in src/server/routes/revision.js and 8 other locations - About 55 mins to fix
                                src/server/routes/revision.js on lines 67..70
                                src/server/routes/revision.js on lines 72..75
                                src/server/routes/revision.js on lines 110..113
                                src/server/routes/revision.js on lines 115..118
                                src/server/routes/revision.js on lines 135..138
                                src/server/routes/revision.js on lines 149..152
                                src/server/routes/revision.js on lines 163..166
                                src/server/routes/revision.js on lines 172..175

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

                                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 9 locations. Consider refactoring.
                                Open

                                    if (_.isEqual(change.path, ['endArea']) ||
                                            _.isEqual(change.path, ['endArea', 'name'])) {
                                        return baseFormatter.formatAreaChange(change, 'End Area');
                                    }
                                Severity: Major
                                Found in src/server/routes/revision.js and 8 other locations - About 55 mins to fix
                                src/server/routes/revision.js on lines 62..65
                                src/server/routes/revision.js on lines 67..70
                                src/server/routes/revision.js on lines 110..113
                                src/server/routes/revision.js on lines 115..118
                                src/server/routes/revision.js on lines 135..138
                                src/server/routes/revision.js on lines 149..152
                                src/server/routes/revision.js on lines 163..166
                                src/server/routes/revision.js on lines 172..175

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

                                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 9 locations. Consider refactoring.
                                Open

                                    if (_.isEqual(change.path, ['editionFormat']) ||
                                            _.isEqual(change.path, ['editionFormat', 'label'])) {
                                        return baseFormatter.formatTypeChange(change, 'Edition Format');
                                    }
                                Severity: Major
                                Found in src/server/routes/revision.js and 8 other locations - About 55 mins to fix
                                src/server/routes/revision.js on lines 62..65
                                src/server/routes/revision.js on lines 67..70
                                src/server/routes/revision.js on lines 72..75
                                src/server/routes/revision.js on lines 115..118
                                src/server/routes/revision.js on lines 135..138
                                src/server/routes/revision.js on lines 149..152
                                src/server/routes/revision.js on lines 163..166
                                src/server/routes/revision.js on lines 172..175

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

                                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 9 locations. Consider refactoring.
                                Open

                                    if (_.isEqual(change.path, ['seriesOrderingType']) ||
                                            _.isEqual(change.path, ['seriesOrderingType', 'label'])) {
                                        return baseFormatter.formatTypeChange(change, 'Series Ordering Type');
                                    }
                                Severity: Major
                                Found in src/server/routes/revision.js and 8 other locations - About 55 mins to fix
                                src/server/routes/revision.js on lines 62..65
                                src/server/routes/revision.js on lines 67..70
                                src/server/routes/revision.js on lines 72..75
                                src/server/routes/revision.js on lines 110..113
                                src/server/routes/revision.js on lines 115..118
                                src/server/routes/revision.js on lines 135..138
                                src/server/routes/revision.js on lines 163..166
                                src/server/routes/revision.js on lines 172..175

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

                                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 9 locations. Consider refactoring.
                                Open

                                    if (_.isEqual(change.path, ['beginArea']) ||
                                            _.isEqual(change.path, ['beginArea', 'name'])) {
                                        return baseFormatter.formatAreaChange(change, 'Begin Area');
                                    }
                                Severity: Major
                                Found in src/server/routes/revision.js and 8 other locations - About 55 mins to fix
                                src/server/routes/revision.js on lines 62..65
                                src/server/routes/revision.js on lines 72..75
                                src/server/routes/revision.js on lines 110..113
                                src/server/routes/revision.js on lines 115..118
                                src/server/routes/revision.js on lines 135..138
                                src/server/routes/revision.js on lines 149..152
                                src/server/routes/revision.js on lines 163..166
                                src/server/routes/revision.js on lines 172..175

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

                                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 9 locations. Consider refactoring.
                                Open

                                    if (_.isEqual(change.path, ['editionStatus']) ||
                                            _.isEqual(change.path, ['editionStatus', 'label'])) {
                                        return baseFormatter.formatTypeChange(change, 'Edition Status');
                                    }
                                Severity: Major
                                Found in src/server/routes/revision.js and 8 other locations - About 55 mins to fix
                                src/server/routes/revision.js on lines 62..65
                                src/server/routes/revision.js on lines 67..70
                                src/server/routes/revision.js on lines 72..75
                                src/server/routes/revision.js on lines 110..113
                                src/server/routes/revision.js on lines 135..138
                                src/server/routes/revision.js on lines 149..152
                                src/server/routes/revision.js on lines 163..166
                                src/server/routes/revision.js on lines 172..175

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

                                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 9 locations. Consider refactoring.
                                Open

                                    if (_.isEqual(change.path, ['workType']) ||
                                            _.isEqual(change.path, ['workType', 'label'])) {
                                        return baseFormatter.formatTypeChange(change, 'Work Type');
                                    }
                                Severity: Major
                                Found in src/server/routes/revision.js and 8 other locations - About 55 mins to fix
                                src/server/routes/revision.js on lines 62..65
                                src/server/routes/revision.js on lines 67..70
                                src/server/routes/revision.js on lines 72..75
                                src/server/routes/revision.js on lines 110..113
                                src/server/routes/revision.js on lines 115..118
                                src/server/routes/revision.js on lines 135..138
                                src/server/routes/revision.js on lines 149..152
                                src/server/routes/revision.js on lines 172..175

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

                                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 9 locations. Consider refactoring.
                                Open

                                    if (_.isEqual(change.path, ['editionGroupType']) ||
                                            _.isEqual(change.path, ['editionGroupType', 'label'])) {
                                        return baseFormatter.formatTypeChange(change, 'Edition Group Type');
                                    }
                                Severity: Major
                                Found in src/server/routes/revision.js and 8 other locations - About 55 mins to fix
                                src/server/routes/revision.js on lines 62..65
                                src/server/routes/revision.js on lines 67..70
                                src/server/routes/revision.js on lines 72..75
                                src/server/routes/revision.js on lines 110..113
                                src/server/routes/revision.js on lines 115..118
                                src/server/routes/revision.js on lines 135..138
                                src/server/routes/revision.js on lines 149..152
                                src/server/routes/revision.js on lines 163..166

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

                                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 9 locations. Consider refactoring.
                                Open

                                    if (_.isEqual(change.path, ['publisherType']) ||
                                            _.isEqual(change.path, ['publisherType', 'label'])) {
                                        return baseFormatter.formatTypeChange(change, 'Publisher Type');
                                    }
                                Severity: Major
                                Found in src/server/routes/revision.js and 8 other locations - About 55 mins to fix
                                src/server/routes/revision.js on lines 62..65
                                src/server/routes/revision.js on lines 67..70
                                src/server/routes/revision.js on lines 72..75
                                src/server/routes/revision.js on lines 110..113
                                src/server/routes/revision.js on lines 115..118
                                src/server/routes/revision.js on lines 149..152
                                src/server/routes/revision.js on lines 163..166
                                src/server/routes/revision.js on lines 172..175

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

                                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

                                There are no issues that match your filters.

                                Category
                                Status