lowdefy/lowdefy

View on GitHub

Showing 9,046 of 9,127 total issues

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/Selector/Selector.js on lines 112..118

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

Function parse has 48 lines of code (exceeds 25 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 1 hr to fix

    Function link has 48 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      function link(props) {
        if (props.disabled === true) {
          return disabledLink(props);
        }
        if (
    Severity: Minor
    Found in packages/engine/src/createLink.js - About 1 hr to fix

      Function parse has 47 lines of code (exceeds 25 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/buildParser.js - About 1 hr to fix

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

          constructor(props) {
            super(props);
            this.triggerEvent = this.triggerEvent.bind(this);
            // TODO: Test events.
            this.allEvents = {
        Severity: Minor
        Found in packages/plugins/blocks/blocks-echarts/src/blocks/EChart/EChart.js - About 1 hr to fix

          Function reset has 44 lines of code (exceeds 25 allowed). Consider refactoring.
          Confirmed

            reset(initWithState) {
              const initState = serializer.copy(initWithState || this.context.state);
              this.loopBlocks((block) => {
                block.update = true;
                block.showValidation = false;
          Severity: Minor
          Found in packages/engine/src/Blocks.js - About 1 hr to fix

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

            const mediaToCssObject = (styles, styleObjectOnly) => {
              if (type.isString(styles)) {
                return styles.replace(mediaRegex, setReplacer);
              }
              let styleObjects = styles;
            Severity: Minor
            Found in packages/utils/block-utils/src/mediaToCssObject.js - About 1 hr to fix

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

                if (!res.ok) {
                  // TODO: check
                  const body = await res.json();
                  console.log(res);
                  console.log(body);
              Severity: Major
              Found in packages/client/src/request.js and 1 other location - About 1 hr to fix
              packages/servers/server-dev/lib/client/utils/request.js on lines 28..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 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

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

                if (!meta[methodName] && !functions[methodName]) {
                  throw new Error(
                    `Operator Error: ${operator}.${methodName} is not supported, use one of the following: ${Object.keys(
                      meta
                    ).join(', ')}.
              Severity: Major
              Found in packages/operators/src/runClass.js and 1 other location - About 1 hr to fix
              packages/operators/src/runInstance.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 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

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

                if (!res.ok) {
                  // TODO: check
                  const body = await res.json();
                  console.log(res);
                  console.log(body);
              Severity: Major
              Found in packages/servers/server-dev/lib/client/utils/request.js and 1 other location - About 1 hr to fix
              packages/client/src/request.js on lines 25..31

              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

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

                if (!meta[methodName]) {
                  throw new Error(
                    `Operator Error: ${operator}.${methodName} is not supported, use one of the following: ${Object.keys(
                      meta
                    ).join(', ')}.
              Severity: Major
              Found in packages/operators/src/runInstance.js and 1 other location - About 1 hr to fix
              packages/operators/src/runClass.js on lines 34..41

              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 content has 41 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      content: () => {
                        const runAfterUpdate = useRunAfterUpdate();
                        return (
                          <TextAreaComp
                            id={`${blockId}_input`}
              Severity: Minor
              Found in packages/plugins/blocks/blocks-antd/src/blocks/TextArea/TextArea.js - About 1 hr to fix

                Function setupLink has 40 lines of code (exceeds 25 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 1 hr to fix

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

                  function getAuthOptions({ logger }) {
                    return getNextAuthConfig({
                      authJson,
                      logger,
                      plugins: { adapters, callbacks, events, providers },
                  packages/servers/server-dev/lib/server/auth/getAuthOptions.js on lines 26..33

                  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

                  function getAuthOptions({ logger }) {
                    return getNextAuthConfig({
                      authJson,
                      logger,
                      plugins: { adapters, callbacks, events, providers },
                  packages/servers/server-enterprise/lib/server/auth/getAuthOptions.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 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

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

                  const ParagraphInput = ({
                    blockId,
                    components: { Icon },
                    events,
                    loading,

                  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 getCallbackUrl has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                  Confirmed

                  function getCallbackUrl({ lowdefy, callbackUrl = {} }) {
                    const { home, pageId, urlQuery, url } = callbackUrl;
                  
                    if ([!home, !pageId, !url].filter((v) => !v).length > 1) {
                      throw Error(
                  Severity: Minor
                  Found in packages/client/src/auth/createAuthMethods.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

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

                  function set(target, path, value, options) {
                    if (!type.isObject(target)) {
                      return target;
                    }
                  
                  
                  Severity: Minor
                  Found in packages/utils/helpers/src/set.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

                  Function fetchNpmTarball has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                  Confirmed

                  async function fetchNpmTarball({ packageName, version, directory }) {
                    const registryUrl = `https://registry.npmjs.org/${packageName}`;
                    let packageInfo;
                    try {
                      packageInfo = await axios.get(registryUrl);
                  Severity: Minor
                  Found in packages/cli/src/utils/fetchNpmTarball.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

                  Function reviver has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                  Confirmed

                      const reviver = (_, value) => {
                        if (!type.isObject(value)) return value;
                        // TODO: pass ~k in errors.
                        // const _k = value['~k'];
                        delete value['~k'];
                  Severity: Minor
                  Found in packages/operators/src/webParser.js - About 1 hr to fix
                    Severity
                    Category
                    Status
                    Source
                    Language