Showing 612 of 1,578 total issues
Function routeMqttData
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export function routeMqttData(chan: string, payload: Buffer):
MqttDataResult<TaggedResource> {
/** Skip irrelevant messages: only resource auto-sync messages are desired.
* eg, `bot/device_#/sync/Resource/#` */
if (!(chan.split("/")[2] == "sync")) { return { status: "SKIP" }; }
- 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 regimenCalendarAdder
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const regimenCalendarAdder = (
index: ResourceIndex, timeSettings: TimeSettings) =>
(f: FarmEventWithRegimen, c: Calendar, now = moment()) => {
const { regimen_items } = f.executable;
const gracePeriod = itemGracePeriod(now);
- 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 mapStateToProps
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export function mapStateToProps(p: Everything): BootSequenceSelectorProps {
const { index } = p.resources;
const fbosConfig = getFbosConfig(index);
if (fbosConfig) {
const list = betterCompact(selectAllSequences(index).map(sequence2ddi));
- 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 OtaTimeSelector
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export const OtaTimeSelector = (props: OtaTimeSelectorProps) => {
const { device, dispatch, timeSettings } = props;
const { utcOffset, hour24 } = timeSettings;
const localHour = utcHourToLocalHour(device.body.ota_hour_utc, utcOffset) ??
device.body.ota_hour;
- 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 Setting
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export const Setting = (props: SettingProps) => {
const { title, setting, numberSetting, callback, defaultOn } = props;
const raw_value = setting ? props.getConfigValue(setting) : undefined;
const value = (defaultOn && isUndefined(raw_value)) ? true : !!raw_value;
return <Highlight settingName={title}>
- 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 scheduleForFarmEvent
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export function scheduleForFarmEvent(
{ start_time, end_time, repeat, time_unit }: TimeLine, timeNow = moment(),
): { items: Moment[], shortenedBy: number } {
const interval = repeat && farmEventIntervalSeconds(repeat, time_unit);
const gracePeriod = timeNow.clone().subtract(gracePeriodSeconds, "seconds");
- 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 render
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
render() {
const i = this.props.bot.hardware.informational_settings;
const isLocked = !!i.locked;
const toggleEmergencyLock = isLocked
? () => emergencyUnlock(this.props.forceUnlock)
- 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 determineVarDDILabel
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
(props: DetermineVarDDILabelProps): string => {
const { label, resources, uuid, forceExternal } = props;
if (forceExternal) { return t("Externally defined"); }
const variable = maybeFindVariable(label, resources, uuid);
if (variable) {
- 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 confirmationChecker
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const confirmationChecker = (resourceName: ResourceName, force: boolean) =>
<T>(proceed: () => T): T | undefined => {
if (MUST_CONFIRM_LIST.includes(resourceName)) {
if (force || confirm(t("Are you sure you want to delete this item?"))) {
return proceed();
- 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 is
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const is = (r: ResourceName) => function isOfTag(x: object): x is TaggedResource {
const safe = (sanityCheck(x) && isTaggedResource(x) && x.kind == r);
if (!safe) {
if (x) {
throw new Error("Possible bad index");
- 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 render
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
render() {
const {
direction, axis, locked, arduinoBusy, botOnline, botPosition, movementState,
} = this.props;
const title = `${t("move {{axis}} axis", { axis })} (${this.distance})`;
- 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 render
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
render() {
const {
stepSize, arduinoBusy, locked, getConfigValue, env, highlightHome,
highlightAxis, highlightDirection, botPosition, botOnline, dispatch,
} = this.props;
- 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"