HabitatMap/AirCasting

View on GitHub

Showing 239 of 667 total issues

Function fetchUsernames has 56 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  fetchUsernames: (params) => {
    const {
      usernames,
      tags,
      west,
Severity: Major
Found in app/javascript/react/api/apiEndpoints.ts - About 2 hrs to fix

    Function updateMonthsInView has 55 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        updateMonthsInView: function () {
          if (this.endDate) {
            //if both dates are visible already, do nothing
            if (
              !this.singleDatePicker &&
    Severity: Major
    Found in app/javascript/jquery.ui.daterangepicker.js - About 2 hrs to fix

      Function sharedWebpackConfig has 55 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const sharedWebpackConfig = (mode) => {
        const isProduction = mode === "production";
        const hash = isProduction ? "-[contenthash]" : "";
        const publicPath = isProduction
          ? `/${publicOutputPath}/`
      Severity: Major
      Found in config/webpack/base.js - About 2 hrs to fix

        Function updateSessionType has 55 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            (selectedSessionType: SessionType) => {
              setUrlParams([
                { key: UrlParamsTypes.sessionType, value: selectedSessionType },
                {
                  key: UrlParamsTypes.previousUserSettings,
        Severity: Major
        Found in app/javascript/react/utils/mapParamsHandler.ts - About 2 hrs to fix

          Method call has 54 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def call(server:, token:, amount:, session_name:)
                now = Time.current
                data = {
                  calibration: 100,
                  contribute: true,
          Severity: Major
          Found in lib/aircasting/bomb_server_with_measurements.rb - About 2 hrs to fix

            Function fetchTags has 54 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              fetchTags: (params) => {
                const {
                  tags,
                  west,
                  east,
            Severity: Major
            Found in app/javascript/react/api/apiEndpoints.ts - About 2 hrs to fix

              Function params has 53 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              const params = () => {
                var Params = function () {
                  this.init(getParams2());
                };
                Params.prototype = {
              Severity: Major
              Found in app/javascript/javascript/params2.js - About 2 hrs to fix

                Function handleInputChange has 52 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  const handleInputChange = (thresholdKey: keyof Thresholds, value: string) => {
                    const trimmedValue = value.trim();
                    if (trimmedValue === "") {
                      setInputValue("");
                      setErrorMessage(t("thresholdConfigurator.emptyInputMessage"));
                Severity: Major
                Found in app/javascript/react/utils/thresholdEventHandlers.ts - About 2 hrs to fix

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

                    private applyStyles() {
                      if (!this.div) return;
                  
                      this.div.innerHTML = "";
                  
                  
                  Severity: Major
                  Found in app/javascript/react/components/Map/Markers/clusterOverlay.ts - About 2 hrs to fix

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

                    const setSensor = (
                      selectedParameter: ParameterType,
                      sensors: Sensor[],
                      sessionType: string
                    ) => {
                    Severity: Major
                    Found in app/javascript/react/utils/setSensor.ts - About 2 hrs to fix

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

                        const handleMarkerClick = (
                          selectedStreamId: number | null,
                          id: number | null
                        ) => {
                          if (currentUserSettings !== UserSettings.SessionListView) {
                      Severity: Major
                      Found in app/javascript/react/components/Map/Map.tsx - About 2 hrs to fix

                        Function selectFixedStreamShortInfo has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          (fixedStreamData, lastDailyAverage): FixedStreamShortInfo => {
                            const { value: lastMeasurementValue, date } = lastDailyAverage || {};
                        
                            const lastMeasurementDateLabel = moment(date).format("MMM D");
                            const lastUpdate = moment
                        Severity: Minor
                        Found in app/javascript/react/store/fixedStreamSelectors.ts - About 2 hrs to fix

                          Function MeasurementComponent has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          const MeasurementComponent: React.FC = () => {
                            const { t } = useTranslation();
                          
                            const extremes = useAppSelector(selectFixedExtremes);
                            const thresholds = useAppSelector(selectThresholds);
                          Severity: Minor
                          Found in app/javascript/react/components/Graph/MeasurementComponent.tsx - About 2 hrs to fix

                            Consider simplifying this complex logical expression.
                            Open

                                if (
                                  west === undefined ||
                                  east === undefined ||
                                  south === undefined ||
                                  north === undefined ||
                            Severity: Critical
                            Found in app/javascript/react/api/apiEndpoints.ts - About 2 hrs to fix

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

                                  (selectedParameter: ParameterType, sensors: Sensor[]) => {
                                    const sensorData = setSensor(selectedParameter, sensors, sessionType);
                                    const commonParams = [
                                      {
                                        key: UrlParamsTypes.previousUserSettings,
                              Severity: Minor
                              Found in app/javascript/react/utils/mapParamsHandler.ts - About 1 hr to fix

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

                                  def perform
                                    alerts = ThresholdAlert.all
                                    Sidekiq.logger.info "[TRSHLD] #{alerts.count} alerts found: #{alerts.inspect}"
                                
                                    alerts.each do |alert|
                                Severity: Minor
                                Found in app/workers/threshold_alerts_worker.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 StreamMarkers has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                                Open

                                const StreamMarkers = ({ sessions, unitSymbol }: Props) => {
                                  const dispatch = useAppDispatch();
                                  const map = useMap();
                                  const markersRef = useRef<Map<string, CustomMarker>>(new Map());
                                  const thresholds = useSelector(selectThresholds);
                                Severity: Minor
                                Found in app/javascript/react/components/Map/Markers/StreamMarkers.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 ControlPanel has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                                Open

                                const ControlPanel: React.FC = () => {
                                  const { mapTypeId, searchParams } = useMapParams();
                                  const navigate = useNavigate();
                                  const isFirstRender = useRef(true);
                                  const { t } = useTranslation();
                                Severity: Minor
                                Found in app/javascript/react/components/Map/ControlPanel/ControlPanel.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 SessionsListView has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                                Open

                                const SessionsListView: React.FC<SessionsListViewProps> = ({
                                  sessions,
                                  onCellClick,
                                  onCellMouseEnter,
                                  onCellMouseLeave,

                                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 calculateChosenLabel has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    calculateChosenLabel: function () {
                                      var customRange = true;
                                      var i = 0;
                                      for (var range in this.ranges) {
                                        if (this.timePicker) {
                                Severity: Minor
                                Found in app/javascript/jquery.ui.daterangepicker.js - About 1 hr to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language