lowdefy/lowdefy

View on GitHub

Showing 9,046 of 9,127 total issues

Identical blocks of code found in 11 locations. Consider refactoring.
Confirmed

Object.keys(blocks).forEach((block) => {
  icons[block] = blocks[block].meta.icons ?? [];
  styles[block] = blocks[block].meta.styles ?? [];
});
Severity: Major
Found in packages/plugins/blocks/blocks-markdown/src/types.js and 10 other locations - About 2 hrs to fix
packages/plugins/blocks/blocks-aggrid/src/types.js on lines 22..25
packages/plugins/blocks/blocks-algolia/src/types.js on lines 22..25
packages/plugins/blocks/blocks-google-maps/src/types.js on lines 22..25
packages/plugins/blocks/blocks-qr/src/types.js on lines 22..25
packages/plugins/blocks/blocks-antd/src/types.js on lines 22..25
packages/plugins/blocks/blocks-basic/src/types.js on lines 22..25
packages/plugins/blocks/blocks-color-selectors/src/types.js on lines 22..25
packages/plugins/blocks/blocks-echarts/src/types.js on lines 22..25
packages/plugins/blocks/blocks-loaders/src/types.js on lines 22..25
packages/plugins/plugins/plugin-aws/src/types.js on lines 23..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 81.

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

  parse({ args, input, location, operatorPrefix = '_' }) {
    if (type.isUndefined(input)) {
      return { output: input, errors: [] };
    }
    if (args && !type.isArray(args)) {
Severity: Minor
Found in packages/operators/src/serverParser.js - About 2 hrs 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 labelLogic has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

const labelLogic = ({
  blockId,
  content,
  methods,
  properties = {},
Severity: Minor
Found in packages/plugins/blocks/blocks-antd/src/blocks/Label/labelLogic.js - About 2 hrs 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 AgGrid has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Confirmed

const AgGrid = ({ properties, methods, loading, events }) => {
  const {
    quickFilterValue,
    columnDefs,
    defaultColDef,
Severity: Minor
Found in packages/plugins/blocks/blocks-aggrid/src/AgGrid.js - About 2 hrs 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 stubBlockProps has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

const stubBlockProps = ({ block, meta, logger = () => null, initialValue, schema }) => {
  const [value, setState] = useState(type.enforceType(meta.valueType, block.value || initialValue));
  const setValue = (val) => {
    setState(type.enforceType(meta.valueType, val));
  };
Severity: Minor
Found in packages/utils/block-dev/src/stubBlockProps.js - About 2 hrs 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 getter has 55 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function getter(target, path, options) {
  if (typeTest.isNone(path) || !isValidObject(target)) {
    return typeof options.default !== 'undefined' ? options.default : undefined;
  }

Severity: Major
Found in packages/utils/helpers/src/get.js - About 2 hrs to fix

    Function stableStringify has 55 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function stableStringify(obj, opts) {
      if (!opts) opts = {};
      if (typeof opts === 'function') opts = { cmp: opts };
      let space = opts.space || '';
      if (typeof space === 'number') space = Array(space + 1).join(' ');
    Severity: Major
    Found in packages/utils/helpers/src/stableStringify.js - About 2 hrs to fix

      Function createIcon has 53 lines of code (exceeds 25 allowed). Consider refactoring.
      Confirmed

      const createIcon = (Icons) => {
        const AiOutlineLoading3Quarters = Icons['AiOutlineLoading3Quarters'];
        const AiOutlineExclamationCircle = Icons['AiOutlineExclamationCircle'];
      
        const IconBlock = ({ blockId, events, methods, onClick, properties, ...props }) => {
      Severity: Major
      Found in packages/client/src/createIcon.js - About 2 hrs to fix

        Function makeReplacer has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
        Open

        const makeReplacer = (customReplacer, isoStringDates) => (key, value) => {
          let dateReplacer = (date) => ({ '~d': date.valueOf() });
          if (isoStringDates) {
            dateReplacer = (date) => ({ '~d': date.toISOString() });
          }
        Severity: Minor
        Found in packages/utils/helpers/src/serializer.js - About 2 hrs 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 parse has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
        Confirmed

          parse({ actions, args, arrayIndices, event, input, location, operatorPrefix = '_' }) {
            if (type.isUndefined(input)) {
              return { output: input, errors: [] };
            }
            if (event && !type.isObject(event)) {
        Severity: Minor
        Found in packages/operators/src/webParser.js - About 2 hrs 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 setupLink has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
        Confirmed

        function setupLink(lowdefy) {
          const { router } = lowdefy._internal;
          const { window } = lowdefy._internal.globals;
          const backLink = () => router.back();
          const disabledLink = () => {};
        Severity: Minor
        Found in packages/client/src/setupLink.js - About 2 hrs 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 getFromArray has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
        Confirmed

        function getFromArray({ params, array, key, operator, location }) {
          if (params === true) return array;
          if (type.isString(params)) {
            return array.find((item) => item[key] === params);
          }
        Severity: Minor
        Found in packages/operators/src/getFromArray.js - About 2 hrs 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 validateAuthConfig has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
        Confirmed

        async function validateAuthConfig({ components }) {
          if (type.isNone(components.auth)) {
            components.auth = {};
          }
          if (!type.isObject(components.auth)) {
        Severity: Minor
        Found in packages/build/src/build/buildAuth/validateAuthConfig.js - About 2 hrs 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 refReviver has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
        Confirmed

        function refReviver(key, value) {
          if (type.isObject(value)) {
            if (!type.isUndefined(value._ref)) {
              return this.parsedFiles[value._ref.id];
            }
        Severity: Minor
        Found in packages/build/src/build/buildRefs/populateRefs.js - About 2 hrs 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 callActions has 52 lines of code (exceeds 25 allowed). Consider refactoring.
        Confirmed

          async callActions({ actions, arrayIndices, block, catchActions, event, eventName, progress }) {
            const startTimestamp = new Date();
            const responses = {};
            try {
              await this.callActionLoop({ actions, arrayIndices, block, event, responses, progress });
        Severity: Major
        Found in packages/engine/src/Actions.js - About 2 hrs to fix

          Function makeReplacer has 51 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          const makeReplacer = (customReplacer, isoStringDates) => (key, value) => {
            let dateReplacer = (date) => ({ '~d': date.valueOf() });
            if (isoStringDates) {
              dateReplacer = (date) => ({ '~d': date.toISOString() });
            }
          Severity: Major
          Found in packages/utils/helpers/src/serializer.js - About 2 hrs to fix

            File Menu.js has 251 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            /*
              Copyright 2020-2024 Lowdefy, Inc
            
              Licensed under the Apache License, Version 2.0 (the "License");
              you may not use this file except in compliance with the License.
            Severity: Minor
            Found in packages/plugins/blocks/blocks-antd/src/blocks/Menu/Menu.js - About 2 hrs to fix

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

                if (home.configured === false) {
                  logger.info({ event: 'redirect_to_homepage', pageId: home.pageId });
                  return {
                    redirect: {
                      destination: `/${home.pageId}`,
              Severity: Major
              Found in packages/servers/server-enterprise/pages/index.js and 1 other location - About 1 hr to fix
              packages/servers/server-community/pages/index.js on lines 26..34

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

              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

                if (home.configured === false) {
                  logger.info({ event: 'redirect_to_homepage', pageId: home.pageId });
                  return {
                    redirect: {
                      destination: `/${home.pageId}`,
              Severity: Major
              Found in packages/servers/server-community/pages/index.js and 1 other location - About 1 hr to fix
              packages/servers/server-enterprise/pages/index.js on lines 20..28

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

              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

                            onSearch={async (value) => {
                              setFetch(true);
                              const result = await methods.triggerEvent({ name: 'onSearch', event: { value } });
                              if (!result.bounced) {
                                setFetch(false);
              packages/plugins/blocks/blocks-antd/src/blocks/MultipleSelector/MultipleSelector.js on lines 149..155

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

              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