FarmBot/Farmbot-Web-App

View on GitHub

Showing 646 of 1,897 total issues

Function ConnectivityRow has 45 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function ConnectivityRow(props: StatusRowProps) {
  const {
    connectionStatus, connectionName, hoveredConnection, syncStatus,
  } = props;
  const colorClass = colorLookup["" + connectionStatus];
Severity: Minor
Found in frontend/devices/connectivity/connectivity_row.tsx - About 1 hr to fix

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

      render() {
        const { dispatch, index, currentStep, currentSequence } = this.props;
        return <StepWrapper {...this.props}
          className={"send-message-step"}
          helpText={t(ToolTips.SEND_MESSAGE)}>
    Severity: Minor
    Found in frontend/sequences/step_tiles/tile_send_message.tsx - About 1 hr to fix

      Function ChangeFirmwarePath has 44 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export const ChangeFirmwarePath = (props: ChangeFirmwarePathProps) => {
        const OPTIONS: Record<string, DropDownItem> = {
          "": { label: t("Change firmware path to..."), value: "" },
          ttyACM0: { label: t("ttyACM0 (recommended for Genesis)"), value: "ttyACM0" },
          ttyAMA0: {
      Severity: Minor
      Found in frontend/settings/firmware/firmware_path.tsx - About 1 hr to fix

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

          render() {
            const { setFilterLevel, sourceFbosConfig, getConfigValue } = this.props;
            const LogSettingRow = (settingProps: LogSettingRecord) => {
              const { label, setting, tooltip } = settingProps;
              return <LogSetting
        Severity: Minor
        Found in frontend/logs/components/settings_menu.tsx - About 1 hr to fix

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

            render() {
              const { props } = this;
              const feeds = sortedFeeds(this.props.feeds).map(x => x.body);
              const flipper = new Flipper(feeds, FALLBACK_FEED, this.state.current);
              const msg = this.getMessage(flipper.current.url);
          Severity: Minor
          Found in frontend/controls/webcam/show.tsx - About 1 hr to fix

            Function render has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
            Open

              render() {
                const { H_LO, H_HI, S_LO, S_HI, V_LO, V_HI } = this.props;
                const cameraCalibrationEnv = this.props.namespace("H_LO").includes("CAMERA");
                const defaultHLow = this.getDefault(cameraCalibrationEnv ? "H_HI" : "H_LO");
                const defaultHHigh = this.getDefault(cameraCalibrationEnv ? "H_LO" : "H_HI");
            Severity: Minor
            Found in frontend/photos/image_workspace/index.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 GardenPoint has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
            Open

            export const GardenPoint = (props: GardenPointProps) => {
            
              const iconHover = (action: "start" | "end") => () => {
                const hover = action === "start";
                props.dispatch({
            Severity: Minor
            Found in frontend/farm_designer/map/layers/points/garden_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 GardenWeed has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
            Open

            export const GardenWeed = (props: GardenWeedProps) => {
              const [iconHovered, setIconHovered] = React.useState(false);
            
              const iconHover = (action: "start" | "end") => () => {
                const startHover = action === "start";
            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

            Function editGtLtCriteriaField has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
            Open

            export const editGtLtCriteriaField = (
              group: TaggedPointGroup,
              criteriaField: "number_gt" | "number_lt",
              criteriaKey: string,
              pointerType?: PointerType,
            Severity: Minor
            Found in frontend/point_groups/criteria/edit.ts - 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 Data has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
            Open

            const Data = (props: DataProps) => {
              const { curve, setHovered, showHoverEffect, dragging } = props;
              const { normX, normY, yZero, yMax } = props.plotTools;
              const { data, type } = curve.body;
              const fullWidth = X_MAX / maxDay(data);
            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 PlantInventoryItem has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
            Open

            export const PlantInventoryItem = (props: PlantInventoryItemProps) => {
              const [iconState, setIconState] = React.useState("");
              const navigate = useNavigate();
            
              const { plant, dispatch } = props;
            Severity: Minor
            Found in frontend/plants/plant_inventory_item.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 43 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              render() {
                const {
                  className,
                  currentSequence,
                  currentStep,
            Severity: Minor
            Found in frontend/sequences/step_ui/step_header.tsx - About 1 hr to fix

              Function prepareLocation has 43 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              const prepareLocation = (ddi: DropDownItem): {
                locationNode: LocationNode | undefined,
                locationSelection: LocSelection | undefined,
              } => {
                switch (ddi.headingId) {
              Severity: Minor
              Found in frontend/sequences/step_tiles/tile_computed_move/location.tsx - About 1 hr to fix

                Function generateReducer has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export function generateReducer<State>(initialState: State) {
                  /** A function that is passed the state, action and action handler.
                   * This is useful if you have custom business logic that needs to exit early
                   * or trigger alternative action handlers. Example: Not triggering
                   * INIT_RESOURCE when UI is set to "read-only" mode. */
                Severity: Minor
                Found in frontend/redux/generate_reducer.ts - About 1 hr to fix

                  Method if_topic_is_safe has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      def if_topic_is_safe
                        if farmbot_demo?
                          a, b, c = (routing_key_param || "").split(".")
                  
                          if !(permission_param == "read")
                  Severity: Minor
                  Found in app/controllers/api/rmq_utils_controller.rb - About 1 hr to fix

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

                      render() {
                        const {
                          visible, images, mapTransformProps, cameraCalibrationData,
                          getConfigValue,
                        } = this.props;
                    Severity: Minor
                    Found in frontend/farm_designer/map/layers/images/image_layer.tsx - About 1 hr to fix

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

                        render() {
                          const { x, y } = this.props.chosenLocation;
                          const { botOnline, locked } = this.props;
                          return <div className={"move-to-form"}>
                            <Row className="move-to-grid">
                      Severity: Minor
                      Found in frontend/farm_designer/move_to.tsx - About 1 hr to fix

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

                          render() {
                            return <div className={"grid-and-row-planting"}>
                              <h3>{t("Add Grid or Row")}</h3>
                              <GridInput
                                key={JSON.stringify(this.state.grid)}
                        Severity: Minor
                        Found in frontend/plants/grid/plant_grid.tsx - About 1 hr to fix

                          Function SequenceShareMenu has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          export const SequenceShareMenu = (props: SequenceShareMenuProps) => {
                            const { sequence } = props;
                            const disabled = sequence.specialStatus !== SpecialStatus.SAVED;
                            const ids = sortBy(sequence.body.sequence_versions);
                            const linkPath = Path.sequenceVersion(last(ids));
                          Severity: Minor
                          Found in frontend/sequences/sequence_editor_middle_active.tsx - About 1 hr to fix

                            Method plants has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                  def plants(product_line)
                                    spinach_row_count = product_line.include?("xl") ? 28 : 13
                                    spinach_col_count = product_line.include?("xl") ? 4 : 2
                                    (0..(spinach_row_count - 1)).map do |i|
                                      (0..(spinach_col_count - 1)).map do |j|
                            Severity: Minor
                            Found in app/mutations/devices/seeders/demo_account_seeder.rb - About 1 hr to fix
                              Severity
                              Category
                              Status
                              Source
                              Language