Showing 610 of 1,573 total issues
File location_info.tsx
has 463 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import React from "react";
import { Everything, MovementState, TimeSettings } from "../interfaces";
import { BotPosition, UserEnv } from "../devices/interfaces";
import { connect } from "react-redux";
import { getUrlQuery } from "../util";
Function render
has 169 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const { H_LO, H_HI, S_LO, S_HI, V_LO, V_HI } = this.props;
const cameraCalibrationEnv = this.props.namespace("H_LO").includes("CAMERA");
const defaultHLow = this.getDefault(cameraCalibrationEnv ? "H_HI" : "H_LO");
const defaultHHigh = this.getDefault(cameraCalibrationEnv ? "H_LO" : "H_HI");
File actions.ts
has 441 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import axios from "axios";
import { success, warning, info, error } from "../toast/toast";
import { getDevice } from "../device";
import { Everything } from "../interfaces";
import {
File crop_info.tsx
has 437 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import React from "react";
import { svgToUrl } from "../open_farm/icons";
import {
CropInfoProps, CropLiveSearchResult, DesignerState, OpenfarmSearch,
} from "../farm_designer/interfaces";
File cards.tsx
has 436 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import React from "react";
import { t } from "../i18next_wrapper";
import {
AlertCardProps, AlertCardTemplateProps, FirmwareMissingProps,
SeedDataMissingProps, SeedDataMissingState, TourNotTakenProps,
File chart.tsx
has 422 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import React from "react";
import { t } from "../i18next_wrapper";
import { floor, isUndefined, range, round } from "lodash";
import { Curve } from "farmbot/dist/resources/api_resources";
import { Color, Popover } from "../ui";
Function render
has 150 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const { dispatch, sequence } = this.props;
const { viewSequenceCeleryScript, view } = this.state;
const variableData = this.props.resources.sequenceMetas[sequence.uuid] || {};
const declarations = betterCompact(Object.values(variableData)
Function VariableForm
has 147 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
(props: VariableFormProps) => {
const { sequenceUuid, resources, bodyVariables, variable, variableType,
allowedVariableNodes, hideGroups, removeVariable, onChange } = props;
const { celeryNode, dropdown, vector, isDefault } = maybeUseStepData({
resources, bodyVariables, variable, uuid: sequenceUuid
File map_image.tsx
has 407 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import React from "react";
import { TaggedImage } from "farmbot";
import { CameraCalibrationData, BotOriginQuadrant } from "../../../interfaces";
import { MapTransformProps } from "../../interfaces";
import { transformXY } from "../../util";
Function AxisSettings
has 144 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function AxisSettings(props: AxisSettingsProps) {
const {
dispatch, bot, sourceFwConfig, firmwareConfig, botOnline,
firmwareHardware, showAdvanced,
File content.tsx
has 406 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import React from "react";
import { t } from "../i18next_wrapper";
import { Content, SetupWizardContent } from "../constants";
import { FilePath } from "../internal_urls";
Function WIZARD_STEPS
has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring. Open
Open
export const WIZARD_STEPS = (props: WizardStepDataProps): WizardSteps => {
const { firmwareHardware } = props;
const xySwap = !!props.getConfigValue?.(BooleanSetting.xy_swap);
const positiveMovementInstruction = (swap: boolean) =>
swap
- 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
File variable_form.tsx
has 395 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import React from "react";
import { Row, Col, FBSelect, Color, BlurableInput, Help } from "../../ui";
import {
variableFormList, NO_VALUE_SELECTED_DDI, sortVariables, heading, sequences2Ddi,
LOCATION_PLACEHOLDER_DDI,
File edit_curve.tsx
has 392 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import React from "react";
import { t } from "../i18next_wrapper";
import { connect } from "react-redux";
import { push } from "../history";
import { SpecialStatus, TaggedCurve } from "farmbot";
Function render
has 134 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const { dispatch } = this.props;
const gridIds = compact(uniq(this.props.genericPoints
.map(p => p.body.meta.gridId)));
const points = orderedPoints(this.props.genericPoints, this.state)
Function render
has 133 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const { getConfigValue, dispatch, firmwareConfig,
sourceFwConfig, sourceFbosConfig, resources, settingsPanelState,
} = this.props;
const showAdvanced = !!getConfigValue(BooleanSetting.show_advanced_settings);
File fbos_details.tsx
has 387 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import React from "react";
import { Saucer, FBSelect, Help, Popover } from "../../ui";
import { updateConfig } from "../../devices/actions";
import { last, isNumber, isString } from "lodash";
import { Content, ToolTips } from "../../constants";
Function render
has 130 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const { dispatch, plantsPanelState, plants } = this.props;
const filteredPlants = plants
.filter(p => p.body.name.toLowerCase()
.includes(this.state.searchTerm.toLowerCase()));
File reducer_support.ts
has 377 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import {
ResourceName, SpecialStatus, TaggedResource, TaggedSequence,
} from "farmbot";
import { combineReducers, ReducersMapObject, UnknownAction } from "redux";
import { helpReducer as help } from "../help/reducer";
Function render
has 126 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const wDEnvGet = (key: WDENVKey) => envGet(key, this.props.wDEnv);
const { syncStatus, botToMqttStatus, photosPanelState } = this.props;
const botOnline = isBotOnline(syncStatus, botToMqttStatus);
const common = {