Showing 646 of 1,897 total issues
Function HomeButton
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
Open
export const HomeButton = (props: HomeButtonProps) => {
const { doFindHome, homeDirection, locked, arduinoBusy, botOnline } = props;
const icon = doFindHome ? "fa-search" : "fa-arrow-right";
const style = doFindHome ? {} : { transform: `rotate(${homeDirection}deg)` };
const disabledAxes = disabledAxisMap(props.firmwareSettings);
- 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
Class AbstractExpress
has 34 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class AbstractExpress < AbstractGenesis
def settings_device_name
device.update!(name: Names::EXPRESS)
end
Class AbstractGenesis
has 34 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class AbstractGenesis < AbstractSeeder
def peripherals_vacuum
add_peripheral(9, ToolNames::VACUUM)
end
Function PrivateOverlay
has 102 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const PrivateOverlay = (props: OverlayProps) => {
const bedMin = props.config.bedWallThickness * 2;
const { config, setConfig } = props;
const [paramAdd, setParamAdd] = React.useState(false);
const common = { ...props, paramAdd };
Function Data
has 102 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const Data = (props: DataProps) => {
const { curve, setHovered, showHoverEffect, dragging } = props;
const { normX, normY, yZero, yMax } = props.plotTools;
const { data, type } = curve.body;
const fullWidth = X_MAX / maxDay(data);
Function render
has 102 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const { dispatch, designer } = this.props;
const { cropSearchResults, cropSearchInProgress } = designer;
const { crop, result, basePath, backgroundURL } =
getCropHeaderProps({ cropSearchResults });
File config_overlays.tsx
has 336 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import React from "react";
import { Config, modifyConfig } from "./config";
import { setUrlParam } from "./zoom_beacons_constants";
import { ExternalUrl } from "../external_urls";
Function createOrUpdateTranslationFile
has 101 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function createOrUpdateTranslationFile(
langInput: string | undefined = "en",
metricsOnly?: boolean,
): SummaryData | undefined {
const lang = langInput.slice(0, 2);
File edit_plant_status.tsx
has 332 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import React from "react";
import {
FBSelect, DropDownItem, ColorPicker, BlurableInput, NULL_CHOICE,
} from "../ui";
import { PlantOptions } from "../farm_designer/interfaces";
Function ProfileSvg
has 95 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const ProfileSvg = (props: ProfileSvgProps) => {
const { expanded, mapTransformProps, tools, position, getConfigValue } = props;
const lineAxis = props.designer.profileAxis;
const selectionWidth = props.designer.profileWidth;
const profileAxis = lineAxis == "x" ? "y" : "x";
Function determineDropdown
has 95 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
(node: VariableNode, resources: ResourceIndex, uuid?: UUID): DropDownItem => {
if (node.kind === "parameter_declaration") {
return {
label: t("Externally defined"),
value: "?"
Function render
has 95 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const finalBack = () => {
if (this.state.version != Version["v1.6"]) { return "version"; }
if (this.state.pi) { return "pi"; }
return "run";
Function LayerToggles
has 92 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const LayerToggles = (props: GardenMapLegendProps) => {
const { toggle, getConfigValue, dispatch } = props;
const subMenuProps = { dispatch, getConfigValue };
const threeDGarden = !!props.getConfigValue(BooleanSetting.three_d_garden);
return <div className="toggle-buttons">
File create_points.tsx
has 320 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import React from "react";
import { connect } from "react-redux";
import { Everything, ResourceColor } from "../interfaces";
import { initSave } from "../api/crud";
import { Row, BlurableInput, ColorPicker } from "../ui";
Function mapStateToProps
has 90 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function mapStateToProps(props: Everything): FarmDesignerProps {
const plants = getPlants(props.resources);
const findPlant = plantFinder(plants);
const { selectedPoints } = props.resources.consumers.farm_designer;
File crud.ts
has 314 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import {
TaggedResource,
SpecialStatus,
ResourceName,
TaggedSequence,
Function render
has 88 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
return <div className={"add-sensor-reading-menu grid"}>
<div className="row grid-2-col">
<SensorSelection
selectedSensor={this.state.sensor}
Function Desk
has 87 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const Desk = (props: DeskProps) => {
const { config } = props;
const zGround = -config.bedZOffset - config.bedHeight;
const deskWoodTexture = useTexture(ASSETS.textures.wood + "?=desk");
deskWoodTexture.wrapS = RepeatWrapping;
Function PlantPanel
has 87 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function PlantPanel(props: PlantPanelProps) {
const {
info, updatePlant, dispatch, inSavedGarden, timeSettings
} = props;
const { slug, plantedAt, daysOld, uuid, plantStatus } = info;
Function FarmwareInputs
has 86 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function FarmwareInputs(props: FarmwareInputsProps) {
const {
farmwareName, currentStep, farmwareInstalled, defaultConfigs, updateStep
} = props;