Showing 646 of 1,897 total issues
Function triggerBinding
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
(resources: ResourceIndex, botOnline: boolean) =>
(pin: number) =>
() => {
const binding = findBinding(resources)(pin);
if (!botOnline || !binding) { return; }
- 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 Job
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
const Job = (props: JobProps) => (job: JobProgressWithTitle) => {
const percent = job.unit == "percent" && job.percent;
const color = percent == 100 ? Color.green : Color.yellow;
return <tr key={job.title}>
<td className={"job-name"} title={job.title}>
- 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 FolderListItem
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
export const FolderListItem = (props: FolderItemProps) => {
const { sequence, movedSequenceUuid, inUse } = props;
const seqName = sequence.body.name;
const url = Path.sequences(urlFriendly(seqName || ""));
const moveSource = movedSequenceUuid === sequence.uuid ? "move-source" : "";
- 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 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def execute
# LEGACY SHIM:
# 1. CelerySlicer inserts a `nothing` node at the start of the flat_ast
# 2. The new Fragment table expects an ENTRY node at position 0 of the
# flat_ast
Function getOverwriteState
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const getOverwriteState = (step: Move, axis: Xyz): {
selection: AxisSelection | undefined,
overwrite: string | number | undefined,
} => {
const overwrite = step.body?.reverse().find(x =>
Function SequenceSelectBox
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function SequenceSelectBox(props: SequenceSelectBoxProps) {
const sequenceDropDownList = () => {
const { resources } = props;
const dropDownList: DropDownItem[] = [];
Method execute
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def execute
klass = Class.new(Mutations::Command)
klass.instance_variable_set("@resource", resource)
Function FeaturedSequenceListItem
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
const FeaturedSequenceListItem = (props: FeaturedSequenceListItemProps) => {
const { item } = props;
const [importing, setImporting] = React.useState(false);
const [descriptionOpen, setDescriptionOpen] = React.useState(false);
return <li className={"sequence-list-item"}>
Function rotaryFigure
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
function rotaryFigure(
props: { i: number, cx: number, cy: number, animate: boolean }) {
const { i, cx, cy, animate } = props;
const color = "black";
const copies = animate ? 3 : 1;
Function vacuumFigure
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
function vacuumFigure(
props: { i: number, cx: number, cy: number, animate: boolean }) {
const { i, cx, cy, animate } = props;
const color = "black";
const copies = animate ? 3 : 1;
Function FarmwareInfo
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function FarmwareInfo(props: FarmwareInfoProps) {
const { farmware } = props;
return farmware
? <div className="farmware-info">
<label>{t("Description")}</label>
Function Promo
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const Promo = () => {
const [config, setConfig] = React.useState<Config>(INITIAL);
const [toolTip, setToolTip] = React.useState<ToolTip>({ timeoutId: 0, text: "" });
const [activeFocus, setActiveFocus] = React.useState("");
const common = {
Function CameraCheckBase
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
const CameraCheckBase = (props: CameraCheckBaseProps) => {
const images = selectAllImages(props.resources);
const getLastImageId = () => last(images)?.body.id;
const [prevImageId, setPrevImageId] = React.useState(getLastImageId());
const newImageUrls = images
Function PowerAndResetMenu
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const PowerAndResetMenu = (props: PowerAndResetMenuProps) => {
const { botOnline } = props;
return <div className={"power-and-reset-menu"}>
<FbosButtonRow
botOnline={botOnline}
Function YAxis
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
const YAxis = (props: YAxisProps) => {
const { data } = props.curve.body;
const { normY, xMax } = props.plotTools;
const thirds = maxValue(data) / 3;
const yStep = floor(thirds, 1 - ("" + floor(thirds)).length);
Function checkCriteria
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
(point: TaggedPoint, criteriaKey: keyof PointGroupCriteria) => {
switch (criteriaKey) {
case "string_eq":
case "number_eq":
return every(Object.entries(criteria[criteriaKey])
Function resourceList
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
(resources: ResourceIndex, sequenceUuid: UUID): DropDownItem[] => {
const deviceId = maybeGetDevice(resources)?.body.id || 0;
const points = selectAllPoints(resources).filter(p => !!p.body.id);
const mapPoints = points.filter(p => p.body.pointer_type == "GenericPointer");
const weeds = points.filter(p => p.body.pointer_type == "Weed");
Function render
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const H_AVG = this.props.invertHue
? 0
: ((this.props.h[1] * 2 + this.props.h[0] * 2) / 2);
/** 💥💥💥SURPRISING CODE AHEAD:
Function sanitizeNodes
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const sanitizeNodes = (thisSequence: Sequence): SanitizationResult => {
// Collect all *declared* variables.
const declared: Dictionary<ScopeDeclarationBodyItem> = {};
(thisSequence.args.locals.body || []).map(variable =>
declared[variable.args.label] = variable);
Function BoolConfig
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const BoolConfig = (props: BoolConfigProps) => {
const value = !!props.wdEnvGet(props.configKey);
return <Highlight settingName={props.settingName}
hidden={props.advanced && !(props.showAdvanced || props.modified)}
className={props.advanced ? "advanced" : undefined}