FarmBot/Farmbot-Web-App

View on GitHub

Showing 646 of 1,897 total issues

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

  (criteria: PointGroupCriteria, now: moment.Moment) =>
    (point: TaggedPoint, criteriaKey: keyof PointGroupCriteria) => {
      switch (criteriaKey) {
        case "string_eq":
        case "number_eq":
Severity: Minor
Found in frontend/point_groups/criteria/apply.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 ConnectivityRow has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

export function ConnectivityRow(props: StatusRowProps) {
  const {
    connectionStatus, connectionName, hoveredConnection, syncStatus,
  } = props;
  const colorClass = colorLookup["" + connectionStatus];
Severity: Minor
Found in frontend/devices/connectivity/connectivity_row.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 IfBlockDropDownHandler has 47 lines of code (exceeds 25 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

    Function mapStateToProps has 47 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export function mapStateToProps(props: Everything): SequencesProps {
      const uuid = props.resources.consumers.sequences.current;
      const sequence = uuid ? findSequence(props.resources.index, uuid) : undefined;
      (sequence?.body.body || []).map(x => getStepTag(x));
    
    
    Severity: Minor
    Found in frontend/sequences/state_to_props.ts - About 1 hr to fix

      Method create has 47 lines of code (exceeds 25 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 1 hr to fix

        Function GardenPoint has 47 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export const GardenPoint = (props: GardenPointProps) => {
        
          const iconHover = (action: "start" | "end") => () => {
            const hover = action === "start";
            props.dispatch({
        Severity: Minor
        Found in frontend/farm_designer/map/layers/points/garden_point.tsx - About 1 hr to fix

          Function MoveControls has 47 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export const MoveControls = (props: MoveControlsProps) => {
            const { location_data, informational_settings } = props.bot.hardware;
            const locationData = validBotLocationData(location_data);
            const botOnline = isBotOnlineFromState(props.bot);
            const { busy, locked } = props.bot.hardware.informational_settings;
          Severity: Minor
          Found in frontend/controls/move/move_controls.tsx - About 1 hr to fix

            Function GardenSnapshot has 47 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export const GardenSnapshot = (props: GardenSnapshotProps) => {
              const [gardenName, setGardenName] = React.useState("");
              const [gardenNotes, setGardenNotes] = React.useState("");
              const navigate = useNavigate();
            
            
            Severity: Minor
            Found in frontend/saved_gardens/garden_snapshot.tsx - About 1 hr to fix

              Function PlantInventoryItem has 47 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export const PlantInventoryItem = (props: PlantInventoryItemProps) => {
                const [iconState, setIconState] = React.useState("");
                const navigate = useNavigate();
              
                const { plant, dispatch } = props;
              Severity: Minor
              Found in frontend/plants/plant_inventory_item.tsx - About 1 hr to fix

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

                  render() {
                    const { sequence, sequencesState } = this.props;
                    const { stepIndex } = sequencesState;
                    const sequenceSelected = sequence && isTaggedSequence(sequence);
                    const sequenceOpen = sequenceSelected ? "open" : "";
                Severity: Minor
                Found in frontend/sequences/sequences.tsx - About 1 hr to fix

                  Function NumericInput has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export const NumericInput = (props: NumericInputProps) => {
                    const { variableNode } = props;
                    const isPlaceholder = variableNode.kind == "parameter_application"
                      && variableNode.args.data_value.kind == "number_placeholder";
                    const argsValue = variableNode.kind == "parameter_declaration"
                  Severity: Minor
                  Found in frontend/sequences/locals_list/variable_form.tsx - About 1 hr to fix

                    Function TextInput has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    export const TextInput = (props: TextInputProps) => {
                      const { variableNode } = props;
                      const isPlaceholder = variableNode.kind == "parameter_application"
                        && variableNode.args.data_value.kind == "text_placeholder";
                      const argsValue = variableNode.kind == "parameter_declaration"
                    Severity: Minor
                    Found in frontend/sequences/locals_list/variable_form.tsx - About 1 hr to fix

                      Function items has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                            .map((currentStep: SequenceBodyItem, index) => {
                              /** HACK: React's diff algorithm (probably?) can't keep track of steps
                               * via `index` alone- the content is too dynamic (copy/splice/pop/push)
                               * To get around this, we add a `uuid` property to Steps that
                               * is guaranteed to be unique no matter where the step gets moved and
                      Severity: Minor
                      Found in frontend/sequences/all_steps.tsx - About 1 hr to fix

                        Function AutoGenerateButton has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        export const AutoGenerateButton = (props: AutoGenerateButtonProps) => {
                          const {
                            dispatch, sequence, isProcessing, setTitleProcessing, setColorProcessing,
                          } = props;
                          return <i title={t("auto-generate sequence title and color")}
                        Severity: Minor
                        Found in frontend/sequences/panel/editor.tsx - About 1 hr to fix

                          Function VirtualFarmBot has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          export function VirtualFarmBot(props: VirtualFarmBotProps) {
                            const {
                              mapTransformProps, plantAreaOffset, peripheralValues, eStopStatus,
                              getConfigValue,
                            } = props;
                          Severity: Minor
                          Found in frontend/farm_designer/map/layers/farmbot/index.tsx - About 1 hr to fix

                            Function Caster has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            export const Caster = (props: CasterProps) => {
                              const {
                                bedHeight, bedZOffset, legSize, legsFlush,
                              } = props.config;
                              const casterHeight = legSize * 1.375;
                            Severity: Minor
                            Found in frontend/three_d_garden/caster.tsx - About 1 hr to fix

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

                                render() {
                                  const {
                                    email,
                                    onEmailChange,
                                    onSubmit,
                              Severity: Minor
                              Found in frontend/front_page/login.tsx - About 1 hr to fix

                                Function FolderNameEditor has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                export const FolderNameEditor = (props: FolderNodeProps) => {
                                  const { node } = props;
                                  const [settingsOpen, setSettingsOpen] = React.useState(false);
                                  const [hovered, setHovered] = React.useState(false);
                                  return <div
                                Severity: Minor
                                Found in frontend/folders/component.tsx - About 1 hr to fix

                                  Function tosForm has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                    tosForm() {
                                      if (this.tosLoadOk) {
                                        const agree = this.state.agree_to_terms;
                                        return <form onSubmit={this.submit}>
                                          <div className="input-group">
                                  Severity: Minor
                                  Found in frontend/tos_update/component.tsx - About 1 hr to fix

                                    Function connectivityData has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                    export const connectivityData = (props: ConnectivityDataProps) => {
                                      const fwVersion = props.bot.hardware
                                        .informational_settings.firmware_version;
                                    
                                      /** A record of all the things we know about connectivity right now. */
                                    Severity: Minor
                                    Found in frontend/devices/connectivity/generate_data.ts - About 1 hr to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language