FarmBot/Farmbot-Web-App

View on GitHub

Showing 646 of 1,897 total issues

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

  render() {
    return <div className={"change-password grid"}>
      <div className="row grid-exp-1">
        <label>
          {t(DeviceSetting.changePassword)}
Severity: Minor
Found in frontend/settings/account/change_password.tsx - About 1 hr to fix

    Function LandingPageSetting has 28 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export const LandingPageSetting = (props: LandingPageSettingProps) => {
      const value = "" + props.getConfigValue(StringSetting.landing_page);
      const change = (page: string) => props.dispatch(setWebAppConfigValue(
        StringSetting.landing_page, page));
      const [page, setPage] = React.useState(value);
    Severity: Minor
    Found in frontend/settings/account/account_settings.tsx - About 1 hr to fix

      Function PinNumberInputGroup has 28 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export const PinNumberInputGroup = (props: PinNumberInputGroupProps) => {
        const { pinNumberInput, boundPins, setSelectedPin } = props;
        const selectedPinNumber = isNumber(pinNumberInput)
          ? {
            label: generatePinLabel(pinNumberInput),
      Severity: Minor
      Found in frontend/settings/pin_bindings/pin_binding_input_group.tsx - About 1 hr to fix

        Function Sun has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export const Sun = (props: SunProps) => {
          const { config } = props;
        
          const { sunIntensity, sunColor } = useSpring({
            ...seasonProperties[config.plants] || seasonProperties.Spring,
        Severity: Minor
        Found in frontend/three_d_garden/sun.tsx - About 1 hr to fix

          Function ConfigFields has 28 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export function ConfigFields(props: ConfigFieldsProps): JSX.Element {
            const { farmwareName, farmwareConfigs, getValue, userEnv } = props;
            return <div className={"farmware-config-fields"}>
              {farmwareConfigs.map(config => {
                const configEnvName = getConfigEnvName(farmwareName, config.name);
          Severity: Minor
          Found in frontend/farmware/farmware_forms.tsx - About 1 hr to fix

            Function LogsRow has 28 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            const LogsRow = (props: LogsRowProps) => {
              const { tlog, timeSettings, dispatch, markdown } = props;
              const { uuid } = tlog;
              const { x, y, z, verbosity, type, created_at, message, id } = tlog.body;
              const at = moment.unix(created_at || NaN);
            Severity: Minor
            Found in frontend/logs/components/logs_table.tsx - About 1 hr to fix

              Function buildDirectionProps has 28 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export function buildDirectionProps(props: DirectionAxesProps) {
                const { firmwareSettings, botPosition, getConfigValue } = props;
                const lengths = calculateAxialLengths(props);
                return {
                  x: {
              Severity: Minor
              Found in frontend/controls/move/direction_axes_props.ts - About 1 hr to fix

                Function AxisDisplayGroup has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export const AxisDisplayGroup = (props: AxisDisplayGroupProps) => {
                  const { x, y, z } = props.position;
                  const detectionEnabled = {
                    x: !!props.firmwareSettings?.encoder_enabled_x,
                    y: !!props.firmwareSettings?.encoder_enabled_y,
                Severity: Minor
                Found in frontend/controls/axis_display_group.tsx - About 1 hr to fix

                  Function Connector has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export function Connector(props: ConnectorProps): JSX.Element {
                    const {
                      connectionData, from, to, hover, hoveredConnection, customLineProps
                    } = props;
                    const lineProps = customLineProps ? customLineProps : getLineProps(from, to);
                  Severity: Minor
                  Found in frontend/devices/connectivity/diagram.tsx - About 1 hr to fix

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

                      render() {
                        const { currentStep, currentSequence, resources,
                        } = this.props;
                        const { sequence_id } = currentStep.args;
                        const callee = sequence_id
                    Severity: Minor
                    Found in frontend/sequences/step_tiles/tile_execute.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 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                      render() {
                        const { dispatch, sequence } = this.props;
                        const { viewSequenceCeleryScript, view } = this.state;
                        const variableData = this.props.resources.sequenceMetas[sequence.uuid] || {};
                        const declarations = betterCompact(Object.values(variableData)
                    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 render has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

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

                    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 jogPoints has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                    export const jogPoints = (props: JogPointsProps) => {
                      const { keyName, points, dispatch } = props;
                      if (!(points.length > 0)) { return; }
                      const { gridSize, xySwap, quadrant } = props.mapTransformProps;
                      const horizontal = xySwap ? "deltaY" : "deltaX";
                    Severity: Minor
                    Found in frontend/farm_designer/map/layers/plants/plant_actions.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 render has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                      render() {
                        const { figureName, position, plantAreaOffset, mapTransformProps,
                        } = this.props;
                        const { xySwap } = mapTransformProps;
                        const mapSize = getMapSize(mapTransformProps, plantAreaOffset);
                    Severity: Minor
                    Found in frontend/farm_designer/map/layers/farmbot/bot_figure.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 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                      render() {
                        const goText = (axes: string) => `${t("GO")} (${axes.split("").join(", ")})`;
                        const current = this.props.currentBotLocation;
                        const target = this.props.locationCoordinate;
                        const { arduinoBusy, botOnline, dispatch, defaultAxes } = this.props;
                    Severity: Minor
                    Found in frontend/farm_designer/move_to.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 resizeBox has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                    export const resizeBox = (props: ResizeSelectionBoxProps) => {
                      if (props.selectionBox) {
                        const current = props.gardenCoords;
                        if (current) {
                          const { x0, y0 } = props.selectionBox;
                    Severity: Minor
                    Found in frontend/farm_designer/map/background/selection_box_actions.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 reduceToolName has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                    export const reduceToolName = (raw: string | undefined) => {
                      const lower = (raw || "").toLowerCase();
                      if (raw == "Empty") { return ToolName.emptyToolSlot; }
                      if (includes(lower, "rotary")) { return ToolName.rotaryTool; }
                      if (includes(lower, "weeder")) { return ToolName.weeder; }
                    Severity: Minor
                    Found in frontend/farm_designer/map/tool_graphics/all_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

                    Function CIRCLES has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                    const CIRCLES = ({ firmwareHardware, clean }: CirclesProps) => [
                      ...(hasExtraButtons(firmwareHardware)
                        ? [{ cx: 20, cy: 20, r: 7, pin: 20, label: t("Button 5"), color: Color.white }]
                        : []),
                      ...(hasExtraButtons(firmwareHardware)
                    Severity: Minor
                    Found in frontend/settings/pin_bindings/box_top_gpio_diagram.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 WeedInventoryItem has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                    export const WeedInventoryItem = (props: WeedInventoryItemProps) => {
                      const navigate = useNavigate();
                      const weed = props.tpp.body;
                      const { tpp, dispatch } = props;
                      const weedId = (weed.id || "ERR_NO_POINT_ID").toString();
                    Severity: Minor
                    Found in frontend/weeds/weed_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 toggleEqCriteria has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                      <T extends string | number>(
                        eqCriteria: EqCriteria<T>,
                        direction?: "on" | "off",
                      ) => (key: string, value: T) => {
                        const values: T[] = eqCriteria[key] || [];
                    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

                    Severity
                    Category
                    Status
                    Source
                    Language