Showing 612 of 1,578 total issues
Function generateTransformStyle
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const generateTransformStyle = (props: GenerateTransformStyleProps) => {
const { zoomLvl, mapTransformProps } = props;
const { quadrant, xySwap } = mapTransformProps;
/** Determine if an axis is displayed vertically on the page. */
Function RawZones
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const RawZones = (props: ZonesProps) => {
const navigate = (id: number) => push(Path.zones(id));
const [searchTerm, setSearchTerm] = React.useState("");
return <DesignerPanel panelName={"zones-inventory"} panel={Panel.Zones}>
<DesignerNavTabs />
Function OtaTimeSelector
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const OtaTimeSelector = (props: OtaTimeSelectorProps) => {
const { device, dispatch, timeSettings } = props;
const { utcOffset, hour24 } = timeSettings;
const localHour = utcHourToLocalHour(device.body.ota_hour_utc, utcOffset) ??
device.body.ota_hour;
Function PowerAndReset
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function PowerAndReset(props: PowerAndResetProps) {
const { dispatch, botOnline } = props;
const { power_and_reset } = props.settingsPanelState;
return <Highlight className={"section advanced"}
settingName={DeviceSetting.powerAndReset}
Function semverCompare
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function semverCompare(left: string, right: string): SemverResult {
const leftSemVer = left.split("-")[0];
const rightSemVer = right.split("-")[0];
const leftHasSuffix = left.includes("-");
const rightHasSuffix = right.includes("-");
Function getData
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const getData = (
all: TaggedTelemetry[],
metricName: keyof Telemetry,
): DataSegment[] => {
const data: DataRecord[] = [];
Function PlantSlugBulkUpdate
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const PlantSlugBulkUpdate = (props: PlantSlugBulkUpdateProps) => {
const plants = props.allPoints.filter(point =>
props.selected.includes(point.uuid) && point.kind === "Point" &&
point.body.pointer_type == "Plant")
.map((p: TaggedPlantPointer) => p);
Function getLocationState
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const getLocationState = (step: Move): {
location: LocationNode | undefined,
locationSelection: LocSelection | undefined,
} => {
/** Last axis_overwrite where axis_operand is a point, tool, or identifier. */
Function BotExtents
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function BotExtents(props: BotExtentsProps) {
const { stopAtHome, botSize, mapTransformProps } = props;
const { xySwap } = mapTransformProps;
const homeLength = transformXY(
botSize.x.value, botSize.y.value, mapTransformProps);
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 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 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
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
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 TileAssertion
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const TileAssertion = (props: StepParams<Assertion>) => {
const [monaco, setMonaco] = React.useState(window.innerWidth > 450);
const [expanded, setExpanded] = React.useState(false);
const stateToggles = {
[StateToggleKey.monacoEditor]:
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 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 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"}>
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 StartTimeForm
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const StartTimeForm = (props: StartTimeFormProps) => {
const forceMidnight = props.isRegimen;
const isNew = !parseInt("" + props.fieldGet("id"));
const startDatetimeError = isNew && !forceMidnight &&
!moment(props.now).isBefore(moment(offsetTime(props.fieldGet("startDate"),