dopry/netlify-cms

View on GitHub

Showing 110 of 220 total issues

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

        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