Showing 612 of 1,578 total issues
Function mapStateToProps
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const mapStateToProps = (props: Everything): RegimenEditorProps => {
const { dispatch } = props;
const { currentRegimen } = props.resources.consumers.regimens;
const current = maybeGetRegimen(props.resources.index, currentRegimen);
const timeSettings = maybeGetTimeSettings(props.resources.index);
Function render
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
return <DesignerPanel panelName={"farm-event"} panel={Panel.FarmEvents}>
<DesignerNavTabs />
<DesignerPanelTop
panel={Panel.FarmEvents}
Function render
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const sensorNameByPinLookup: { [x: number]: string } = {};
this.props.sensors.map(x => {
sensorNameByPinLookup[x.body.pin || 0] = x.body.label;
});
Function TableRow
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const TableRow = (props: TableRowProps) => {
const {
sensorReading, timeSettings, period, sensorName, hover, hovered,
} = props;
const { uuid, body } = sensorReading;
Function regimenCalendarAdder
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
(f: FarmEventWithRegimen, c: Calendar, now = moment()) => {
const { regimen_items } = f.executable;
const gracePeriod = itemGracePeriod(now);
const lastRI = last(regimen_items);
const lastRITime = lastRI &&
Function SaveBtn
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function SaveBtn(props: SaveBtnProps) {
const CLASS: Record<SpecialStatus, string> = {
[SpecialStatus.DIRTY]: "is-dirty",
[SpecialStatus.SAVING]: "is-saving",
[SpecialStatus.SAVED]: "is-saved",
Function FirmwareNumberSettings
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const FirmwareNumberSettings = (props: FirmwareNumberSettingsProps) => {
const sourceFwConfig = sourceFwConfigValue(
validFwConfig(getFirmwareConfig(props.resources)),
props.bot.hardware.mcu_params);
return <div className={"motor-settings"}>
Function AlertCard
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const AlertCard = (props: AlertCardProps) => {
const { alert, timeSettings, findApiAlertById, dispatch } = props;
const commonProps = { alert, timeSettings, findApiAlertById, dispatch };
switch (alert.problem_tag) {
case "farmbot_os.firmware.missing":
Function CameraOffset
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const CameraOffset = (props: WizardStepComponentProps) => {
const helpText = t(ToolTips.CAMERA_OFFSET, {
defaultX: WD_KEY_DEFAULTS["CAMERA_CALIBRATION_camera_offset_x"],
defaultY: WD_KEY_DEFAULTS["CAMERA_CALIBRATION_camera_offset_y"],
});
Function render
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const { cropSearchResults } = this.props.designer;
const { result, backgroundURL } =
getCropHeaderProps({ cropSearchResults });
const panelName = "add-plant";
Function ToolVerification
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const ToolVerification = (props: ToolVerificationProps) => {
const toolVerificationSensor =
props.sensors.filter(sensor => sensor.body.label.toLowerCase()
.includes("tool verification"))[0] as TaggedSensor | undefined;
const toolVerificationPin = toolVerificationSensor
Function PeripheralList
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
{sortResourcesById(props.peripherals).map(peripheral => {
const toggleValue =
(props.pins[peripheral.body.pin || -1] || { value: undefined }).value;
return <Row key={peripheral.uuid}>
<Col xs={6}>
Function SubCriteriaSection
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const SubCriteriaSection = (props: SubCriteriaSectionProps) => {
const { group, dispatch, disabled } = props;
const pointTypes = props.pointerTypes.sort();
if (pointTypes.length > 1 &&
!isEqual(pointTypes, ["GenericPointer", "Weed"])) {
Function MotorPositionPlot
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const MotorPositionPlot = (props: MotorPositionPlotProps) => {
const svgYMin = props.load ? -HEIGHT : -HEIGHT / 2;
const yMin = svgYMin - BORDER_WIDTH;
const height = props.load ? HEIGHT + BORDERS : HEIGHT + BORDERS;
const { load, encoders } = props;
Function getPaths
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
const getPaths = (props: PlotContentProps): Paths => {
const last = getLastEntry();
const keys = getKeys(props);
const maxY = findYLimit(props);
const plotY = calcY(props);
Function getLocationState
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
export const getLocationState = (step: Move): {
location: LocationNode | undefined,
locationSelection: LocSelection | undefined,
} => {
/** Last axis_overwrite where axis_operand is a point, tool, or identifier. */
- 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 getSelectedField
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
const getSelectedField = (
resource: MaybeResourceArg,
field: KnownField | undefined,
): DropDownItem => {
const DDI = UPDATE_RESOURCE_DDIS();
- 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
Method check_resource_type
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def self.check_resource_type(node, resource_type, resource_id, owner)
raise "OPPS!" unless owner
case resource_type # <= Security critical code (for const_get'ing)
when "Device"
# When "resource_type" is "Device", resource_id always refers to
- 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
Method maybe_continue
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def maybe_continue(username)
is_guest = (username == FARMBOT_DEMO_USER)
max = is_guest ? MAX_GUEST_COUNT : PER_DEVICE_MAX
key = CACHE_KEY_TPL % username
total = (cache.get(key) || "0").to_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 DefaultFarmwareStep
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
export const DefaultFarmwareStep = (props: StepParams<ExecuteScript>) => {
const {
dispatch, currentStep, index, currentSequence, farmwareData,
} = 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"