FarmBot/Farmbot-Web-App

View on GitHub

Showing 646 of 1,897 total issues

Function RawEditZone has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const RawEditZone = (props: EditZoneProps) => {
  const getZone = () => {
    const stringyID = Path.getSlug(Path.zones());
    if (stringyID) {
      return props.findZone(parseInt(stringyID));
Severity: Minor
Found in frontend/zones/edit_zone.tsx - About 1 hr to fix

    Function FarmBotSettings has 36 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export const FarmBotSettings = (props: FarmbotSettingsProps) => {
      const {
        dispatch, device, timeSettings, sourceFbosConfig, botOnline, showAdvanced, bot,
      } = props;
      const { value } = props.sourceFbosConfig("firmware_hardware");
    Severity: Minor
    Found in frontend/settings/fbos_settings/farmbot_os_settings.tsx - About 1 hr to fix

      Function PinBindingsList has 36 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export const PinBindingsList = (props: PinBindingsListProps) => {
        const { pinBindings, resources, dispatch } = props;
      
        const deleteBinding = (pin: number, uuid?: string) => {
          if (!sysBtnBindings.includes(pin)) {
      Severity: Minor
      Found in frontend/settings/pin_bindings/pin_bindings_list.tsx - About 1 hr to fix

        Function urlFor has 36 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export function urlFor(tag: ResourceName) {
          const OPTIONS: Partial<Record<ResourceName, string>> = {
            Alert: API.current.alertPath,
            Curve: API.current.curvesPath,
            Device: API.current.devicePath,
        Severity: Minor
        Found in frontend/api/crud.ts - About 1 hr to fix

          Function ProfileViewer has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

          export const ProfileViewer = (props: ProfileViewerProps) => {
            const { dispatch } = props;
            const { profileOpen, profileFollowBot } = props.designer;
            const axis = props.designer.profileAxis;
            const panelStatus = getPanelStatus();
          Severity: Minor
          Found in frontend/farm_designer/map/profile/viewer.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 UTMProfile has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

          export const UTMProfile = (props: ProfileUtmProps) => {
            const { x, y } = props.botPosition;
            const inProfile = !isUndefined(x) && !isUndefined(y) &&
              withinProfileRange({
                axis: props.profileAxis == "x" ? "y" : "x",
          Severity: Minor
          Found in frontend/farm_designer/map/profile/tools.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

          Method execute has 35 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def execute
                ActiveRecord::Base.transaction do
                  flat_ir
                    .each do |node|
                    # Step 1- instantiate records.
          Severity: Minor
          Found in app/lib/celery_script/first_pass.rb - About 1 hr to fix

            Function ImagingDataManagement has 35 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 WeedPoint has 35 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export const WeedPoint = (props: ProfilePointProps<TaggedWeedPointer>) => {
                const { point } = props;
                const { radius } = point.body;
                const color = point.body.meta.color || Color.red;
                const plantIconSize = scaleIcon(radius) * 2;
              Severity: Minor
              Found in frontend/farm_designer/map/profile/plants_and_weeds.tsx - About 1 hr to fix

                Function ThreeInOneToolHead has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export const ThreeInOneToolHead = (props: ThreeInOneToolHeadProps) => {
                  const { pulloutDirection } = props;
                  const { quadrant, xySwap } = props.toolTransformProps;
                  const angle = toolbaySlotAngle(pulloutDirection, quadrant, xySwap);
                  return <g id="three-in-one-tool-head">
                Severity: Minor
                Found in frontend/farm_designer/map/tool_graphics/three_in_one_toolhead.tsx - About 1 hr to fix

                  Function DistanceIndicator has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export const DistanceIndicator = (props: DistanceIndicatorProps) => {
                    const { start, end } = props;
                    const dx = end.x - start.x;
                    const dy = end.y - start.y;
                    const dz = end.z - start.z;
                  Severity: Minor
                  Found in frontend/three_d_garden/distance_indicator.tsx - About 1 hr to fix

                    Function modifyConfig has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    export const modifyConfig = (config: Config, update: Partial<Config>) => {
                      const newConfig: Config = { ...config, ...update };
                      if (update.sizePreset) {
                        const presetConfig = PRESETS[update.sizePreset];
                        SIZE_CONFIG_KEYS.map(key => newConfig[key] = presetConfig[key] as never);
                    Severity: Minor
                    Found in frontend/three_d_garden/config.ts - About 1 hr to fix

                      Function RpiModel has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      export const RpiModel = (props: RpiModelProps) => {
                        const selection = props.device.body.rpi;
                        const check = (rpi: string | undefined, target: string) => {
                          switch (rpi) {
                            case "02":
                      Severity: Minor
                      Found in frontend/settings/fbos_settings/rpi_model.tsx - About 1 hr to fix

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

                          render() {
                            const { group } = this.props;
                            const groupsPath = Path.groups();
                            !group && Path.startsWith(groupsPath) && history.back();
                            return <DesignerPanel panelName={"group-detail"} panel={Panel.Groups}>
                        Severity: Minor
                        Found in frontend/point_groups/group_detail.tsx - About 1 hr to fix

                          Function PinBindingsContent has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          export const PinBindingsContent = (props: PinBindingsContentProps) => {
                            const { dispatch, resources, firmwareHardware } = props;
                            const pinBindings = apiPinBindings(resources);
                            return <div className="pin-bindings">
                              <Highlight settingName={DeviceSetting.stockPinBindings}>
                          Severity: Minor
                          Found in frontend/settings/pin_bindings/pin_bindings_content.tsx - About 1 hr to fix

                            Function LogSetting has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            const LogSetting = (props: LogSettingProps) => {
                              const { label, setting, toolTip, setFilterLevel, sourceFbosConfig } = props;
                              /** Update the current filter level to a minimum needed for log display. */
                              const updateMinFilterLevel = (key: keyof Filters, level: number) => {
                                const currentLevel =
                            Severity: Minor
                            Found in frontend/logs/components/settings_menu.tsx - About 1 hr to fix

                              Function ScaleMenu has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              export const ScaleMenu = (props: ActionMenuProps) => {
                                const { data } = props.curve.body;
                                const [maxDayNum, setMaxDay] = React.useState(maxDay(data));
                                const [maxValueNum, setMaxValue] = React.useState(maxValue(data));
                                return <div className={"curve-action-menu grid"}>
                              Severity: Minor
                              Found in frontend/curves/edit_curve.tsx - About 1 hr to fix

                                Function PointsSection has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                const PointsSection = (props: PointsSectionProps) => {
                                  const { genericPoints, isOpen, dispatch, averageZ, toggleAction } = props;
                                  return <div className={`points-section ${isOpen ? "open" : ""}`}>
                                    <div className={"points-section-header row grid-exp-1"} onClick={props.toggleOpen}>
                                      {props.color && <Saucer color={props.color} />}
                                Severity: Minor
                                Found in frontend/points/point_inventory.tsx - About 1 hr to fix

                                  Function ShownInMapDetails has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                  const ShownInMapDetails = (props: ImageShowProps) => {
                                    const { dispatch, image, flags, size } = props;
                                    const shownInMap = every(Object.values(flags));
                                    return <div className={`shown-in-map-details ${shownInMap ? "shown" : ""}`}
                                      onMouseEnter={() => shownInMap && dispatch(highlightMapImage(image?.body.id))}
                                  Severity: Minor
                                  Found in frontend/photos/images/image_show_menu.tsx - About 1 hr to fix

                                    Function waterFigure has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                    function waterFigure(
                                      props: { i: number, cx: number, cy: number, animate: boolean }) {
                                      const { i, cx, cy, animate } = props;
                                      const color = "rgb(11, 83, 148)";
                                      const copies = animate ? 3 : 1;
                                    Severity: Minor
                                    Found in frontend/farm_designer/map/layers/farmbot/bot_peripherals.tsx - About 1 hr to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language