FarmBot/Farmbot-Web-App

View on GitHub

Showing 646 of 1,897 total issues

File test_fixtures.ts has 256 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { ComputedMoveState, LocSelection, AxisSelection } from "./interfaces";
import { Move } from "farmbot";

export const fakeNumericMoveStepState: ComputedMoveState = ({
  locationSelection: LocSelection.identifier,
Severity: Minor
Found in frontend/sequences/step_tiles/tile_computed_move/test_fixtures.ts - About 2 hrs to fix

    Method provide_feedback has 53 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def provide_feedback(message, slug = "Not provided")
        webhook_url = ENV["FEEDBACK_WEBHOOK_URL"]
        if webhook_url
          email = self.users.pluck(:email).join(" ")
          name = self.users.first.name
    Severity: Major
    Found in app/models/device.rb - About 2 hrs to fix

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

        render() {
          const { imageWidth, imageHeight } = this.state;
          const { image, cameraCalibrationData, mapTransformProps, cropImage,
          } = this.props;
          const imageRotation = parse(cameraCalibrationData.rotation) ?? 0;
      Severity: Major
      Found in frontend/farm_designer/map/layers/images/map_image.tsx - About 2 hrs to fix

        Function HomeButton has 53 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export const HomeButton = (props: HomeButtonProps) => {
          const { doFindHome, homeDirection, locked, arduinoBusy, botOnline } = props;
          const icon = doFindHome ? "fa-search" : "fa-arrow-right";
          const style = doFindHome ? {} : { transform: `rotate(${homeDirection}deg)` };
          const disabledAxes = disabledAxisMap(props.firmwareSettings);
        Severity: Major
        Found in frontend/controls/move/home_button.tsx - About 2 hrs to fix

          Function DaySelection has 53 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export const DaySelection = (props: DaySelectionProps) => {
            const { group, criteria, dispatch, advanced } = props;
            const dayCriteria = criteria.day;
            const noDayCriteria = !advanced &&
              dayCriteriaEmpty(dayCriteria) && !props.dayChanged;
          Severity: Major
          Found in frontend/point_groups/criteria/show.tsx - About 2 hrs to fix

            File image_filter_menu.tsx has 254 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import React from "react";
            import { BlurableInput, MarkedSlider } from "../../ui";
            import { offsetTime } from "../../farm_events/edit_fe_form";
            import moment from "moment";
            import {
            Severity: Minor
            Found in frontend/photos/photo_filter_settings/image_filter_menu.tsx - About 2 hrs to fix

              Function createOrUpdateTranslationFile has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
              Open

                export function createOrUpdateTranslationFile(
                  langInput: string | undefined = "en",
                  metricsOnly?: boolean,
                ): SummaryData | undefined {
                  const lang = langInput.slice(0, 2);
              Severity: Minor
              Found in public/app-resources/languages/_helper.ts - About 2 hrs 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 create has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
              Open

                def create
                  request_body = request.raw_post
                  heroku_signature = request.headers['Heroku-Webhook-Hmac-SHA256']
                  secret = ENV['HEROKU_WEBHOOK_SECRET']
              
              
              Severity: Minor
              Found in app/controllers/webhooks_controller.rb - About 2 hrs 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 curveDataTableRow has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
              Open

              export const curveDataTableRow = (props: CurveDataTableRowProps) =>
                ([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" : ""}
              Severity: Minor
              Found in frontend/curves/edit_curve.tsx - About 2 hrs 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 generateMetrics has 52 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function generateMetrics() {
                const languageCodes = walkSync(__dirname, [], [".json"])
                  .filter(s => !s.includes("metrics.json"))
                  .filter(s => !s.includes("en.json"))
                  .map(s => s.slice(-"en.json".length, -".json".length));
              Severity: Major
              Found in public/app-resources/languages/_helper.ts - About 2 hrs to fix

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

                  render() {
                    const panelName = "designer-sequence-list";
                    const panelState = this.props.sequencesPanelState;
                    const buttonProps = Path.inDesigner()
                      ? {
                Severity: Major
                Found in frontend/sequences/panel/list.tsx - About 2 hrs to fix

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

                    render() {
                      const {
                        currentPlant, mapTransformProps, dragging, isEditing, visible, designer,
                        animate, spreadLayerVisible,
                      } = this.props;
                  Severity: Major
                  Found in frontend/farm_designer/map/active_plant/hovered_plant.tsx - About 2 hrs to fix

                    Function setPinBinding has 52 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      (ddi: DropDownItem): boolean => {
                        const { binding, dispatch, resources, pinNumber } = props;
                        const bindingUuid = binding?.uuid;
                        if (isUndefined(pinNumber)) {
                          error(t("Pin number cannot be blank."));
                    Severity: Major
                    Found in frontend/settings/pin_bindings/actions.ts - About 2 hrs to fix

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

                        render() {
                          const panelName = "tools";
                          const hasTools = this.props.tools.length > 0;
                          const toolSlotGroups = pointGroupSubset(this.props.groups, "ToolSlot");
                          const filteredGroups = toolSlotGroups
                      Severity: Major
                      Found in frontend/tools/index.tsx - About 2 hrs to fix

                        Function reindexFolders has 52 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        export const reindexFolders = (i: ResourceIndex) => {
                          const folders = betterCompact(selectAllFolders(i)
                            .map((x): FolderNode | undefined => {
                              const { body } = x;
                              if (typeof body.id === "number") {
                        Severity: Major
                        Found in frontend/resources/reducer_support.ts - About 2 hrs to fix

                          File index.tsx has 253 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          import React from "react";
                          import { connect } from "react-redux";
                          import { GardenMap } from "./map/garden_map";
                          import {
                            FarmDesignerProps, State, BotOriginQuadrant, isBotOriginQuadrant,
                          Severity: Minor
                          Found in frontend/farm_designer/index.tsx - About 2 hrs to fix

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

                              render() {
                                const { env, dispatch, saveFarmwareEnv } = this.props;
                                const { width, height } = getCurrentSizeSetting(env);
                                const selectedSize = getSelection(width, height);
                            
                            
                            Severity: Major
                            Found in frontend/photos/capture_settings/capture_size_selection.tsx - About 2 hrs to fix

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

                                render() {
                                  const { sequence, dispatch } = this.props;
                                  const items = (sequence.body.body || [])
                                    .map((currentStep: SequenceBodyItem, index) => {
                                      /** HACK: React's diff algorithm (probably?) can't keep track of steps
                              Severity: Major
                              Found in frontend/sequences/all_steps.tsx - About 2 hrs to fix

                                Function FbosDetails has 51 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                export function FbosDetails(props: FbosDetailsProps) {
                                  const { informational_settings } = props.bot.hardware;
                                  const {
                                    env, commit, target, node_name, firmware_version, firmware_commit,
                                    soc_temp, wifi_level, uptime, memory_usage, disk_usage, throttled,
                                Severity: Major
                                Found in frontend/settings/fbos_settings/fbos_details.tsx - About 2 hrs to fix

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

                                    render() {
                                      const {
                                        firmwareHardware, botOnline, resources, dispatch, bot,
                                      } = this.props;
                                      const { locked, sync_status } = bot.hardware.informational_settings;
                                  Severity: Major
                                  Found in frontend/settings/pin_bindings/box_top_gpio_diagram.tsx - About 2 hrs to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language