lowdefy/lowdefy

View on GitHub

Showing 199 of 9,537 total issues

Function callAction has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  async callAction({ action, arrayIndices, block, event, index, progress, responses }) {
    if (!this.actions[action.type]) {
      throw {
        error: new Error(`Invalid action type "${action.type}" at "${block.blockId}".`),
        type: action.type,
Severity: Minor
Found in packages/engine/src/Actions.js - About 55 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 getContext has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Confirmed

function getContext({
  config,
  jsMap = {},
  lowdefy,
  resetContext = { reset: false, setReset: () => undefined },
Severity: Minor
Found in packages/engine/src/getContext.js - About 55 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 JsMapParser has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Confirmed

function JsMapParser({ input, jsMap, env }) {
  if (!jsMap[env]) {
    jsMap[env] = {};
  }
  const reviver = (_, value) => {
Severity: Minor
Found in packages/build/src/build/buildJs/jsMapParser.js - About 55 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 createAuthorize has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Confirmed

function createAuthorize({ session }) {
  // Next-auth getSession provides a session object if the user is authenticated
  // else session will be null

  const authenticated = !!session;
Severity: Minor
Found in packages/api/src/context/createAuthorize.js - About 55 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 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

    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

    Severity
    Category
    Status
    Source
    Language