lowdefy/lowdefy

View on GitHub

Showing 9,449 of 9,537 total issues

Function unset has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

const unset = (obj, prop) => {
  // support array refence in the form a.0 , a.0.b or a[0] , a[0].b
  if (!type.isObject(obj)) {
    throw new TypeError('expected an object.');
  }
Severity: Minor
Found in packages/utils/helpers/src/unset.js - About 45 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 createPluginTypesMap has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Confirmed

function createPluginTypesMap({ packageName, packageTypes, typePrefix = '', typesMap, version }) {
  createTypeDefinitions({
    typeNames: packageTypes.actions,
    store: typesMap.actions,
    packageName,
Severity: Minor
Found in packages/build/src/utils/createPluginTypesMap.js - About 45 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 parseRefContent has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

function parseRefContent({ content, refDef }) {
  const { path, vars } = refDef;
  if (type.isString(path)) {
    let ext = getFileExtension(path);
    if (ext === 'njk') {
Severity: Minor
Found in packages/build/src/build/buildRefs/parseRefContent.js - About 45 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

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

const config = {
  dev: {
    accountId: 'bf35f4ae-53a8-45c6-9eed-2d1fc9f53bd6',
    productId: '4254760d-e760-4932-bb96-ba767e6ae780',
    publicKey: 'MCowBQYDK2VwAyEAN27y1DiHiEDYFbNGjgfFdWygxrVSetq6rApWq3psJZI=',
Severity: Minor
Found in packages/servers/server-dev/lib/server/validateLicense.js and 1 other location - About 45 mins to fix
packages/servers/server-enterprise/lib/server/validateLicense.js on lines 12..23

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

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 config = {
  dev: {
    accountId: 'bf35f4ae-53a8-45c6-9eed-2d1fc9f53bd6',
    productId: '4254760d-e760-4932-bb96-ba767e6ae780',
    publicKey: 'MCowBQYDK2VwAyEAN27y1DiHiEDYFbNGjgfFdWygxrVSetq6rApWq3psJZI=',
packages/servers/server-dev/lib/server/validateLicense.js on lines 12..23

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

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

      className={methods.makeCssClass([
        properties.color && { color: `${properties.color} !important` },
        properties.style,
      ])}
Severity: Minor
Found in packages/plugins/blocks/blocks-antd/src/blocks/Title/Title.js and 1 other location - About 40 mins to fix
packages/plugins/blocks/blocks-antd/src/blocks/TitleInput/TitleInput.js on lines 56..59

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

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

      className={methods.makeCssClass([
        properties.color && { color: `${properties.color} !important` },
        properties.style,
      ])}
packages/plugins/blocks/blocks-antd/src/blocks/Title/Title.js on lines 28..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 49.

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

Consider simplifying this complex logical expression.
Open

  if (properties.autoBounds !== false && bounds && map) {
    if (properties.infoWindow) {
      bounds.extend(properties.infoWindow.position ?? MAP_DEFAULTS.center);
    }
    (properties.markers ?? []).forEach((marker) => {
Severity: Major
Found in packages/plugins/blocks/blocks-google-maps/src/blocks/Map.js - About 40 mins to fix

    Function createLicenseRedirectCallback has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

    function createLicenseRedirectCallback(context, license) {
      async function licenseRedirectCallback({ url, baseUrl }) {
        if (license.code !== 'VALID') {
          const code = ['NO_LICENSE', 'EXPIRED'].includes(license.code) ? license.code : 'INVALID';
          return `/lowdefy/license-invalid?code=${code}`;

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

    const getIndex = (value, options, key = 'value') => {
      // eslint-disable-next-line no-plusplus
      for (let i = 0; i < options.length; i++) {
        if (type.isPrimitive(options[i]) && options[i] === value) {
          return `${i}`;
    Severity: Minor
    Found in packages/plugins/blocks/blocks-antd/src/getValueIndex.js - About 35 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 triggerEvent has a Cognitive Complexity of 7 (exceeds 5 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: Minor
    Found in packages/engine/src/Events.js - About 35 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 getFileFromNavigator has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

    const getFileFromNavigator = async () => {
      const items = await navigator.clipboard.read();
      for (const item of items) {
        for (const type of item.types) {
          if (type === 'image/png' || type === 'image/jpeg') {
    Severity: Minor
    Found in packages/plugins/plugins/plugin-aws/src/blocks/utils/getOnPaste.js - About 35 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 ParagraphBlock has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

    const ParagraphBlock = ({ blockId, components: { Icon }, events, methods, properties }) => (
      <Paragraph
        id={blockId}
        className={methods.makeCssClass(properties.style)}
        code={properties.code}
    Severity: Minor
    Found in packages/plugins/blocks/blocks-antd/src/blocks/Paragraph/Paragraph.js - About 35 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 DownloadCsv has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

    async function DownloadCsv({ params }) {
      const { filename, data, fields: flds } = params;
      if (!Array.isArray(data) || typeof data[0] !== 'object') {
        throw new Error('csvMake data takes an array of objects');
      }
    Severity: Minor
    Found in packages/plugins/plugins/plugin-csv/src/actions/DownloadCsv.js - About 35 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 getSaturation has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

    const getSaturation = (hsv, i, isLight) => {
      let saturation;
      if (isLight) {
        saturation = hsv.s - saturationStep * i;
      } else if (i === darkColorCount) {
    Severity: Minor
    Found in packages/plugins/blocks/blocks-antd/src/color.js - About 35 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 disabledDate has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

    const disabledDate = (disabledDates = {}) => {
      const min = type.isNone(disabledDates.min)
        ? undefined
        : moment(disabledDates.min).utc().startOf('day');
      const max = type.isNone(disabledDates.max)
    Severity: Minor
    Found in packages/plugins/blocks/blocks-antd/src/disabledDate.js - About 35 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 TitleBlock has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

    const TitleBlock = ({ blockId, components: { Icon }, events, properties, methods }) => {
      return (
        <Title
          id={blockId}
          className={methods.makeCssClass([
    Severity: Minor
    Found in packages/plugins/blocks/blocks-antd/src/blocks/Title/Title.js - About 35 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 MenuComp has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

    const MenuComp = ({
      blockId,
      components: { Icon, Link },
      events,
      menus,
    Severity: Minor
    Found in packages/plugins/blocks/blocks-antd/src/blocks/Menu/Menu.js - About 35 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 ButtonBlock has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

    const ButtonBlock = ({
      blockId,
      components: { Icon },
      events,
      loading,
    Severity: Minor
    Found in packages/plugins/blocks/blocks-antd/src/blocks/Button/Button.js - About 35 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 CheckboxSelector has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

    const CheckboxSelector = ({
      blockId,
      components,
      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

    Severity
    Category
    Status
    Source
    Language