Showing 610 of 1,573 total issues
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);
File reducer.ts
has 292 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import {
DesignerState,
CropLiveSearchResult,
DrawnPointPayl,
DrawnWeedPayl,
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 render
has 75 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const { point } = this;
const { dispatch } = this.props;
const pointsPath = Path.points();
!point && Path.startsWith(pointsPath) && push(pointsPath);
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 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
File other_settings.tsx
has 288 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import React from "react";
import { OtherSettingsProps, SettingDescriptionProps } from "./interfaces";
import { Highlight } from "./maybe_highlight";
import { DeviceSetting, Content, ToolTips } from "../constants";
import { Header } from "./hardware_settings/header";
File point_inventory.tsx
has 287 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 { DesignerNavTabs, Panel } from "../farm_designer/panel_header";
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 71 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,
Function render
has 71 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);
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 index.tsx
has 284 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 { Row, Col, Popover } from "../ui";
import { push } from "../history";
Function render
has 70 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const { urlTourSlug, urlTourStepSlug } = this.tourState;
this.updateStateAndUrl();
File motors.tsx
has 283 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import React from "react";
import { BooleanMCUInputGroup } from "./boolean_mcu_input_group";
import { ToolTips, DeviceSetting } from "../../constants";
import { settingToggle } from "../../devices/actions";
import { NumericMCUInputGroup } from "./numeric_mcu_input_group";
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 a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
Open
render() {
const { imageWidth, imageHeight } = this.state;
const { image, cameraCalibrationData, mapTransformProps, cropImage,
} = this.props;
const imageRotation = parse(cameraCalibrationData.rotation) ?? 0;
- 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 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