lowdefy/lowdefy

View on GitHub

Showing 199 of 9,537 total issues

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

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

    const ButtonSelector = ({
      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

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

    const RadioSelector = ({
      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

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

    const TagBlock = ({
      blockId,
      components: { Icon },
      events,
      methods,
    Severity: Minor
    Found in packages/plugins/blocks/blocks-antd/src/blocks/Tag/Tag.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 render has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

      render() {
        const { children, description, fallback, fullPage, message, name } = this.props;
        const { hasError, error } = this.state;
        if (hasError) {
          if (fallback) {
    Severity: Minor
    Found in packages/utils/block-utils/src/ErrorBoundary.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 Label has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Confirmed

    const Label = ({
      blockId,
      components: { Icon },
      content,
      methods,
    Severity: Minor
    Found in packages/plugins/blocks/blocks-antd/src/blocks/Label/Label.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 layoutParamsToArea has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Confirmed

    const layoutParamsToArea = ({ areaKey, area = {}, layout = {} }) => {
      if (areaKey !== 'content') {
        return area;
      }
      area.align = type.isNone(area.align) ? layout.contentAlign : area.align;
    Severity: Minor
    Found in packages/layout/src/layoutParamsToArea.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 formatArrayKey has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Confirmed

    function formatArrayKey({ index, object }) {
      if (type.isObject(object) && (!type.isNone(object.id) || !type.isNone(object.type))) {
        const objectId = type.isNone(object.id) ? '_ERROR_MISSING_ID_' : object.id;
        const objectType = type.isNone(object.type) ? '_ERROR_MISSING_TYPE_' : object.type;
        return `[${index}:${objectId}:${objectType}]`;
    Severity: Minor
    Found in packages/build/src/utils/formatErrorMessage.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

    Severity
    Category
    Status
    Source
    Language