FarmBot/Farmbot-Web-App

View on GitHub

Showing 612 of 1,578 total issues

Avoid too many return statements within this function.
Open

    return undefined;
Severity: Major
Found in frontend/resources/sequence_meta.ts - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

          return "";
    Severity: Major
    Found in frontend/controls/move/direction_button.tsx - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

              return formatPoint(pointer);
      Severity: Major
      Found in frontend/resources/sequence_meta.ts - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                return formatTool(findToolById(resources, tool_id), toolSlot);
        Severity: Major
        Found in frontend/resources/sequence_meta.ts - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                  return t("Axis is already at minimum position");
          Severity: Major
          Found in frontend/controls/move/direction_button.tsx - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                  return <div className={"os-download-wizard"}>
                    <div className={"os-download-wizard-run"}>
                      <p className={"os-download-wizard-note"}>
                        {t(SetupWizardContent.RPI)}
                      </p>
            Severity: Major
            Found in frontend/os_download/content.tsx - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                return generateFallbackLog("no_logs_to_display",
                  t("No logs to display. Visit Logs page to view filters."));
              Severity: Major
              Found in frontend/nav/ticker_list.tsx - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                      return "";
                Severity: Major
                Found in frontend/controls/move/home_button.tsx - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                          return t("Stall detection is disabled for one or more axes.");
                  Severity: Major
                  Found in frontend/controls/move/home_button.tsx - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                            return {
                              label: `${group.body.name} (${count})`,
                              value
                            };
                    Severity: Major
                    Found in frontend/resources/sequence_meta.ts - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                          return t("Add new");
                      Severity: Major
                      Found in frontend/resources/sequence_meta.ts - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                              return state;
                        Severity: Major
                        Found in frontend/resources/reducer_support.ts - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                                return <div className={"os-download-wizard"}>
                                  <p className={"os-download-wizard-note"}>
                                    {`${t("You have a FarmBot")} ${this.state.model} ${this.state.version}`}
                                  </p>
                                  <DownloadLink {...(DOWNLOADS()[this.state.model][
                          Severity: Major
                          Found in frontend/os_download/content.tsx - About 30 mins to fix

                            Method initialize has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                            Open

                                def initialize(parent = nil, args:, body: nil, comment: "", kind:, uuid: nil)
                                  @comment, @kind, @parent = comment, kind, parent
                            
                                  @args = args.map do |key, value|
                                    [key.to_sym, maybe_initialize(self, value, key)]
                            Severity: Minor
                            Found in app/lib/celery_script/ast_node.rb - About 25 mins 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 6 (exceeds 5 allowed). Consider refactoring.
                            Open

                              def self.create(inputs = {})
                                inputs[:device] ||= FactoryBot.create(:device, inputs[:device] || {})
                                FactoryBot.create(:user, device: inputs[:device]) if inputs[:device].users.empty?
                                inputs[:name] ||= Faker::Company.catch_phrase
                                inputs[:color] ||= Sequence::COLORS.sample
                            Severity: Minor
                            Found in spec/fake_sequence.rb - About 25 mins 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 no_rpi_analog has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                            Open

                              def self.no_rpi_analog(node)
                                args = HashWithIndifferentAccess.new(node.args)
                                pin_mode = args.fetch(:pin_mode).try(:value) || DIGITAL
                                pin_number = args.fetch(:pin_number)
                                is_analog = pin_mode == ANALOG
                            Severity: Minor
                            Found in app/models/celery_script_settings_bag.rb - About 25 mins 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 filterImagesByType has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                            Open

                            export const filterImagesByType = (designer: DesignerState) =>
                              (img: TaggedImage | undefined) => {
                                const {
                                  showPhotoImages, showCalibrationImages, showDetectionImages, showHeightImages,
                                } = designer;
                            Severity: Minor
                            Found in frontend/photos/photo_filter_settings/util.ts - About 25 mins 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 6 (exceeds 5 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: Minor
                            Found in frontend/sequences/all_steps.tsx - About 25 mins 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 setOverwriteFromLocation has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                            Open

                            export const setOverwriteFromLocation = (
                              locationSelection: string | undefined,
                              overwrite: Record<Xyz, number | string | undefined>,
                            ) => {
                              const adjustValue = (axis: Xyz) => {
                            Severity: Minor
                            Found in frontend/sequences/step_tiles/tile_computed_move/location.tsx - About 25 mins 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 process has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                            Open

                              def process(delivery_info, payload)
                                params = { routing_key: delivery_info.routing_key, payload: payload }
                                m = AmqpLogParser.run!(params)
                                THROTTLE_POLICY.track(m.device_id)
                                m.device.trim_excess_logs if rand(0..TIDY_RATE) == TIDY_RATE
                            Severity: Minor
                            Found in app/lib/log_service.rb - About 25 mins 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