Showing 646 of 1,897 total issues
Function DefaultFarmwareStep
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const DefaultFarmwareStep = (props: StepParams<ExecuteScript>) => {
const {
dispatch, currentStep, index, currentSequence, farmwareData,
} = props;
Function ProfileViewer
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const ProfileViewer = (props: ProfileViewerProps) => {
const { dispatch } = props;
const { profileOpen, profileFollowBot } = props.designer;
const axis = props.designer.profileAxis;
const panelStatus = getPanelStatus();
Function ToolSlotSVG
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const ToolSlotSVG = (props: ToolSlotSVGProps) => {
const toolProps: ToolGraphicProps = {
toolName: props.toolName,
x: 0, y: 0,
hovered: false,
Function WeedsSection
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const WeedsSection = (props: WeedsSectionProps) => {
const { layerSetting } = props;
const rawMaxSize = Math.max(...props.items.map(item => item.body.radius));
const maxSize = isFinite(rawMaxSize) ? rawMaxSize : 0;
const noWeeds = props.allWeeds?.length == 0;
Function PointInventoryItem
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const PointInventoryItem = (props: PointInventoryItemProps) => {
const navigate = useNavigate();
const point = props.tpp.body;
const color = point.meta.color || "green";
const { tpp, dispatch, hovered, colorOverride } = props;
File fbos_metric_history_plot.tsx
has 261 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import React from "react";
import { trim } from "../../util";
import { Telemetry } from "farmbot/dist/resources/api_resources";
import { TaggedTelemetry } from "farmbot";
import { flatten, isNumber, last, max, range, sortBy } from "lodash";
Function render
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
Open
render() {
const {
cropSearchResults, cropSearchInProgress, dispatch, plant,
} = this.props;
const { plantUUID } = this.props.hoveredPlant;
- 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 StepIconGroup
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function StepIconGroup(props: StepIconBarProps) {
const {
index, dispatch, step, sequence, helpText, confirmStepDeletion, readOnly,
} = props;
Function DragHelpers
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function DragHelpers(props: DragHelpersProps) {
const {
dragging, plant, zoomLvl, activeDragXY, mapTransformProps, plantAreaOffset
} = props;
const { xySwap } = mapTransformProps;
Function PlantLayer
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function PlantLayer(props: PlantLayerProps) {
const {
plants,
currentPlant,
dragging,
Function render
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const { isEditing } = this.state;
const status = getArrayStatus(this.props.peripherals);
const editButtonText = isEditing
? t("Back")
Function SequencePublishMenu
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const SequencePublishMenu = (props: SequenceShareMenuProps) => {
const { sequence } = props;
const disabled = sequence.specialStatus !== SpecialStatus.SAVED;
const [publishing, setPublishing] = React.useState(false);
const [copyright, setCopyright] = React.useState(sequence.body.copyright || "");
Function TextInRoundedSvgBox
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const TextInRoundedSvgBox = (props: RoundedBoxProps) => {
const { x, y, width, height, fill, radius } = props;
const r = radius || 4;
const upperRightCorner = `a${r},${r} 0 0 1 ${r},${r}`;
const lowerRightCorner = `a${r},${r} 0 0 1 -${r},${r}`;
Function PresetButton
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const PresetButton = (props: PresetButtonProps) => {
const { preset, choosePreset, hovered, setHovered, startPosition, index } = props;
const btnHeight = 50;
const btnZ = 0;
const textZ = btnHeight / 2 + 1;
Function LogsFilterMenu
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const LogsFilterMenu = (props: LogsFilterMenuProps) => {
/** Set the filter level to the same value for all log message types. */
const setAll = (level: number) => () => {
MESSAGE_TYPES.map((x: keyof Filters) => props.setFilterLevel(x)(level));
};
File content.tsx
has 257 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import React from "react";
import { uniq, sortBy, ceil, range, cloneDeep, reverse } from "lodash";
import {
TaggedPoint, TaggedToolSlotPointer, TaggedWeedPointer,
} from "farmbot";
File reducer.ts
has 257 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import { generateReducer } from "../redux/generate_reducer";
import { RestResources } from "./interfaces";
import {
indexUpsert,
mutateSpecialStatus,
Class Transport
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class Transport
OPTS = { read_timeout: 10, heartbeat: 10, log_level: "warn" }
CLOUDAMQP_ENV_KEY = ENV.fetch("WHERE_IS_CLOUDAMQP_URL", "CLOUDAMQP_URL")
def self.amqp_url
Function ImportedBanner
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const ImportedBanner = (props: ImportedBannerProps) => {
const versionId = props.sequence.body.sequence_version_id;
const allIds = sortBy(props.sequence.body.sequence_versions);
const latestId = last(allIds);
const versionList = sequenceVersionList(allIds);
Function EnvEditor
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const EnvEditor = (props: EnvEditorProps) => {
const [newKey, setNewKey] = React.useState("");
const [newValue, setNewValue] = React.useState("");
const sortedFarmware = sortBy(props.farmwareEnvs, "body.id").reverse();
return <div className={"farmware-env-editor"}>