Showing 612 of 1,578 total issues
File device.rb
has 281 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
class Device < ApplicationRecord
DEFAULT_MAX_CONFIGS = 300
DEFAULT_MAX_IMAGES = 100
DEFAULT_MAX_LOGS = 1000
DEFAULT_MAX_TELEMETRY = 300
Function render
has 68 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const { chosenXY } = this;
const allSoilHeightPoints = this.props.genericPoints.filter(soilHeightPoint);
const getColorOverride = getSoilHeightColor(allSoilHeightPoints);
const sensorReadings = this.props.sensorReadings
File index.tsx
has 280 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import React from "react";
import { connect } from "react-redux";
import {
DesignerPanel, DesignerPanelTop, DesignerPanelContent,
} from "../farm_designer/designer_panel";
Function getWarningLinesContent
has 68 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
(props: GetWarningLinesContentProps): WarningLinesContent => {
const { x, y } = props;
const gantryHeight = props.sourceFbosConfig("gantry_height").value as number;
const locationSoilHeight = getZAtLocation({
x,
File component.tsx
has 279 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import React from "react";
import { StepWrapper } from "../../step_ui";
import { Row, Col, ExpandableHeader } from "../../../ui";
import { ToolTips } from "../../../constants";
import { t } from "../../../i18next_wrapper";
Function render
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const { dispatch, current, stepIndex, resources } = this.props;
const commonStepProps = { dispatch, current, index: stepIndex };
const click = () => {
scrollToBottom("sequenceDiv");
Function render
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const {
cropSearchResults, cropSearchInProgress, dispatch, plant,
} = this.props;
const { plantUUID } = this.props.hoveredPlant;
File step_button_cluster.tsx
has 278 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import React from "react";
import { t } from "../i18next_wrapper";
import { StepButton, stepClick } from "./step_buttons";
import { equals, scrollToBottom } from "../util";
import { Col } from "../ui";
Function render
has 66 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const panelName = "designer-sequence-editor";
const { sequence } = this.props;
return <DesignerPanel panelName={panelName} panel={Panel.Sequences}>
<DesignerPanelHeader
Function render
has 66 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const {
weed, mapTransformProps, hovered, current, selected, animate,
radiusVisible, dispatch,
} = this.props;
File bot_figure.tsx
has 275 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import React from "react";
import { AxisNumberProperty, MapTransformProps } from "../../interfaces";
import { getMapSize, transformXY } from "../../util";
import { BotPosition } from "../../../../devices/interfaces";
import { Color } from "../../../../ui";
Function emptyState
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const emptyState = (): RestResources => {
return {
consumers: {
sequences: sequenceState,
regimens: regimenState,
Function render
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
Open
render() {
const point = this.props.tpp.body;
const color = point.meta.color || "green";
const { tpp, dispatch, hovered, colorOverride } = this.props;
const pointId = (point.id || "ERR_NO_POINT_ID").toString();
- 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 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const {
current, selected, dragging, plant, mapTransformProps,
activeDragXY, zoomLvl, animate, editing, hovered, hoveredSpread,
} = this.props;
Function render
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const { savedGarden } = this.props;
const gardensPath = Path.savedGardens();
const plantsPath = Path.plants();
!savedGarden && Path.startsWith(gardensPath) && push(plantsPath);
Function render
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const { curves } = this.props;
const filteredCurves = curves
.filter(p => p.body.name.toLowerCase()
.includes(this.state.searchTerm.toLowerCase()));
Function BotPositionRows
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const BotPositionRows = (props: BotPositionRowsProps) => {
const { locationData, getConfigValue, arduinoBusy, locked } = props;
const hardwareDisabled = disabledAxisMap(props.firmwareSettings);
const commonAxisActionProps = {
botOnline: props.botOnline,
File move_to.tsx
has 271 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import React from "react";
import { Row, Col, Popover } from "../ui";
import { BotPosition } from "../devices/interfaces";
import { move } from "../devices/actions";
import { push } from "../history";
Function render
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const { wdEnvGet } = this;
const { syncStatus, botToMqttStatus } = this.props;
const botOnline = isBotOnline(syncStatus, botToMqttStatus);
const camDisabled = cameraBtnProps(this.props.env, botOnline);
Function LimitSwitches
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function LimitSwitches(props: LimitSwitchesProps) {
const { limit_switches } = props.settingsPanelState;
const { dispatch, sourceFwConfig, arduinoBusy, firmwareHardware } = props;