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,
- 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 getContext
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Confirmed
function getContext({
config,
jsMap = {},
lowdefy,
resetContext = { reset: false, setReset: () => undefined },
- 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 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) => {
- 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 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;
- 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 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);
}
- 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 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 })
- 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 _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
- 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 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(
- 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
Avoid deeply nested control flow statements. Open
if (!isValid(prop, target, options)) {
return options.default;
}
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 = {
- 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 SwitchBlock
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
const SwitchBlock = ({
blockId,
components: { Icon, Link },
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 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] };
- 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 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;
- 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 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(
- 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 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)) {
- 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 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 = {
- 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 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)}.`
);
- 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 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.');
}
- 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 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,
- 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 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') {
- 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"