Showing 612 of 1,578 total issues
Function determineInstalledOsVersion
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export function determineInstalledOsVersion(
bot: BotState, device: TaggedDevice | undefined): string | undefined {
const fromBotState = bot.hardware.informational_settings.controller_version;
const fromAPI = device ? device.body.fbos_version : undefined;
if (isUndefined(fromBotState) && isUndefined(fromAPI)) { return 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 createTimeLabel
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
(x: number, timePeriod: number, timeStep: number, timeMax: moment.Moment,
timeSettings: TimeSettings) =>
(period: "current" | "previous"): string => {
const calcFormat = () => {
if (timePeriod > 3600 * 24 * 32) { return "MMM D YYYY"; }
- 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 mapStateToPropsAddEdit
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export function mapStateToPropsAddEdit(props: Everything): AddEditFarmEventProps {
const executableList: DropDownItem[] = [
{ label: t("Sequences"), heading: true, value: 0, headingId: "Sequence" },
...addExecutables(selectAllSequences(props.resources.index)),
{ label: t("Regimens"), heading: true, value: 0, headingId: "Regimen" },
- 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 tooltip
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
get tooltip() {
const scale = {
x: microstepScaledConfig(this.props.x) ? 1 : this.props.xScale || 1,
y: microstepScaledConfig(this.props.y) ? 1 : this.props.yScale || 1,
z: microstepScaledConfig(this.props.z) ? 1 : this.props.zScale || 1,
- 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 saveOrEditFarmwareEnv
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export const saveOrEditFarmwareEnv = (ri: ResourceIndex): SaveFarmwareEnv =>
(key: string, value: string) => (dispatch: Function) => {
const fwEnvLookup: Record<string, TaggedFarmwareEnv> = {};
selectAllFarmwareEnvs(ri)
.map(x => { fwEnvLookup[x.body.key] = x; });
- 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 convertUptime
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export const convertUptime = (seconds: number, abrv = false) => {
if (seconds >= 172800) {
return `${Math.round(seconds / 86400)} ${t("days")}`;
} else if (seconds >= 7200) {
return `${Math.round(seconds / 3600)} ${t("hours")}`;
- 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 PercentChange
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
const PercentChange = (props: PercentChangeProps) => {
const exactData = populatedData(props.curve.body.data, true);
const prev = exactData[props.index] || 0;
const value = exactData[props.index + 1];
if (prev == 0) { return <p>-</p>; }
- 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 stopIE
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export function stopIE() {
try {
// Can't use Array.proto.map because IE.
// Can't translate the text because IE (no promises)
for (let i = 0; i < REQUIRED_GLOBALS.length; i++) {
- 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 Button
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
const Button = (props: ButtonProps) => {
const { pin, color, cx, cy, r } = props;
const hovered = props.hovered && !props.bound;
return <g id={"button"} style={{ cursor: "pointer" }}
onMouseEnter={props.hover(pin)}
- 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 beforeEach
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export const beforeEach = (state: RestResources,
action: ReduxAction<unknown>,
handler: ActionHandler<RestResources, unknown>) => {
const { byKind, references } = state.index;
const w = references[Object.keys(byKind.WebAppConfig)[0]];
- 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 8 (exceeds 5 allowed). Consider refactoring. Open
render() {
const { logs, botOnline, imageJobs, env } = this.props;
const { clickedAt } = this.state;
const camDisabled = cameraBtnProps(env, botOnline);
const job = imageJobs.filter(x => greaterThanTime(x.updated_at, clickedAt))[0];
- 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 directionDisabled
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export function directionDisabled(props: DirectionButtonProps): boolean {
const {
stopAtHome, stopAtMax, axisLength, position, isInverted, negativeOnly
} = props.directionAxisProps;
const { direction } = 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"
Further reading
Function FolderNameEditor
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export const FolderNameEditor = (props: FolderNodeProps) => {
const { node } = props;
const [settingsOpen, setSettingsOpen] = React.useState(false);
const [hovered, setHovered] = React.useState(false);
return <div
- 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
Consider simplifying this complex logical expression. Open
if (i > 0 && previousCoordinate && currentCoordinate && isNumber(cur.water)) {
const p1 = toQ(currentCoordinate);
const p2 = toQ(previousCoordinate);
return <g id={"trail-record"} key={i}>
<line id={`trail-line-${i}`}
Consider simplifying this complex logical expression. Open
if (activeXYZ && !isUndefined(activeXYZ.x) && !isUndefined(activeXYZ.y)
&& plantXYZ && !isUndefined(plantXYZ.x) && !isUndefined(plantXYZ.y)) {
// Plant editing (dragging) is occuring
const activeXY = { x: round(activeXYZ.x), y: round(activeXYZ.y) };
const distance = Math.sqrt(
Consider simplifying this complex logical expression. Open
if (isUndefined(botPosition0.x)
|| isUndefined(botPosition0.y)
|| isUndefined(botPosition0.z)
|| isUndefined(botPosition1.x)
|| isUndefined(botPosition1.y)
Consider simplifying this complex logical expression. Open
if (imagePosition) {
const { width, height, transformOrigin } = imagePosition;
const transform = this.props.disableTranslation ?
imagePosition.transform.replace(/translate\(.*?\)/g, "")
: imagePosition.transform;
Function variableFormList
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
resources: ResourceIndex,
additionalItems: DropDownItem[],
variableItems?: DropDownItem[],
displayGroups?: boolean,
variableType?: VariableType,
Function stepPut
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
export function stepPut(value: Step,
ev: React.DragEvent<HTMLElement>,
intent: DataXferIntent,
draggerId: number,
resourceUuid?: UUID):
Function occurrence
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
m: moment.Moment,
fe: FarmEventWithExecutable,
timeSettings: TimeSettings,
resources: ResourceIndex,
modifiers?: { numHidden?: number, empty?: boolean }):