lowdefy/lowdefy

View on GitHub

Showing 199 of 9,537 total issues

Function PageHeaderMenu has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

const PageHeaderMenu = ({
  basePath,
  blockId,
  components: { Icon, Link },
  content,

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

  async callActionLoop({ actions, arrayIndices, block, event, progress, responses }) {
    for (const [index, action] of actions.entries()) {
      try {
        if (action.async === true) {
          this.callAsyncAction({
Severity: Minor
Found in packages/engine/src/Actions.js - About 25 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 Selector has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

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

const SkeletonInput = ({ properties, methods }) => {
  let inputHeight;
  switch (properties.size) {
    case 'small':
      inputHeight = 24;

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

function initLowdefyContext({ auth, Components, config, lowdefy, router, stage, types, window }) {
  if (!lowdefy._internal?.initialised) {
    lowdefy._internal = {
      actions: types.actions,
      blockComponents: types.blocks,
Severity: Minor
Found in packages/client/src/initLowdefyContext.js - About 25 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 checkAuthorizedHost has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

function checkAuthorizedHost({ license, req }) {
  const authorizedUrls = license.metadata?.domains ?? [];
  if (authorizedUrls.length === 0) {
    return true;
  }
Severity: Minor
Found in packages/servers/server-enterprise/lib/server/checkAuthorizedHost.js - About 25 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 SkeletonAvatar has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

const SkeletonAvatar = ({ properties, methods }) => {
  let size = properties.size ?? 32;
  if (type.isString(size)) {
    switch (properties.size) {
      case 'small':

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

async function handler({ context, req, res }) {
  if (authJson.configured !== true) {
    return res.status(404).json({
      message: 'Auth not configured',
    });
Severity: Minor
Found in packages/servers/server-enterprise/pages/api/auth/[...nextauth].js - About 25 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 createLogUsage has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

function createLogUsage({ usageDataRef }) {
  let lastTimestamp = 0;
  let isOffline = false;
  let machine = localStorage.getItem('lowdefy_machine_id');
  if (!machine) {
Severity: Minor
Found in packages/servers/server-enterprise/lib/client/createLogUsage.js - About 25 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 getRefPath has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Confirmed

function getRefPath(refDefinition) {
  if (type.isObject(refDefinition)) {
    if (refDefinition.path) {
      return refDefinition.path;
    }
Severity: Minor
Found in packages/build/src/build/buildRefs/getRefPath.js - About 25 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 getServer has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Confirmed

async function getServer({ context, packageName, directory }) {
  if (context.lowdefyVersion === 'local') {
    context.print.warn(`Running local ${packageName}.`);
    return;
  }
Severity: Minor
Found in packages/cli/src/utils/getServer.js - About 25 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 sanitizeShrink has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Confirmed

const sanitizeShrink = (value) => {
  if (value === 'unset' || value === 'inherit' || value === 'initial') {
    return value;
  }
  if (type.isNumber(value) && value >= 0) {
Severity: Minor
Found in packages/layout/src/deriveLayout.js - About 25 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 nunjucksFunction has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export const nunjucksFunction = (templateString) => {
  // template was already compiled
  if (type.isFunction(nunjucksTemplates[templateString])) {
    return nunjucksTemplates[templateString];
  }
Severity: Minor
Found in packages/utils/nunjucks/src/index.js - About 25 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 mockBlock has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

const mockBlock = ({ meta, schema }) => {
  const mockMath = Object.create(global.Math);
  mockMath.random = () => 0.5;
  global.Math = mockMath;
  const moveItemDown = jest.fn();
Severity: Minor
Found in packages/utils/block-dev/src/mockBlock.js - About 25 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 recursiveBuild has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

async function recursiveBuild({ context, refDef, count, referencedFrom }) {
  // TODO: Maybe it would be better to detect a cycle, since this is the real issue here?
  if (count > 10000) {
    throw new Error(`Maximum recursion depth of references exceeded.`);
  }
Severity: Minor
Found in packages/build/src/build/buildRefs/recursiveBuild.js - About 25 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 sanitizeGrow has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Confirmed

const sanitizeGrow = (value) => {
  if (value === 'unset' || value === 'inherit' || value === 'initial') {
    return value;
  }
  if (type.isNumber(value) && value >= 0) {
Severity: Minor
Found in packages/layout/src/deriveLayout.js - About 25 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 recursiveFormatPath has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Confirmed

function recursiveFormatPath({ data, instancePath, formattedPath = '', gap = '', root = false }) {
  if (instancePath.length === 0) return formattedPath;
  const key = instancePath.shift();
  const newData = get(data, key);
  let newPath;
Severity: Minor
Found in packages/build/src/utils/formatErrorMessage.js - About 25 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 buildRequest has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Confirmed

function buildRequest(request, pageContext) {
  const { auth, checkDuplicateRequestId, pageId, typeCounters } = pageContext;
  if (type.isUndefined(request.id)) {
    throw new Error(`Request id missing at page "${pageId}".`);
  }
Severity: Minor
Found in packages/build/src/build/buildPages/buildBlock/buildRequests.js - About 25 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 buildApp has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

function buildApp({ components }) {
  if (type.isNone(components.app)) {
    components.app = {};
  }
  if (!type.isObject(components.app)) {
Severity: Minor
Found in packages/build/src/build/buildApp.js - About 25 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