dopry/netlify-cms

View on GitHub

Showing 220 of 220 total issues

Avoid too many return statements within this function.
Open

      return createBlock(typeMap[type], { isVoid: true });
Severity: Major
Found in src/components/Widgets/Markdown/serializers/remarkSlate.js - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

          return u(typeMap[node.type], { url, title }, children);
    Severity: Major
    Found in src/components/Widgets/Markdown/serializers/slateRemark.js - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

            return state.withMutations((map) => {
              map.set('isFetching', false);
              map.set('term', searchTerm);
              map.set('queryHits', Map({ [action.payload.namespace]: response.hits }));
            });
      Severity: Major
      Found in src/reducers/search.js - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

          if (idxA < idxB) return -1;
        Severity: Major
        Found in src/formats/yaml.js - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                return createText(convertMarkNode(node));
          Severity: Major
          Found in src/components/Widgets/Markdown/serializers/remarkSlate.js - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                  return createBlock(typeMap[type], nodes, { data });
            Severity: Major
            Found in src/components/Widgets/Markdown/serializers/remarkSlate.js - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                    return createBlock(slateType, nodes, { data });
              Severity: Major
              Found in src/components/Widgets/Markdown/serializers/remarkSlate.js - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                      return createInline(typeMap[type], nodes, { data });
                Severity: Major
                Found in src/components/Widgets/Markdown/serializers/remarkSlate.js - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                        return state;
                  Severity: Major
                  Found in src/reducers/search.js - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                        return { widget: 'checkbox' };
                    Severity: Major
                    Found in scripts/autoconfigure.collection.js - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                            return createBlock(typeMap[type], nodes, { data });
                      Severity: Major
                      Found in src/components/Widgets/Markdown/serializers/remarkSlate.js - About 30 mins to fix

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

                                map.setIn(['entities', `${ action.payload.collection }.${ action.payload.slug }`, 'isPersisting'], true);
                        Severity: Minor
                        Found in src/reducers/editorialWorkflow.js and 1 other location - About 30 mins to fix
                        src/reducers/entries.js on lines 53..53

                        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

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

                                map.setIn(['entities', `${ action.payload.collection }.${ action.payload.slug }`, 'isFetching'], false);
                        Severity: Minor
                        Found in src/reducers/entries.js and 1 other location - About 30 mins to fix
                        src/reducers/editorialWorkflow.js on lines 68..68

                        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

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

                          authorizeCallback(options, cb) {
                            const fn = (e) => {
                              var data, err;
                              if (e.origin !== this.base_url) { return; }
                              if (e.data.indexOf('authorization:' + options.provider + ':success:') === 0) {
                        Severity: Minor
                        Found in src/lib/netlify-auth.js - About 25 mins to fix

                        Cognitive Complexity

                        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                        A method's cognitive complexity is based on a few simple rules:

                        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                        • Code is considered more complex for each "break in the linear flow of the code"
                        • Code is considered more complex when "flow breaking structures are nested"

                        Further reading

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

                          entriesByFolder(collection, extension) {
                            const entries = [];
                            const folder = collection.get('folder');
                            if (folder) {
                              for (const path in window.repoFiles[folder]) {
                        Severity: Minor
                        Found in src/backends/test-repo/implementation.js - About 25 mins to fix

                        Cognitive Complexity

                        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                        A method's cognitive complexity is based on a few simple rules:

                        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                        • Code is considered more complex for each "break in the linear flow of the code"
                        • Code is considered more complex when "flow breaking structures are nested"

                        Further reading

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

                          validatePresence(field, value) {
                            const isRequired = field.get('required', true);
                            if (isRequired && (
                              value === null ||
                              value === undefined ||
                        Severity: Minor
                        Found in src/components/Widgets/ControlHOC.js - About 25 mins to fix

                        Cognitive Complexity

                        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                        A method's cognitive complexity is based on a few simple rules:

                        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                        • Code is considered more complex for each "break in the linear flow of the code"
                        • Code is considered more complex when "flow breaking structures are nested"

                        Further reading

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

                        export default function remarkEscapeMarkdownEntities() {
                          /**
                           * Escape all occurrences of '[', '*', '_', '`', and '~'.
                           */
                          function escapeCommonChars(text) {

                        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 basename has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                        Open

                        export function basename(p, ext = "") {
                          // Special case: Normalize will modify this to '.'
                          if (p === '') {
                            return p;
                          }
                        Severity: Minor
                        Found in src/lib/pathHelper.js - About 25 mins to fix

                        Cognitive Complexity

                        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                        A method's cognitive complexity is based on a few simple rules:

                        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                        • Code is considered more complex for each "break in the linear flow of the code"
                        • Code is considered more complex when "flow breaking structures are nested"

                        Further reading

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

                          componentWillReceiveProps(nextProps) {
                            if (this.didInitialSearch) return;
                            if (nextProps.queryHits !== this.props.queryHits && nextProps.queryHits.get && nextProps.queryHits.get(this.controlID)) {
                              this.didInitialSearch = true;
                              const suggestion = nextProps.queryHits.get(this.controlID);
                        Severity: Minor
                        Found in src/components/Widgets/RelationControl.js - About 25 mins to fix

                        Cognitive Complexity

                        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                        A method's cognitive complexity is based on a few simple rules:

                        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                        • Code is considered more complex for each "break in the linear flow of the code"
                        • Code is considered more complex when "flow breaking structures are nested"

                        Further reading

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

                          persistEntry(config, collection, entryDraft, MediaFiles, options) {
                            const newEntry = entryDraft.getIn(["entry", "newRecord"]) || false;
                        
                            const parsedData = {
                              title: entryDraft.getIn(["entry", "data", "title"], "No Title"),
                        Severity: Minor
                        Found in src/backends/backend.js - About 25 mins to fix

                        Cognitive Complexity

                        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                        A method's cognitive complexity is based on a few simple rules:

                        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                        • Code is considered more complex for each "break in the linear flow of the code"
                        • Code is considered more complex when "flow breaking structures are nested"

                        Further reading

                        Severity
                        Category
                        Status
                        Source
                        Language