FarmBot/Farmbot-Web-App

View on GitHub

Showing 612 of 1,578 total issues

Function ToolSlotPoint has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

export const ToolSlotPoint = (props: TSPProps) => {
  const { tool, toolSlot } = props.slot;
  const {
    id, x, y, pullout_direction, gantry_mounted
  } = toolSlot.body;
Severity: Minor
Found in frontend/farm_designer/map/layers/tool_slots/tool_slot_point.tsx - About 1 hr 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 maybeOpenPanel has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

export const maybeOpenPanel = (panelKey: "settings" | "photos" = "settings") =>
  (dispatch: Function) => {
    if (getUrlQuery("only") || getUrlQuery("search")) {
      dispatch(bulkToggleControlPanel(true));
      return;
Severity: Minor
Found in frontend/settings/maybe_highlight.tsx - About 1 hr 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 EncodersOrStallDetection has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

export function EncodersOrStallDetection(props: EncodersOrStallDetectionProps) {

  const { encoders_or_stall_detection } = props.settingsPanelState;
  const {
    dispatch, sourceFwConfig, firmwareHardware, arduinoBusy, showAdvanced,
Severity: Minor
Found in frontend/settings/hardware_settings/encoders_or_stall_detection.tsx - About 1 hr 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 DataLabels has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

const DataLabels = (props: DataLabelsProps) => {
  const { curve, showHoverEffect } = props;
  const { normX, normY } = props.plotTools;
  const { data, type } = curve.body;
  const label = (plus: string) =>
Severity: Minor
Found in frontend/curves/chart.tsx - About 1 hr 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 11 (exceeds 5 allowed). Consider refactoring.
Open

  render() {
    const finalBack = () => {
      if (this.state.version != Version["v1.6"]) { return "version"; }
      if (this.state.pi) { return "pi"; }
      return "run";
Severity: Minor
Found in frontend/os_download/content.tsx - About 1 hr 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 computeCoordinate has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const computeCoordinate = (props: ComputeCoordinateProps): Vector3 => {
  const { botPosition } = props;
  const coordinate = {
    x: botPosition.x || 0,
    y: botPosition.y || 0,
Severity: Minor
Found in frontend/sequences/step_tiles/tile_computed_move/compute.ts - About 1 hr to fix

    Function generateVariableListItems has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export const generateVariableListItems = (props: GenerateVariableListProps) => {
      const { allowedVariableNodes, resources, sequenceUuid } = props;
      const headingId = props.headingId || "Variable";
      const variables = sortVariables(Object.values(
        resources.sequenceMetas[sequenceUuid] || [])).map(v => v.celeryNode);
    Severity: Minor
    Found in frontend/sequences/locals_list/variable_form.tsx - About 1 hr to fix

      Function updateLhs has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        (props: LhsUpdateProps) => {
          const { currentStep, currentSequence, dispatch, index, resources } = props;
          return (ddi: DropDownItem) => {
            const stepCopy = defensiveClone(currentStep);
            const seqCopy = defensiveClone(currentSequence).body;
      Severity: Minor
      Found in frontend/sequences/step_tiles/tile_if/update_lhs.ts - About 1 hr to fix

        Function PointSortMenu has 31 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export const PointSortMenu = (props: PointSortMenuProps) => {
          const sortTerm = props.sortOptions.sortBy;
          const defaultSelected = sortTerm ? "" : "selected";
          const byAgeSelected = sortTerm == "created_at" ? "selected" : "";
          const byNameSelected = sortTerm == "name" ? "selected" : "";
        Severity: Minor
        Found in frontend/farm_designer/sort_options.tsx - About 1 hr to fix

          Function render has 31 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            render() {
              const panelName = "designer-regimen-list";
              return <DesignerPanel panelName={panelName} panel={Panel.Regimens}>
                <DesignerNavTabs />
                <DesignerPanelTop
          Severity: Minor
          Found in frontend/regimens/list/list.tsx - About 1 hr to fix

            Function joinFarmEventsToExecutable has 31 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export function joinFarmEventsToExecutable(
              input: ResourceIndex): FarmEventWithExecutable[] {
              const farmEvents: TaggedFarmEvent[] = selectAllFarmEvents(input);
              const sequenceById = indexSequenceById(input);
              const regimenById = indexRegimenById(input);
            Severity: Minor
            Found in frontend/farm_events/calendar/selectors.ts - About 1 hr to fix

              Function curveDataTableRow has 31 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                ([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" : ""}
                    onMouseEnter={() => setHovered(day)}
              Severity: Minor
              Found in frontend/curves/edit_curve.tsx - About 1 hr to fix

                Function Companions has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                const Companions = (props: CropInfoListProps) => {
                  const { result, dispatch, openfarmCropFetch } = props;
                  if (result.companions.length == 0) { return <div />; }
                  return <InfoField title={"companions"}>
                    {result.companions.map((companion, index) =>
                Severity: Minor
                Found in frontend/plants/crop_info.tsx - About 1 hr to fix

                  Function LogsTable has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export const LogsTable = (props: LogsTableProps) => {
                    return <div className={"logs-table-wrapper"}>
                      <table className={LOG_TABLE_CLASS}>
                        <thead>
                          <tr>
                  Severity: Minor
                  Found in frontend/logs/components/logs_table.tsx - About 1 hr to fix

                    Function If_ has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    export function If_(props: StepParams<If>) {
                      const { currentStep, resources } = props;
                      const sequence = props.currentSequence;
                      const { op } = currentStep.args;
                      const lhsOptions = LHSOptions(resources, !!props.showPins);
                    Severity: Minor
                    Found in frontend/sequences/step_tiles/tile_if/if.tsx - About 1 hr to fix

                      Function SequenceSettingsMenu has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        (props: SequenceSettingsMenuProps) => {
                          const { dispatch, getWebAppConfigValue } = props;
                          const commonProps = { dispatch, getWebAppConfigValue };
                          return <div className="sequence-settings-menu">
                            <SequenceSetting {...commonProps}
                      Severity: Minor
                      Found in frontend/sequences/sequence_editor_middle_active.tsx - About 1 hr to fix

                        Function PhotoFooter has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        export const PhotoFooter = (props: PhotoFooterProps) => {
                          const { image, timeSettings } = props;
                          const created_at = image
                            ? formatTime(moment(image.body.created_at), timeSettings, "MMMM Do, YYYY")
                            : "";
                        Severity: Minor
                        Found in frontend/photos/images/photos.tsx - About 1 hr to fix

                          Function render has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            render() {
                              const panelName = "designer-sequence-editor";
                              const { sequence } = this.state;
                              const viewCeleryScript = this.props.getWebAppConfigValue(
                                BooleanSetting.view_celery_script);
                          Severity: Minor
                          Found in frontend/sequences/panel/preview.tsx - About 1 hr to fix

                            Function GardenMapLegend has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            export function GardenMapLegend(props: GardenMapLegendProps) {
                              const { getConfigValue } = props;
                              const menuClass = props.legendMenuOpen ? "active" : "";
                              const [zDisplayOpen, setZDisplayOpen] = React.useState(false);
                              return <div className={`garden-map-legend ${menuClass} ${props.className}`}>
                            Severity: Minor
                            Found in frontend/farm_designer/map/legend/garden_map_legend.tsx - About 1 hr to fix

                              Function newPlantKindAndBody has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              export const newPlantKindAndBody = (props: NewPlantKindAndBodyProps): {
                                kind: TaggedPlant["kind"],
                                body: TaggedPlant["body"],
                              } => {
                                const savedGardenId = props.openedSavedGarden || undefined;
                              Severity: Minor
                              Found in frontend/farm_designer/map/layers/plants/plant_actions.ts - About 1 hr to fix
                                Severity
                                Category
                                Status
                                Source
                                Language