FarmBot/Farmbot-Web-App

View on GitHub

Showing 610 of 1,573 total issues

Function regimenCalendarAdder has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

const regimenCalendarAdder = (
  index: ResourceIndex, timeSettings: TimeSettings) =>
  (f: FarmEventWithRegimen, c: Calendar, now = moment()) => {
    const { regimen_items } = f.executable;
    const gracePeriod = itemGracePeriod(now);
Severity: Minor
Found in frontend/farm_events/map_state_to_props.ts - About 25 mins to fix

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 CameraCheckBase has a Cognitive Complexity of 6 (exceeds 5 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
Severity: Minor
Found in frontend/wizard/checks.tsx - About 25 mins to fix

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 VerticalGridlines has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

const VerticalGridlines = (props: PlotProps) =>
  <g id="vertical-gridlines">
    {range(props.timeStep, props.timePeriod + 1, props.timeStep).map(x => {
      const id = "vertical_gridline_" + x;
      /** label & major gridline every 3 hours/days/months and every week day */
Severity: Minor
Found in frontend/sensors/sensor_readings/graph.tsx - About 25 mins to fix

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 occurrence has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export function occurrence(
  m: moment.Moment,
  fe: FarmEventWithExecutable,
  timeSettings: TimeSettings,
  resources: ResourceIndex,
Severity: Minor
Found in frontend/farm_events/calendar/occurrence.ts - About 25 mins to fix

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 determineVarDDILabel has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  (props: DetermineVarDDILabelProps): string => {
    const { label, resources, uuid, forceExternal } = props;
    if (forceExternal) { return t("Externally defined"); }
    const variable = maybeFindVariable(label, resources, uuid);
    if (variable) {
Severity: Minor
Found in frontend/resources/sequence_meta.ts - About 25 mins to fix

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 is has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

const is = (r: ResourceName) => function isOfTag(x: object): x is TaggedResource {
  const safe = (sanityCheck(x) && isTaggedResource(x) && x.kind == r);
  if (!safe) {
    if (x) {
      throw new Error("Possible bad index");
Severity: Minor
Found in frontend/resources/tagged_resources.ts - About 25 mins to fix

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 render has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  render() {
    const {
      stepSize, arduinoBusy, locked, getConfigValue, env, highlightHome,
      highlightAxis, highlightDirection, botPosition, botOnline, dispatch,
    } = this.props;
Severity: Minor
Found in frontend/controls/move/jog_buttons.tsx - About 25 mins to fix

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 render has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  render() {
    const {
      direction, axis, locked, arduinoBusy, botOnline, botPosition, movementState,
    } = this.props;
    const title = `${t("move {{axis}} axis", { axis })} (${this.distance})`;
Severity: Minor
Found in frontend/controls/move/direction_button.tsx - About 25 mins to fix

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 render has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  render() {
    const i = this.props.bot.hardware.informational_settings;
    const isLocked = !!i.locked;
    const toggleEmergencyLock = isLocked
      ? () => emergencyUnlock(this.props.forceUnlock)
Severity: Minor
Found in frontend/nav/e_stop_btn.tsx - About 25 mins to fix

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 confirmationChecker has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

const confirmationChecker = (resourceName: ResourceName, force: boolean) =>
  <T>(proceed: () => T): T | undefined => {
    if (MUST_CONFIRM_LIST.includes(resourceName)) {
      if (force || confirm(t("Are you sure you want to delete this item?"))) {
        return proceed();
Severity: Minor
Found in frontend/api/crud.ts - About 25 mins to fix

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

Severity
Category
Status
Source
Language