FarmBot/Farmbot-Web-App

View on GitHub

Showing 646 of 1,897 total issues

Function PhotoButtons has 40 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const PhotoButtons = (props: PhotoButtonsProps) => {
  const { imageUrl } = props;
  const { image, dispatch, flags, size } = props;
  const imageShowMenuProps = { dispatch, flags, image, size };
  return <div className={"photo-action-buttons"}>
Severity: Minor
Found in frontend/photos/images/photos.tsx - About 1 hr to fix

    Function preparePositions has 40 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const preparePositions = (
      sequenceBody: SequenceBodyItem[],
      initialPosition: BotPosition,
      sequenceUuid: UUID | undefined,
    ) => {
    Severity: Minor
    Found in frontend/farm_designer/map/sequence_visualization.tsx - About 1 hr to fix

      Function PlantSlugBulkUpdate has 40 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export const PlantSlugBulkUpdate = (props: PlantSlugBulkUpdateProps) => {
        const plants = props.allPoints.filter(point =>
          props.selected.includes(point.uuid) && point.kind === "Point" &&
          point.body.pointer_type == "Plant")
          .map((p: TaggedPlantPointer) => p);
      Severity: Minor
      Found in frontend/plants/edit_plant_status.tsx - About 1 hr to fix

        Function ImportedBanner has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

        export const ImportedBanner = (props: ImportedBannerProps) => {
          const versionId = props.sequence.body.sequence_version_id;
          const allIds = sortBy(props.sequence.body.sequence_versions);
          const latestId = last(allIds);
          const versionList = sequenceVersionList(allIds);
        Severity: Minor
        Found in frontend/sequences/sequence_editor_middle_active.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 setPinMode has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

        export function setPinMode(ddi: DropDownItem, stepParams: StepParams) {
          const { dispatch, currentStep, index, currentSequence } = stepParams;
          dispatch(editStep({
            sequence: currentSequence,
            step: currentStep,
        Severity: Minor
        Found in frontend/sequences/step_tiles/pin_support/mode.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 13 (exceeds 5 allowed). Consider refactoring.
        Open

          render() {
            const {
              current, selected, dragging, plant, mapTransformProps,
              activeDragXY, zoomLvl, animate, editing, hovered, hoveredSpread,
            } = this.props;
        Severity: Minor
        Found in frontend/farm_designer/map/layers/plants/garden_plant.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 TileMoveRelative has 39 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export const TileMoveRelative = (props: StepParams) => {
          const { dispatch, currentStep, index, currentSequence } = props;
          return <StepWrapper {...props}
            className={"move-relative-step"}
            helpText={ToolTips.MOVE_RELATIVE}>
        Severity: Minor
        Found in frontend/sequences/step_tiles/tile_move_relative.tsx - About 1 hr to fix

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

            render() {
              const {
                sensorReading, mapTransformProps, endTime, timeSettings, sensorLookup
              } = this.props;
              const { id, x, y, value, mode, created_at, pin } = sensorReading.body;

            Function Solar has 39 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export const Solar = (props: SolarProps) => {
              const { config } = props;
              const zGround = -config.bedZOffset - config.bedHeight;
              return <Group name={"solar"}
                visible={config.solar || props.activeFocus == "What you need to provide"}>
            Severity: Minor
            Found in frontend/three_d_garden/solar.tsx - About 1 hr to fix

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

                render() {
              
                  return <div className="static-page">
                    <div className="all-content-wrapper">
                      <h1 className="text-center">
              Severity: Minor
              Found in frontend/password_reset/password_reset.tsx - About 1 hr to fix

                Function stockPeripherals has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  get stockPeripherals() {
                    const BASE_PERIPHERALS = [
                      { pin: 7, label: t("Lighting") },
                      { pin: 8, label: t("Water") },
                      { pin: 9, label: t("Vacuum") },
                Severity: Minor
                Found in frontend/controls/peripherals/index.tsx - About 1 hr to fix

                  Function GridInput has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export function GridInput(props: GridInputProps) {
                    const { xy_swap } = props;
                    const vertical = "fa-arrows-v";
                    const horizontal = "fa-arrows-h";
                    return <div className="grid">
                  Severity: Minor
                  Found in frontend/plants/grid/grid_input.tsx - About 1 hr to fix

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

                      render() {
                        const { toolName, uuid } = this.state;
                        const alreadyAdded = !uuid && !this.filterExisting(toolName);
                        const panelName = "add-tool";
                        return <DesignerPanel panelName={panelName} panel={Panel.Tools}>
                    Severity: Minor
                    Found in frontend/tools/add_tool.tsx - About 1 hr to fix

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

                        render() {
                          const { logs, botOnline, imageJobs, env } = this.props;
                          const { clickedAt } = this.state;
                          const camDisabled = cameraBtnProps(env, botOnline);
                          const job = imageJobs.filter(x => greaterThanTime(x.updated_at, clickedAt))[0];
                      Severity: Minor
                      Found in frontend/controls/move/take_photo_button.tsx - About 1 hr to fix

                        Function AdditionalMenu has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        export const AdditionalMenu = (props: AccountMenuProps) => {
                          return <div className="nav-additional-menu">
                            <div className={"account-link"}>
                              <Link to={Path.settings("account")}
                                onClick={props.close("accountMenuOpen")}>
                        Severity: Minor
                        Found in frontend/nav/additional_menu.tsx - About 1 hr to fix

                          Function searchFolderTree has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          export const searchFolderTree = (props: FolderSearchProps): FolderUnion[] => {
                            // A folder is included if:
                            //   * CASE 3: The name is a search match
                            //   * CASE 4: It contains a sequence that is a match.
                            //   * CASE 5: It has a child that has a search match.
                          Severity: Minor
                          Found in frontend/folders/search_folder_tree.ts - About 1 hr to fix

                            Method emit_nodes has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            def emit_nodes()
                              nodes = NODES.map do |node|
                                tags = node.fetch("tags").sort.uniq
                                # Don't publish internal CeleryScript nodes:
                                next if tags.include?(:private)
                            Severity: Minor
                            Found in latest_corpus.rb - About 1 hr to fix

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

                                render() {
                                  const confirmStepDeletion =
                                    !!this.getConfigValue(BooleanSetting.confirm_step_deletion);
                                  const step = this.props.currentStep;
                                  const executeSequence = step.kind == "execute" && step.args.sequence_id
                              Severity: Minor
                              Found in frontend/sequences/step_ui/step_wrapper.tsx - About 1 hr to fix

                                Function PointLayer has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                export function PointLayer(props: PointLayerProps) {
                                  const { visible, genericPoints, mapTransformProps, designer } = props;
                                  const { cameraViewGridId, hoveredPoint, gridIds, soilHeightLabels } = designer;
                                  const soilHeightPoints = genericPoints.filter(soilHeightPoint);
                                  const getColor = getSoilHeightColor(soilHeightPoints);
                                Severity: Minor
                                Found in frontend/farm_designer/map/layers/points/point_layer.tsx - About 1 hr to fix

                                  Function SoilSensor has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                  export const SoilSensor = (props: ToolGraphicProps) => {
                                    const { x, y, hovered } = props;
                                    const width = SoilSensorDimensions.width;
                                    const pcbWidth = width / 3;
                                    const height = SoilSensorDimensions.thickness;
                                  Severity: Minor
                                  Found in frontend/farm_designer/map/tool_graphics/soil_sensor.tsx - About 1 hr to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language