lowdefy/lowdefy

View on GitHub

Showing 9,042 of 9,129 total issues

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

async function handler({ req, res }) {
  if (req.method !== 'GET') {
    throw new Error('Only GET requests are supported.');
  }

Severity: Major
Found in packages/servers/server-enterprise/pages/api/license.js and 1 other location - About 3 hrs to fix
packages/servers/server-dev/pages/api/license.js on lines 13..20

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

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

            onChange={(event) => {
              methods.setValue(
                type.isPrimitive(uniqueValueOptions[event.target.value])
                  ? uniqueValueOptions[event.target.value]
                  : uniqueValueOptions[event.target.value].value
packages/plugins/blocks/blocks-antd/src/blocks/ButtonSelector/ButtonSelector.js on lines 63..70

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

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

async function handler({ req, res }) {
  if (req.method !== 'GET') {
    throw new Error('Only GET requests are supported.');
  }

Severity: Major
Found in packages/servers/server-dev/pages/api/license.js and 1 other location - About 3 hrs to fix
packages/servers/server-enterprise/pages/api/license.js on lines 13..20

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

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

            onChange={(event) => {
              methods.setValue(
                type.isPrimitive(uniqueValueOptions[event.target.value])
                  ? uniqueValueOptions[event.target.value]
                  : uniqueValueOptions[event.target.value].value
packages/plugins/blocks/blocks-antd/src/blocks/RadioSelector/RadioSelector.js on lines 64..71

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

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

    const context = {
      // Important to give absolute path so Next can trace build files
      rid: crypto.randomUUID(),
      buildDirectory: path.join(process.cwd(), 'build'),
      config,
packages/servers/server-enterprise/lib/server/serverSidePropsWrapper.js on lines 26..37

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

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

    const context = {
      // Important to give absolute path so Next can trace build files
      rid: crypto.randomUUID(),
      buildDirectory: path.join(process.cwd(), 'build'),
      config,
packages/servers/server-community/lib/server/serverSidePropsWrapper.js on lines 29..40

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

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 triggerEvent has 70 lines of code (exceeds 25 allowed). Consider refactoring.
Confirmed

  triggerEvent({ name, event, progress }) {
    this.context._internal.lowdefy.eventCallback?.({ name, blockId: this.block.blockId });
    const eventDescription = this.events[name];
    const result = {
      blockId: this.block.blockId,
Severity: Major
Found in packages/engine/src/Events.js - About 2 hrs to fix

    Function runInstance has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
    Confirmed

    const runInstance = ({ location, meta, methodName, operator, params, instanceType }) => {
      if (!meta[methodName]) {
        throw new Error(
          `Operator Error: ${operator}.${methodName} is not supported, use one of the following: ${Object.keys(
            meta
    Severity: Minor
    Found in packages/operators/src/runInstance.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 kindOf has 65 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function kindOf(val) {
      // eslint-disable-next-line no-void
      if (val === void 0) return 'undefined';
      if (val === null) return 'null';
    
    
    Severity: Major
    Found in packages/utils/helpers/src/type.js - About 2 hrs to fix

      Function PageSiderMenu has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
      Confirmed

      const PageSiderMenu = ({
        basePath,
        blockId,
        components: { Icon, Link },
        events,

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

      const AgGridInput = ({ properties, methods, loading, events, value }) => {
        const { quickFilterValue, columnDefs, defaultColDef, ...someProperties } = properties;
        const [rowData, setRowData] = useState(value ?? []);
      
        const gridRef = useRef();
      Severity: Minor
      Found in packages/plugins/blocks/blocks-aggrid/src/AgGridInput.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 19 (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/buildParser.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 DateTimeSelector has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
      Open

      const DateTimeSelector = ({
        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 kindOf has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
      Open

      function kindOf(val) {
        // eslint-disable-next-line no-void
        if (val === void 0) return 'undefined';
        if (val === null) return 'null';
      
      
      Severity: Minor
      Found in packages/utils/helpers/src/type.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 enforceType has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
      Open

      function enforceType(typeName, value) {
        switch (typeName) {
          case 'string':
            return type.isString(value) && value !== '' ? value : null;
          case 'number':
      Severity: Minor
      Found in packages/utils/helpers/src/type.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 60 lines of code (exceeds 25 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: Major
      Found in packages/operators/src/webParser.js - About 2 hrs to fix

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

          useEffect(() => {
            methods.setValue({ file: null, fileList: [] });
            methods.registerEvent({
              name: '__getS3PostPolicy',
              actions: [
        packages/plugins/plugins/plugin-aws/src/blocks/S3UploadButton/S3UploadButton.js on lines 33..45

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

        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

          useEffect(() => {
            methods.setValue({ file: null, fileList: [] });
            methods.registerEvent({
              name: '__getS3PostPolicy',
              actions: [
        packages/plugins/plugins/plugin-aws/src/blocks/S3UploadPhoto/S3UploadPhoto.js on lines 34..46

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

        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 buildEvents has 59 lines of code (exceeds 25 allowed). Consider refactoring.
        Confirmed

        function buildEvents(block, pageContext) {
          if (block.events) {
            Object.keys(block.events).map((key) => {
              if (
                (!type.isArray(block.events[key]) && !type.isObject(block.events[key])) ||
        Severity: Major
        Found in packages/build/src/build/buildPages/buildBlock/buildEvents.js - About 2 hrs to fix

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

              <BlockLayout
                blockStyle={skeleton.style ?? blockStyle}
                highlightBorders={lowdefy.lowdefyGlobal.highlightBorders}
                id={`s-bl-${blockId}-${skeleton.id}`}
                layout={skeleton.layout ?? blockLayout}
          Severity: Major
          Found in packages/client/src/block/LoadingContainer.js and 2 other locations - About 2 hrs to fix
          packages/client/src/block/LoadingBlock.js on lines 85..102
          packages/client/src/block/LoadingList.js on lines 65..82

          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

          Severity
          Category
          Status
          Source
          Language