FarmBot/Farmbot-Web-App

View on GitHub

Showing 612 of 1,578 total issues

Function ZDisplay has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const ZDisplay = (props: ZDisplayProps) => {
  const tools = props.allPoints.filter(p => p.body.pointer_type == "ToolSlot")
    .map(p => p.body.z).sort()[0];
  const soil = props.allPoints.filter(soilHeightPoint)
    .map(p => p.body.z).sort()[0];
Severity: Minor
Found in frontend/farm_designer/map/legend/z_display.tsx - About 1 hr to fix

    Function responseRejected has 33 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export function responseRejected(x: SafeError | undefined) {
      if (x && isSafeError(x)) {
        dispatchNetworkUp("user.api", now());
        const a = ![451, 401, 422].includes(x.response.status);
        const b = x.response.status > 399;
    Severity: Minor
    Found in frontend/interceptors.ts - About 1 hr to fix

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

        render() {
          return <div className={"drop-area"} {...this.mapDropAreaProps()}>
            <ErrorBoundary>
              <svg id={"map-background-svg"}>
                <this.MapBackground />
      Severity: Minor
      Found in frontend/farm_designer/map/garden_map.tsx - About 1 hr to fix

        Function BindingTargetDropdown has 33 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export const BindingTargetDropdown = (props: BindingTargetDropdownProps) => {
          const list = () => {
            const { resources } = props;
            const dropDownList: DropDownItem[] = [];
        
        
        Severity: Minor
        Found in frontend/settings/pin_bindings/pin_binding_input_group.tsx - About 1 hr to fix

          Function Setting has 33 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export const Setting = (props: SettingProps) => {
            const { title, setting, numberSetting, callback, defaultOn } = props;
            const raw_value = setting ? props.getConfigValue(setting) : undefined;
            const value = (defaultOn && isUndefined(raw_value)) ? true : !!raw_value;
            return <Highlight settingName={title}>
          Severity: Minor
          Found in frontend/settings/farm_designer_settings.tsx - About 1 hr to fix

            Function mapStateToProps has 33 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export function mapStateToProps(props: Everything): EditPlantInfoProps {
              const openedSavedGarden =
                props.resources.consumers.farm_designer.openedSavedGarden;
              const gardenOpen = !!openedSavedGarden;
              const findPlant = (id: string | undefined) => {
            Severity: Minor
            Found in frontend/plants/map_state_to_props.ts - About 1 hr to fix

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

                render() {
                  /** Change document meta title on every route change. */
                  updatePageInfo(Path.getSlug(Path.app()), Path.getSlug(Path.designer()));
              
                  return <ErrorBoundary>
              Severity: Minor
              Found in frontend/nav/index.tsx - About 1 hr to fix

                Function deletePoints has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export function deletePoints(
                  pointName: string,
                  query: Partial<Point>,
                  cb?: ProgressCallback): Thunk {
                  // TODO: Generalize and add to api/crud.ts
                Severity: Minor
                Found in frontend/api/delete_points.ts - About 1 hr to fix

                  Function SlotLocationInputRow has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export const SlotLocationInputRow = (props: SlotLocationInputRowProps) => {
                    const x = props.gantryMounted
                      ? props.botPosition.x ?? props.slotLocation.x
                      : props.slotLocation.x;
                    const { y, z } = props.slotLocation;
                  Severity: Minor
                  Found in frontend/tools/tool_slot_edit_components.tsx - About 1 hr to fix

                    Function SequenceItemDescription has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    const SequenceItemDescription = (props: SequenceItemDescriptionProps) => {
                      const { sequence, inUse } = props;
                      const deprecatedSteps = JSON.stringify(props.sequence.body.body)
                        .includes("resource_update");
                      const { pinned, forked, sequence_version_id, description } = props.sequence.body;
                    Severity: Minor
                    Found in frontend/folders/component.tsx - About 1 hr to fix

                      Function Diagnosis has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      export function Diagnosis(props: DiagnosisProps) {
                        const diagnosisBoolean = diagnosisStatus(props.statusFlags);
                        const diagnosisColor = diagnosisBoolean ? "green" : "red";
                        return <div className={"diagnosis-section"}>
                          <div className={"connectivity-diagnosis"}>
                      Severity: Minor
                      Found in frontend/devices/connectivity/diagnosis.tsx - About 1 hr to fix

                        Function variableFormList has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        export function variableFormList(
                          resources: ResourceIndex,
                          additionalItems: DropDownItem[],
                          variableItems?: DropDownItem[],
                          displayGroups?: boolean,
                        Severity: Minor
                        Found in frontend/sequences/locals_list/variable_form_list.ts - About 1 hr to fix

                          Function mapStateToProps has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          export const mapStateToProps = (props: Everything): DesignerPhotosProps => {
                            const images = getImages(props.resources.index);
                            const env = getEnv(props.resources.index);
                          
                            const versions: Record<string, string> = {};
                          Severity: Minor
                          Found in frontend/photos/state_to_props.ts - About 1 hr to fix

                            Function ImagingDataManagement has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            export const ImagingDataManagement = (props: ImagingDataManagementProps) => {
                              const [advanced, setAdvanced] = React.useState(false);
                              return <div className={"imaging-data-management"}>
                                <Highlight settingName={DeviceSetting.highlightModifiedSettings}
                                  pathPrefix={Path.photos}>
                            Severity: Minor
                            Found in frontend/photos/data_management/index.tsx - About 1 hr to fix

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

                                render() {
                                  return <Row className={"change-password zero-side-margins"}>
                                    <label>
                                      {t(DeviceSetting.changePassword)}
                                    </label>
                              Severity: Minor
                              Found in frontend/settings/account/change_password.tsx - About 1 hr to fix

                                Function CurveSvgWithPopover has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                export const CurveSvgWithPopover = (props: CurveSvgWithPopoverProps) => {
                                  const [open, setOpen] = React.useState(false);
                                  const warnings = getWarningLinesContent({
                                    curve: props.curve,
                                    sourceFbosConfig: props.sourceFbosConfig,
                                Severity: Minor
                                Found in frontend/curves/chart.tsx - About 1 hr to fix

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

                                    render() {
                                      return <DesignerPanel panelName={"groups"} panel={Panel.Groups}>
                                        <DesignerNavTabs />
                                        <DesignerPanelTop
                                          panel={Panel.Groups}
                                  Severity: Minor
                                  Found in frontend/point_groups/group_list_panel.tsx - About 1 hr to fix

                                    Function NumberLtGtInput has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                    export const NumberLtGtInput = (props: NumberLtGtInputProps) => {
                                      const { group, dispatch, criteriaKey } = props;
                                      const gtCriteria = props.group.body.criteria.number_gt;
                                      const ltCriteria = props.group.body.criteria.number_lt;
                                      return <Row>
                                    Severity: Minor
                                    Found in frontend/point_groups/criteria/show.tsx - About 1 hr to fix

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

                                      export function namedPin2DropDown(ri: ResourceIndex, input: NamedPin | Nothing):
                                        DropDownItem | undefined {
                                        if (input.kind === "named_pin") {
                                          const { pin_type } = input.args;
                                          if (isPinType(pin_type)) {

                                      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 {
                                            weed, mapTransformProps, hovered, current, selected, animate,
                                            radiusVisible, dispatch,
                                          } = this.props;
                                      Severity: Minor
                                      Found in frontend/farm_designer/map/layers/weeds/garden_weed.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

                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language