Showing 646 of 1,897 total issues
Function GardenWeed
has 76 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const GardenWeed = (props: GardenWeedProps) => {
const [iconHovered, setIconHovered] = React.useState(false);
const iconHover = (action: "start" | "end") => () => {
const startHover = action === "start";
Function Grid
has 76 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const Grid = (props: GridProps) => {
const { mapTransformProps, zoomLvl } = props;
const gridSize = getMapSize(mapTransformProps);
const origin = transformXY(0, 0, mapTransformProps);
const arrowEnd = transformXY(20, 20, mapTransformProps);
Function Lab
has 76 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const Lab = (props: LabProps) => {
const { config } = props;
const groundZ = -config.bedZOffset - config.bedHeight;
const shelfWoodTexture = useTexture(ASSETS.textures.wood + "?=shelf");
Function PhotoFilterSettings
has 75 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const PhotoFilterSettings = (props: PhotoFilterSettingsProps) => {
const { dispatch, flags } = props;
const {
alwaysHighlightImage, hideUnShownImages,
showCalibrationImages, showDetectionImages, showHeightImages,
Function ItemListWrapper
has 74 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function ItemListWrapper(props: ItemListWrapperProps) {
const { chosenXY } = props;
const items = sortBy(groupItemsByLocation(props.items, chosenXY), "distance");
const [expanded, setExpanded] = React.useState(false);
if (items.length < 1) {
Function PublicOverlay
has 74 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const PublicOverlay = (props: OverlayProps) => {
const { config, setConfig, toolTip, setToolTip } = props;
const Section = (sectionProps: SectionProps) => {
const { title, configKey, options } = sectionProps;
File point_inventory.tsx
has 290 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import React from "react";
import { connect } from "react-redux";
import { PointInventoryItem } from "./point_inventory_item";
import { Everything, PointsPanelState } from "../interfaces";
import { Panel } from "../farm_designer/panel_header";
Function render
has 73 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const commonProps = {
hoveredMetric: this.state.hoveredMetric,
hoveredTime: this.state.hoveredTime,
onHover: this.hoverMetric,
Method if_topic_is_safe
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
Open
def if_topic_is_safe
if farmbot_demo?
a, b, c = (routing_key_param || "").split(".")
if !(permission_param == "read")
- 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 CameraViewArea
has 72 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const CameraViewArea = (props: CameraViewAreaProps) => {
const { cameraCalibrationData, mapTransformProps, cropPhotos } = props;
const { xySwap } = mapTransformProps;
const { x, y } = props.position;
const { center, scale, rotation } = props.cameraCalibrationData;
Function ToolSlotPoint
has 72 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const ToolSlotPoint = (props: TSPProps) => {
const { tool, toolSlot } = props.slot;
const {
id, x, y, pullout_direction, gantry_mounted
} = toolSlot.body;
Function emptyState
has 71 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const emptyState = (): AppState => {
return {
settingsSearchTerm: "",
settingsPanelState: {
farmbot_settings: false,
Class RmqUtilsController
has 25 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class RmqUtilsController < Api::AbstractController
class BrokerConnectionLimiter
attr_reader :cache
CACHE_KEY_TPL = "mqtt_limiter:%s"
File reducer.ts
has 284 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import {
DesignerState,
CropLiveSearchResult,
DrawnPointPayl,
DrawnWeedPayl,
Function render
has 70 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const {
cropSearchResults, cropSearchInProgress, dispatch, plant,
} = this.props;
const { plantUUID } = this.props.hoveredPlant;
Function render
has 70 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const { urlTourSlug, urlTourStepSlug } = this.tourState;
this.updateStateAndUrl();
File index.tsx
has 282 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import React from "react";
import { NavBarProps, NavBarState } from "./interfaces";
import { EStopButton } from "./e_stop_btn";
import { Popover } from "../ui";
import { useNavigate } from "react-router-dom";
Function render
has 69 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const simple = !!this.wdEnvGet(this.namespace("easy_calibration"));
const commonProps = {
wdEnvGet: this.wdEnvGet,
onChange: this.props.onChange,
Function render
has 69 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
/** Return filtered sensor readings for the specified period.
* Must be in render() so that state updates. */
const readingsForPeriod =
filterSensorReadings(this.props.sensorReadings, this.state);
Function VariableForm
has a Cognitive Complexity of 20 (exceeds 5 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
- 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"