Showing 646 of 1,897 total issues
Function checkCriteria
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
Open
(criteria: PointGroupCriteria, now: moment.Moment) =>
(point: TaggedPoint, criteriaKey: keyof PointGroupCriteria) => {
switch (criteriaKey) {
case "string_eq":
case "number_eq":
- 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 ConnectivityRow
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
Open
export function ConnectivityRow(props: StatusRowProps) {
const {
connectionStatus, connectionName, hoveredConnection, syncStatus,
} = props;
const colorClass = colorLookup["" + connectionStatus];
- 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 IfBlockDropDownHandler
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const IfBlockDropDownHandler = (props: ThenElseParams) => {
const { dispatch, index, thenElseKey } = props;
const step = props.currentStep;
const sequence = props.currentSequence;
Function mapStateToProps
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function mapStateToProps(props: Everything): SequencesProps {
const uuid = props.resources.consumers.sequences.current;
const sequence = uuid ? findSequence(props.resources.index, uuid) : undefined;
(sequence?.body.body || []).map(x => getStepTag(x));
Method create
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def create
request_body = request.raw_post
heroku_signature = request.headers['Heroku-Webhook-Hmac-SHA256']
secret = ENV['HEROKU_WEBHOOK_SECRET']
Function GardenPoint
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const GardenPoint = (props: GardenPointProps) => {
const iconHover = (action: "start" | "end") => () => {
const hover = action === "start";
props.dispatch({
Function MoveControls
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const MoveControls = (props: MoveControlsProps) => {
const { location_data, informational_settings } = props.bot.hardware;
const locationData = validBotLocationData(location_data);
const botOnline = isBotOnlineFromState(props.bot);
const { busy, locked } = props.bot.hardware.informational_settings;
Function GardenSnapshot
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const GardenSnapshot = (props: GardenSnapshotProps) => {
const [gardenName, setGardenName] = React.useState("");
const [gardenNotes, setGardenNotes] = React.useState("");
const navigate = useNavigate();
Function PlantInventoryItem
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const PlantInventoryItem = (props: PlantInventoryItemProps) => {
const [iconState, setIconState] = React.useState("");
const navigate = useNavigate();
const { plant, dispatch } = props;
Function render
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const { sequence, sequencesState } = this.props;
const { stepIndex } = sequencesState;
const sequenceSelected = sequence && isTaggedSequence(sequence);
const sequenceOpen = sequenceSelected ? "open" : "";
Function NumericInput
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const NumericInput = (props: NumericInputProps) => {
const { variableNode } = props;
const isPlaceholder = variableNode.kind == "parameter_application"
&& variableNode.args.data_value.kind == "number_placeholder";
const argsValue = variableNode.kind == "parameter_declaration"
Function TextInput
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const TextInput = (props: TextInputProps) => {
const { variableNode } = props;
const isPlaceholder = variableNode.kind == "parameter_application"
&& variableNode.args.data_value.kind == "text_placeholder";
const argsValue = variableNode.kind == "parameter_declaration"
Function items
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
.map((currentStep: SequenceBodyItem, index) => {
/** HACK: React's diff algorithm (probably?) can't keep track of steps
* via `index` alone- the content is too dynamic (copy/splice/pop/push)
* To get around this, we add a `uuid` property to Steps that
* is guaranteed to be unique no matter where the step gets moved and
Function AutoGenerateButton
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const AutoGenerateButton = (props: AutoGenerateButtonProps) => {
const {
dispatch, sequence, isProcessing, setTitleProcessing, setColorProcessing,
} = props;
return <i title={t("auto-generate sequence title and color")}
Function VirtualFarmBot
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function VirtualFarmBot(props: VirtualFarmBotProps) {
const {
mapTransformProps, plantAreaOffset, peripheralValues, eStopStatus,
getConfigValue,
} = props;
Function Caster
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const Caster = (props: CasterProps) => {
const {
bedHeight, bedZOffset, legSize, legsFlush,
} = props.config;
const casterHeight = legSize * 1.375;
Function render
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const {
email,
onEmailChange,
onSubmit,
Function FolderNameEditor
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const FolderNameEditor = (props: FolderNodeProps) => {
const { node } = props;
const [settingsOpen, setSettingsOpen] = React.useState(false);
const [hovered, setHovered] = React.useState(false);
return <div
Function tosForm
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
tosForm() {
if (this.tosLoadOk) {
const agree = this.state.agree_to_terms;
return <form onSubmit={this.submit}>
<div className="input-group">
Function connectivityData
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const connectivityData = (props: ConnectivityDataProps) => {
const fwVersion = props.bot.hardware
.informational_settings.firmware_version;
/** A record of all the things we know about connectivity right now. */