Showing 646 of 1,897 total issues
Function RawEditZone
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const RawEditZone = (props: EditZoneProps) => {
const getZone = () => {
const stringyID = Path.getSlug(Path.zones());
if (stringyID) {
return props.findZone(parseInt(stringyID));
Function FarmBotSettings
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const FarmBotSettings = (props: FarmbotSettingsProps) => {
const {
dispatch, device, timeSettings, sourceFbosConfig, botOnline, showAdvanced, bot,
} = props;
const { value } = props.sourceFbosConfig("firmware_hardware");
Function PinBindingsList
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const PinBindingsList = (props: PinBindingsListProps) => {
const { pinBindings, resources, dispatch } = props;
const deleteBinding = (pin: number, uuid?: string) => {
if (!sysBtnBindings.includes(pin)) {
Function urlFor
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function urlFor(tag: ResourceName) {
const OPTIONS: Partial<Record<ResourceName, string>> = {
Alert: API.current.alertPath,
Curve: API.current.curvesPath,
Device: API.current.devicePath,
Function ProfileViewer
has a Cognitive Complexity of 12 (exceeds 5 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();
- 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 UTMProfile
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
Open
export const UTMProfile = (props: ProfileUtmProps) => {
const { x, y } = props.botPosition;
const inProfile = !isUndefined(x) && !isUndefined(y) &&
withinProfileRange({
axis: props.profileAxis == "x" ? "y" : "x",
- 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
Method execute
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def execute
ActiveRecord::Base.transaction do
flat_ir
.each do |node|
# Step 1- instantiate records.
Function ImagingDataManagement
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const ImagingDataManagement = (props: ImagingDataManagementProps) => {
const [advanced, setAdvanced] = React.useState(false);
return <div className={"imaging-data-management"}>
<Highlight settingName={DeviceSetting.highlightModifiedSettings}
pathPrefix={Path.photos}>
Function WeedPoint
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const WeedPoint = (props: ProfilePointProps<TaggedWeedPointer>) => {
const { point } = props;
const { radius } = point.body;
const color = point.body.meta.color || Color.red;
const plantIconSize = scaleIcon(radius) * 2;
Function ThreeInOneToolHead
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const ThreeInOneToolHead = (props: ThreeInOneToolHeadProps) => {
const { pulloutDirection } = props;
const { quadrant, xySwap } = props.toolTransformProps;
const angle = toolbaySlotAngle(pulloutDirection, quadrant, xySwap);
return <g id="three-in-one-tool-head">
Function DistanceIndicator
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const DistanceIndicator = (props: DistanceIndicatorProps) => {
const { start, end } = props;
const dx = end.x - start.x;
const dy = end.y - start.y;
const dz = end.z - start.z;
Function modifyConfig
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const modifyConfig = (config: Config, update: Partial<Config>) => {
const newConfig: Config = { ...config, ...update };
if (update.sizePreset) {
const presetConfig = PRESETS[update.sizePreset];
SIZE_CONFIG_KEYS.map(key => newConfig[key] = presetConfig[key] as never);
Function RpiModel
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const RpiModel = (props: RpiModelProps) => {
const selection = props.device.body.rpi;
const check = (rpi: string | undefined, target: string) => {
switch (rpi) {
case "02":
Function render
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const { group } = this.props;
const groupsPath = Path.groups();
!group && Path.startsWith(groupsPath) && history.back();
return <DesignerPanel panelName={"group-detail"} panel={Panel.Groups}>
Function PinBindingsContent
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const PinBindingsContent = (props: PinBindingsContentProps) => {
const { dispatch, resources, firmwareHardware } = props;
const pinBindings = apiPinBindings(resources);
return <div className="pin-bindings">
<Highlight settingName={DeviceSetting.stockPinBindings}>
Function LogSetting
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const LogSetting = (props: LogSettingProps) => {
const { label, setting, toolTip, setFilterLevel, sourceFbosConfig } = props;
/** Update the current filter level to a minimum needed for log display. */
const updateMinFilterLevel = (key: keyof Filters, level: number) => {
const currentLevel =
Function ScaleMenu
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const ScaleMenu = (props: ActionMenuProps) => {
const { data } = props.curve.body;
const [maxDayNum, setMaxDay] = React.useState(maxDay(data));
const [maxValueNum, setMaxValue] = React.useState(maxValue(data));
return <div className={"curve-action-menu grid"}>
Function PointsSection
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const PointsSection = (props: PointsSectionProps) => {
const { genericPoints, isOpen, dispatch, averageZ, toggleAction } = props;
return <div className={`points-section ${isOpen ? "open" : ""}`}>
<div className={"points-section-header row grid-exp-1"} onClick={props.toggleOpen}>
{props.color && <Saucer color={props.color} />}
Function ShownInMapDetails
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const ShownInMapDetails = (props: ImageShowProps) => {
const { dispatch, image, flags, size } = props;
const shownInMap = every(Object.values(flags));
return <div className={`shown-in-map-details ${shownInMap ? "shown" : ""}`}
onMouseEnter={() => shownInMap && dispatch(highlightMapImage(image?.body.id))}
Function waterFigure
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function waterFigure(
props: { i: number, cx: number, cy: number, animate: boolean }) {
const { i, cx, cy, animate } = props;
const color = "rgb(11, 83, 148)";
const copies = animate ? 3 : 1;