Showing 646 of 1,897 total issues
File test_fixtures.ts
has 256 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { ComputedMoveState, LocSelection, AxisSelection } from "./interfaces";
import { Move } from "farmbot";
export const fakeNumericMoveStepState: ComputedMoveState = ({
locationSelection: LocSelection.identifier,
Method provide_feedback
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
def provide_feedback(message, slug = "Not provided")
webhook_url = ENV["FEEDBACK_WEBHOOK_URL"]
if webhook_url
email = self.users.pluck(:email).join(" ")
name = self.users.first.name
Function render
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const { imageWidth, imageHeight } = this.state;
const { image, cameraCalibrationData, mapTransformProps, cropImage,
} = this.props;
const imageRotation = parse(cameraCalibrationData.rotation) ?? 0;
Function HomeButton
has 53 lines of code (exceeds 25 allowed). Consider refactoring. 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);
Function DaySelection
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const DaySelection = (props: DaySelectionProps) => {
const { group, criteria, dispatch, advanced } = props;
const dayCriteria = criteria.day;
const noDayCriteria = !advanced &&
dayCriteriaEmpty(dayCriteria) && !props.dayChanged;
File image_filter_menu.tsx
has 254 lines of code (exceeds 250 allowed). Consider refactoring. Open
import React from "react";
import { BlurableInput, MarkedSlider } from "../../ui";
import { offsetTime } from "../../farm_events/edit_fe_form";
import moment from "moment";
import {
Function createOrUpdateTranslationFile
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
export function createOrUpdateTranslationFile(
langInput: string | undefined = "en",
metricsOnly?: boolean,
): SummaryData | undefined {
const lang = langInput.slice(0, 2);
- 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 create
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def create
request_body = request.raw_post
heroku_signature = request.headers['Heroku-Webhook-Hmac-SHA256']
secret = ENV['HEROKU_WEBHOOK_SECRET']
- 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 curveDataTableRow
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
export const curveDataTableRow = (props: CurveDataTableRowProps) =>
([day, value]: [string, number], index: number) => {
const { dispatch, curve, hovered, setHovered } = props;
const active = inData(curve.body.data, day);
return <tr key={day} className={hovered == day ? "hovered" : ""}
- 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 generateMetrics
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
function generateMetrics() {
const languageCodes = walkSync(__dirname, [], [".json"])
.filter(s => !s.includes("metrics.json"))
.filter(s => !s.includes("en.json"))
.map(s => s.slice(-"en.json".length, -".json".length));
Function render
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const panelName = "designer-sequence-list";
const panelState = this.props.sequencesPanelState;
const buttonProps = Path.inDesigner()
? {
Function render
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const {
currentPlant, mapTransformProps, dragging, isEditing, visible, designer,
animate, spreadLayerVisible,
} = this.props;
Function setPinBinding
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
(ddi: DropDownItem): boolean => {
const { binding, dispatch, resources, pinNumber } = props;
const bindingUuid = binding?.uuid;
if (isUndefined(pinNumber)) {
error(t("Pin number cannot be blank."));
Function render
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const panelName = "tools";
const hasTools = this.props.tools.length > 0;
const toolSlotGroups = pointGroupSubset(this.props.groups, "ToolSlot");
const filteredGroups = toolSlotGroups
Function reindexFolders
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const reindexFolders = (i: ResourceIndex) => {
const folders = betterCompact(selectAllFolders(i)
.map((x): FolderNode | undefined => {
const { body } = x;
if (typeof body.id === "number") {
File index.tsx
has 253 lines of code (exceeds 250 allowed). Consider refactoring. Open
import React from "react";
import { connect } from "react-redux";
import { GardenMap } from "./map/garden_map";
import {
FarmDesignerProps, State, BotOriginQuadrant, isBotOriginQuadrant,
Function render
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const { env, dispatch, saveFarmwareEnv } = this.props;
const { width, height } = getCurrentSizeSetting(env);
const selectedSize = getSelection(width, height);
Function render
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const { sequence, dispatch } = this.props;
const items = (sequence.body.body || [])
.map((currentStep: SequenceBodyItem, index) => {
/** HACK: React's diff algorithm (probably?) can't keep track of steps
Function FbosDetails
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function FbosDetails(props: FbosDetailsProps) {
const { informational_settings } = props.bot.hardware;
const {
env, commit, target, node_name, firmware_version, firmware_commit,
soc_temp, wifi_level, uptime, memory_usage, disk_usage, throttled,
Function render
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const {
firmwareHardware, botOnline, resources, dispatch, bot,
} = this.props;
const { locked, sync_status } = bot.hardware.informational_settings;