Showing 199 of 9,537 total issues
Function validateAuthConfig
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Confirmed
async function validateAuthConfig({ components }) {
if (type.isNone(components.auth)) {
components.auth = {};
}
if (!type.isObject(components.auth)) {
- Read upRead up
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 callActions
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Confirmed
async callActions({ actions, arrayIndices, block, catchActions, event, eventName, progress }) {
const startTimestamp = new Date();
const responses = {};
try {
await this.callActionLoop({ actions, arrayIndices, block, event, responses, progress });
Function makeReplacer
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
const makeReplacer = (customReplacer, isoStringDates) => (key, value) => {
let dateReplacer = (date) => ({ '~d': date.valueOf() });
if (isoStringDates) {
dateReplacer = (date) => ({ '~d': date.toISOString() });
}
File Menu.js
has 251 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*
Copyright 2020-2024 Lowdefy, Inc
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Function link
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
function link(props) {
if (props.disabled === true) {
return disabledLink(props);
}
if (
Function parse
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
parse({ args, input, location, operatorPrefix = '_' }) {
if (type.isUndefined(input)) {
return { output: input, errors: [] };
}
if (args && !type.isArray(args)) {
Function parse
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
parse({ args, input, location, operatorPrefix = '_' }) {
if (type.isUndefined(input)) {
return { output: input, errors: [] };
}
if (args && !type.isArray(args)) {
Function constructor
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
constructor(props) {
super(props);
this.triggerEvent = this.triggerEvent.bind(this);
// TODO: Test events.
this.allEvents = {
Function reset
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Confirmed
reset(initWithState) {
const initState = serializer.copy(initWithState || this.context.state);
this.loopBlocks((block) => {
block.update = true;
block.showValidation = false;
Function mediaToCssObject
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
const mediaToCssObject = (styles, styleObjectOnly) => {
if (type.isString(styles)) {
return styles.replace(mediaRegex, setReplacer);
}
let styleObjects = styles;
Function content
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
content: () => {
const runAfterUpdate = useRunAfterUpdate();
return (
<TextAreaComp
id={`${blockId}_input`}
Function setupLink
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Confirmed
function setupLink(lowdefy) {
const { router } = lowdefy._internal;
const { window } = lowdefy._internal.globals;
const backLink = () => router.back();
const disabledLink = () => {};
Function getCallbackUrl
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Confirmed
function getCallbackUrl({ lowdefy, callbackUrl = {} }) {
const { home, pageId, urlQuery, url } = callbackUrl;
if ([!home, !pageId, !url].filter((v) => !v).length > 1) {
throw Error(
- Read upRead up
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 ParagraphInput
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
const ParagraphInput = ({
blockId,
components: { Icon },
events,
loading,
- Read upRead up
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 set
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
function set(target, path, value, options) {
if (!type.isObject(target)) {
return target;
}
- Read upRead up
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 fetchNpmTarball
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Confirmed
async function fetchNpmTarball({ packageName, version, directory }) {
const registryUrl = `https://registry.npmjs.org/${packageName}`;
let packageInfo;
try {
packageInfo = await axios.get(registryUrl);
- Read upRead up
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 reviver
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Confirmed
const reviver = (_, value) => {
if (!type.isObject(value)) return value;
// TODO: pass ~k in errors.
// const _k = value['~k'];
delete value['~k'];
Function makeReviver
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
const makeReviver = (customReviver) => (key, value) => {
let newValue = value;
if (type.isObject(newValue)) {
if (newValue['~r']) {
Object.defineProperty(newValue, '~r', {
Function _operator
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Confirmed
function _operator(options) {
const { operators, params, location } = options;
if (!type.isString(params.name)) {
throw new Error(
`Operator Error: _operator.name must be a valid operator name as string. Received: ${JSON.stringify(
Function getBlockMatcher
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Confirmed
const getBlockMatcher = (params) => {
let testParams = params;
if (type.isNone(testParams)) return () => true;
if (type.isString(testParams)) {
testParams = { blockIds: [testParams] };