Showing 646 of 1,897 total issues
Function variableFormList
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export function variableFormList(
resources: ResourceIndex,
additionalItems: DropDownItem[],
variableItems?: DropDownItem[],
displayGroups?: boolean,
- 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 getSelectedValue
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
const getSelectedValue = (props: GetSelectedValueProps): DropDownItem => {
const DDI = UPDATE_RESOURCE_DDIS();
if (isUndefined(props.field) || isUndefined(props.value)
|| props.resource.kind == "nothing") { return DDI.SELECT_ONE; }
switch (props.field) {
- 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 getZoneType
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export const getZoneType = (group: TaggedPointGroup): ZoneType => {
const numEq = group.body.criteria.number_eq;
const numGt = group.body.criteria.number_gt;
const numLt = group.body.criteria.number_lt;
const hasXEq = !!numEq.x?.length;
- 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 CameraViewArea
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export const CameraViewArea = (props: CameraViewAreaProps) => {
const { cameraCalibrationData, mapTransformProps, cropPhotos } = props;
const { xySwap } = mapTransformProps;
const { x, y } = props.position;
const { center, scale, rotation } = props.cameraCalibrationData;
- 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 reduceMoveAbsolute
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
const reduceMoveAbsolute = (
step: MoveAbsolute,
sequenceUuid: UUID | undefined,
): Position | undefined => {
const offset = step.args.offset.args;
- 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 dropPlant
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export const dropPlant = (props: DropPlantProps) => {
const {
gardenCoords, gridSize, dispatch, getConfigValue,
} = props;
const { companionIndex, cropSearchResults, openedSavedGarden } = props.designer;
- 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 8 (exceeds 5 allowed). Consider refactoring. Open
export function mapStateToProps(props: Everything): FarmDesignerProps {
const plants = getPlants(props.resources);
const findPlant = plantFinder(plants);
const { selectedPoints } = props.resources.consumers.farm_designer;
- 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 responseRejected
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export function responseRejected(x: SafeError | undefined) {
if (x && isSafeError(x)) {
dispatchNetworkUp("user.api", now());
const a = ![451, 401, 422].includes(x.response.status);
const b = x.response.status > 399;
- 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 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 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 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 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 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 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 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 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 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 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 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"