FarmBot/Farmbot-Web-App

View on GitHub

Showing 612 of 1,578 total issues

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

export const requestAutoGeneration = (props: RequestAutoGenerationProps) => {
  fetch(API.current.aiPath, {
    method: "post",
    headers: {
      Authorization: `Bearer: ${store.getState().auth?.token.encoded}`,
Severity: Minor
Found in frontend/sequences/request_auto_generation.ts - About 1 hr to fix

    Method typical_sequence has 28 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def self.typical_sequence
          {
            kind: "sequence",
            name: "move_abs(1,2,3), move_rel(4,5,6), write_pin(13, off, digital)",
            color: "gray",
    Severity: Minor
    Found in spec/mutations/flat_ir_stuff/flat_ir_helpers.rb - About 1 hr to fix

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

      export function MapBackground(props: MapBackgroundProps) {
        const { mapTransformProps, plantAreaOffset, templateView } = props;
        const gridSize = getMapSize(mapTransformProps);
        const boardWidth = 20;
        const mapSize = getMapSize(mapTransformProps, plantAreaOffset);
      Severity: Minor
      Found in frontend/farm_designer/map/background/map_background.tsx - About 1 hr to fix

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

          (dispatch: Function) => {
            dispatch({ type: Actions.OF_SEARCH_RESULTS_START, payload: undefined });
            (specific
              ? openFarmSearchQuerySpecific(searchTerm)
              : openFarmSearchQuery(searchTerm))
        Severity: Minor
        Found in frontend/farm_designer/util.ts - About 1 hr to fix

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

          export function SpreadLayer(props: SpreadLayerProps) {
            const {
              plants, visible, mapTransformProps, currentPlant, hoveredSpread,
              dragging, zoomLvl, activeDragXY, activeDragSpread, editing, animate
            } = props;
          Severity: Minor
          Found in frontend/farm_designer/map/layers/spread/spread_layer.tsx - About 1 hr to fix

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

              render() {
                const { radius, x, y, id } = this.props.plant.body;
                const { visible, mapTransformProps, animate } = this.props;
                const { qx, qy } = transformXY(round(x), round(y), mapTransformProps);
                const spreadDiaCm = this.state.loaded
            Severity: Minor
            Found in frontend/farm_designer/map/layers/spread/spread_layer.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 WizardStepHeader has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export const WizardStepHeader = (props: WizardStepHeaderProps) => {
                  const stepOpen = props.stepOpen == props.step.slug;
                  const resultDate = props.stepResult?.updated_at;
                  const stepDone = props.stepResult?.answer;
                  const stepFail = stepDone == false;
                Severity: Minor
                Found in frontend/wizard/step.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 render has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      render() {
                        return <Highlight settingName={DeviceSetting.farmbotOS}
                          hidden={!this.props.showAdvanced}
                          className={"advanced"}>
                          <Row>
                    Severity: Minor
                    Found in frontend/settings/fbos_settings/farmbot_os_row.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 render has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          render() {
                            const { eqCriteria, criteriaKey, group, dispatch } = this.props;
                            return <div className={`${this.props.type}-eq-criteria`}>
                              <AddEqCriteria<T> group={group} dispatch={dispatch}
                                type={this.props.type} eqCriteria={eqCriteria}
                        Severity: Minor
                        Found in frontend/point_groups/criteria/show.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 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 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 { 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 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 {
                                    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 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 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

                              Severity
                              Category
                              Status
                              Source
                              Language