FarmBot/Farmbot-Web-App

View on GitHub

Showing 646 of 1,897 total issues

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

  render() {
    const syncLoaded = this.isLoaded;
    const { bot, dispatch, getConfigValue } = this.props;
    const landingPage = getConfigValue(StringSetting.landing_page);
    return <div className="app">
Severity: Major
Found in frontend/app.tsx - About 2 hrs to fix

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

      render() {
        const { dispatch } = this.props;
        return <DesignerPanel panelName={"plant-selection"}
          panelColor={PanelColor.lightGray}>
          <DesignerPanelHeader
    Severity: Major
    Found in frontend/plants/select_plants.tsx - About 2 hrs to fix

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

      export const AxisActions = (props: AxisActionsProps) => {
        const {
          axis, arduinoBusy, locked, hardwareDisabled, botOnline,
          dispatch, botPosition, sourceFwConfig,
        } = props;
      Severity: Major
      Found in frontend/controls/move/bot_position_rows.tsx - About 2 hrs to fix

        Function mapImagePositionData has 49 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export const mapImagePositionData = (props: MapImagePositionDataProps):
          MapImagePositionData | undefined => {
          const { cameraCalibrationData, alreadyRotated, noRotation } = props;
          const imageRotated = alreadyRotated && !noRotation;
          const parsed = parseCalibrationData(cameraCalibrationData);
        Severity: Minor
        Found in frontend/farm_designer/map/layers/images/map_image.tsx - About 1 hr to fix

          Function hotkeysWithActions has 49 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export const hotkeysWithActions = (
            navigate: (path: string) => void,
            dispatch: Function,
            slug: string,
          ) => {
          Severity: Minor
          Found in frontend/hotkeys.tsx - About 1 hr to fix

            Function CurveSvg has 49 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export const CurveSvg = (props: CurveSvgProps) => {
              const { curve, dispatch, editable, hovered, setHovered } = props;
              const { data } = curve.body;
              const normX = normDay(data);
              const normY = normValue(data);
            Severity: Minor
            Found in frontend/curves/chart.tsx - About 1 hr to fix

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

                render() {
                  return <svg
                    id="rpi-gpio"
                    width="100%"
                    height="100%"
              Severity: Minor
              Found in frontend/settings/pin_bindings/rpi_gpio_diagram.tsx - About 1 hr to fix

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

                  render() {
                    const OuterWrapper = ({ children }: { children: React.ReactNode }) =>
                      globalConfig.ROLLBAR_CLIENT_TOKEN
                        ? <RollbarProvider config={{
                          accessToken: globalConfig.ROLLBAR_CLIENT_TOKEN,
                Severity: Minor
                Found in frontend/routes.tsx - About 1 hr to fix

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

                    render() {
                      const { isEditing } = this.state;
                      const status = getArrayStatus(this.props.sensors);
                      const editButtonText = isEditing
                        ? t("Back")
                  Severity: Minor
                  Found in frontend/sensors/index.tsx - About 1 hr to fix

                    Function FarmEventRepeatForm has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    export function FarmEventRepeatForm(props: FarmEventRepeatFormProps) {
                      const { disabled, fieldSet, repeat, endDate, endTime, timeUnit } = props;
                      return props.hidden
                        ? <div className={"no-repeat-form"} />
                        : <div className="farm-event-repeat-form row">
                    Severity: Minor
                    Found in frontend/farm_events/farm_event_repeat_form.tsx - About 1 hr to fix

                      Function ToolSlotInventoryItem has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      export const ToolSlotInventoryItem = (props: ToolSlotInventoryItemProps) => {
                        const { x, y, z, id, tool_id, gantry_mounted } = props.toolSlot.body;
                        const toolName = props.tools
                          .filter(tool => tool.body.id == tool_id)[0]?.body.name;
                        const navigate = useNavigate();
                      Severity: Minor
                      Found in frontend/tools/index.tsx - About 1 hr to fix

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

                          render() {
                            const { group, dispatch, slugs } = this.props;
                            const { criteria } = group.body;
                            const commonProps = { group, criteria, dispatch };
                            const dayProps = {
                        Severity: Minor
                        Found in frontend/point_groups/criteria/component.tsx - About 1 hr to fix

                          Function mapStateToPropsAddEdit has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          export function mapStateToPropsAddEdit(props: Everything): AddEditFarmEventProps {
                            const executableList: DropDownItem[] = [
                              { label: t("Sequences"), heading: true, value: 0, headingId: "Sequence" },
                              ...addExecutables(selectAllSequences(props.resources.index)),
                              { label: t("Regimens"), heading: true, value: 0, headingId: "Regimen" },
                          Severity: Minor
                          Found in frontend/farm_events/map_state_to_props_add_edit.ts - About 1 hr to fix

                            Function IfBlockDropDownHandler has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                            Open

                            export const IfBlockDropDownHandler = (props: ThenElseParams) => {
                            
                              const { dispatch, index, thenElseKey } = props;
                              const step = props.currentStep;
                              const sequence = props.currentSequence;
                            Severity: Minor
                            Found in frontend/sequences/step_tiles/tile_if/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

                            Method stale_data? has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                            Open

                                def stale_data?
                                  if resource
                                    updated_at = raw_json[:updated_at]
                                    if updated_at
                                      if resource.updated_at.as_json != updated_at
                            Severity: Minor
                            Found in app/controllers/api/abstract_controller.rb - 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 getMode has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                            Open

                            export const getMode = (): Mode => {
                              if (store.getState().resources.consumers.farm_designer.profileOpen) {
                                return Mode.profile;
                              }
                              const panelSlug = Path.getSlug(Path.designer());
                            Severity: Minor
                            Found in frontend/farm_designer/map/util.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 getAlignment has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                            Open

                            function getAlignment(
                              activeXYZ: BotPosition | undefined,
                              plantXYZ: BotPosition,
                              swappedXY: Boolean,
                            ): Alignment {
                            Severity: Minor
                            Found in frontend/farm_designer/map/active_plant/drag_helpers.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 toolbaySlotAngle has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                            Open

                            export const toolbaySlotAngle = (
                              pulloutDirection: ToolPulloutDirection,
                              quadrant: BotOriginQuadrant,
                              xySwap: boolean) => {
                              const rawAngle = () => {
                            Severity: Minor
                            Found in frontend/farm_designer/map/layers/tool_slots/tool_graphics.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 semverCompare has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                            Open

                            export function semverCompare(left: string, right: string): SemverResult {
                              const leftSemVer = left.split("-")[0];
                              const rightSemVer = right.split("-")[0];
                              const leftHasSuffix = left.includes("-");
                              const rightHasSuffix = right.includes("-");
                            Severity: Minor
                            Found in frontend/util/version.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 modifyConfig has a Cognitive Complexity of 15 (exceeds 5 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

                            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