lowdefy/lowdefy

View on GitHub

Showing 9,449 of 9,537 total issues

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

              suffixIcon={
                <Icon
                  blockId={`${blockId}_suffixIcon`}
                  events={events}
                  properties={properties.suffixIcon ?? 'AiOutlineCalendar'}
packages/plugins/blocks/blocks-antd/src/blocks/DateRangeSelector/DateRangeSelector.js on lines 77..83
packages/plugins/blocks/blocks-antd/src/blocks/DateSelector/DateSelector.js on lines 63..69
packages/plugins/blocks/blocks-antd/src/blocks/MonthSelector/MonthSelector.js on lines 66..72
packages/plugins/blocks/blocks-antd/src/blocks/WeekSelector/WeekSelector.js on lines 65..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 51.

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 5 locations. Consider refactoring.
Open

              suffixIcon={
                <Icon
                  blockId={`${blockId}_suffixIcon`}
                  events={events}
                  properties={properties.suffixIcon ?? 'AiOutlineCalendar'}
packages/plugins/blocks/blocks-antd/src/blocks/DateSelector/DateSelector.js on lines 63..69
packages/plugins/blocks/blocks-antd/src/blocks/DateTimeSelector/DateTimeSelector.js on lines 83..89
packages/plugins/blocks/blocks-antd/src/blocks/MonthSelector/MonthSelector.js on lines 66..72
packages/plugins/blocks/blocks-antd/src/blocks/WeekSelector/WeekSelector.js on lines 65..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 51.

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 5 locations. Consider refactoring.
Open

              suffixIcon={
                <Icon
                  blockId={`${blockId}_suffixIcon`}
                  events={events}
                  properties={properties.suffixIcon ?? 'AiOutlineCalendar'}
packages/plugins/blocks/blocks-antd/src/blocks/DateRangeSelector/DateRangeSelector.js on lines 77..83
packages/plugins/blocks/blocks-antd/src/blocks/DateTimeSelector/DateTimeSelector.js on lines 83..89
packages/plugins/blocks/blocks-antd/src/blocks/MonthSelector/MonthSelector.js on lines 66..72
packages/plugins/blocks/blocks-antd/src/blocks/WeekSelector/WeekSelector.js on lines 65..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 51.

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 5 locations. Consider refactoring.
Open

              suffixIcon={
                <Icon
                  blockId={`${blockId}_suffixIcon`}
                  events={events}
                  properties={properties.suffixIcon ?? 'AiOutlineCalendar'}
packages/plugins/blocks/blocks-antd/src/blocks/DateRangeSelector/DateRangeSelector.js on lines 77..83
packages/plugins/blocks/blocks-antd/src/blocks/DateSelector/DateSelector.js on lines 63..69
packages/plugins/blocks/blocks-antd/src/blocks/DateTimeSelector/DateTimeSelector.js on lines 83..89
packages/plugins/blocks/blocks-antd/src/blocks/MonthSelector/MonthSelector.js on lines 66..72

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

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 5 locations. Consider refactoring.
Open

              suffixIcon={
                <Icon
                  blockId={`${blockId}_suffixIcon`}
                  events={events}
                  properties={properties.suffixIcon ?? 'AiOutlineCalendar'}
packages/plugins/blocks/blocks-antd/src/blocks/DateRangeSelector/DateRangeSelector.js on lines 77..83
packages/plugins/blocks/blocks-antd/src/blocks/DateSelector/DateSelector.js on lines 63..69
packages/plugins/blocks/blocks-antd/src/blocks/DateTimeSelector/DateTimeSelector.js on lines 83..89
packages/plugins/blocks/blocks-antd/src/blocks/WeekSelector/WeekSelector.js on lines 65..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 51.

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 (!pageConfig) {
    logger.info({ event: 'redirect_page_not_found', pageId });
    return {
      redirect: {
        destination: '/404',
Severity: Minor
Found in packages/servers/server-enterprise/pages/[pageId].js and 1 other location - About 50 mins to fix
packages/servers/server-community/pages/[pageId].js on lines 30..38

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

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 (!pageConfig) {
    logger.info({ event: 'redirect_page_not_found', pageId });
    return {
      redirect: {
        destination: '/404',
Severity: Minor
Found in packages/servers/server-community/pages/[pageId].js and 1 other location - About 50 mins to fix
packages/servers/server-enterprise/pages/[pageId].js on lines 24..32

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

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

async function KnexBuilder({ request, connection }) {
  let client = knex(connection);
  if (request.tableName) {
    client = client(request.tableName);
  }

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

const ModalBlock = ({ blockId, content, events, methods, properties }) => {
  const [openState, setOpen] = useState(false);
  useEffect(() => {
    methods.registerMethod('toggleOpen', () =>
      triggerSetOpen({ state: !openState, setOpen, methods })
Severity: Minor
Found in packages/plugins/blocks/blocks-antd/src/blocks/Modal/Modal.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 _request has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Confirmed

function _request({ arrayIndices, params, requests, location }) {
  if (!type.isString(params)) {
    throw new Error(
      `Operator Error: _request accepts a string value. Received: ${JSON.stringify(
        params
Severity: Minor
Found in packages/plugins/operators/operators-js/src/operators/client/request.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 getFromObject has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Confirmed

const getFromObject = ({ arrayIndices, location, method, object, params }) => {
  if (params === true) params = { all: true };
  if (type.isString(params) || type.isInt(params)) params = { key: params };
  if (!type.isObject(params)) {
    throw new Error(
Severity: Minor
Found in packages/engine/src/actions/getFromObject.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

Avoid deeply nested control flow statements.
Open

          if (!isValid(prop, target, options)) {
            return options.default;
          }
Severity: Major
Found in packages/utils/helpers/src/get.js - About 45 mins to fix

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

    const getWrapperCol = (value, inline) => {
      if (inline) {
        return { flex: '1 1 auto' };
      }
      const defaultVal = {
    Severity: Minor
    Found in packages/plugins/blocks/blocks-antd/src/blocks/Label/getWrapperCol.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 SwitchBlock has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    const SwitchBlock = ({
      blockId,
      components: { Icon, Link },
      events,
      loading,
    Severity: Minor
    Found in packages/plugins/blocks/blocks-antd/src/blocks/Switch/Switch.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 getBlockMatcher has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Confirmed

    const getBlockMatcher = (params) => {
      let testParams = params;
      if (type.isNone(testParams)) return () => true;
      if (type.isString(testParams)) {
        testParams = { blockIds: [testParams] };
    Severity: Minor
    Found in packages/engine/src/getBlockMatcher.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 useClickOutside has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Confirmed

    const useClickOutside = (ref, handler, value) => {
      useEffect(() => {
        let startedInside = false;
        let startedWhenMounted = false;
    
    

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

    function getFromObject({ params, object, arrayIndices, operator, location }) {
      if (params === true) params = { all: true };
      if (type.isString(params) || type.isInt(params)) params = { key: params };
      if (!type.isObject(params)) {
        throw new Error(
    Severity: Minor
    Found in packages/operators/src/getFromObject.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 CommentBlock has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    const CommentBlock = ({ blockId, components, content, properties, methods }) => {
      let avatar = {};
      if (type.isObject(properties.avatar)) {
        avatar = properties.avatar;
      } else if (type.isString(properties.avatar)) {
    Severity: Minor
    Found in packages/plugins/blocks/blocks-antd/src/blocks/Comment/Comment.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 getLabelCol has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    const getLabelCol = (value, inline) => {
      if (inline) {
        return { flex: '0 1 auto' };
      }
      const defaultVal = {
    Severity: Minor
    Found in packages/plugins/blocks/blocks-antd/src/blocks/Label/getLabelCol.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 validateBlock has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Confirmed

    function validateBlock(block, { pageId }) {
      if (!type.isObject(block)) {
        throw new Error(
          `Expected block to be an object on page "${pageId}". Received ${JSON.stringify(block)}.`
        );
    Severity: Minor
    Found in packages/build/src/build/buildPages/buildBlock/validateBlock.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

    Severity
    Category
    Status
    Source
    Language