HabitatMap/AirCasting

View on GitHub

Showing 239 of 667 total issues

Method build! has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def build!
    data = @session_data.clone
    session = nil
    jobs = []

Severity: Minor
Found in lib/session_builder.rb - About 1 hr to fix

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

      def call(sessions)
        sessions_array = []
    
        sessions.map do |session|
          sessions_array <<
    Severity: Minor
    Found in app/serializers/fixed_sessions_serializer.rb - About 1 hr to fix

      Function updateTime has 30 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          (selectedYear: number) => {
            setUrlParams([
              {
                key: UrlParamsTypes.previousUserSettings,
                value: isMobile ? previousUserSettings : currentUserSettings,
      Severity: Minor
      Found in app/javascript/react/utils/mapParamsHandler.ts - About 1 hr to fix

        Function updateThumbPositionsHandler has 30 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          const updateThumbPositionsHandler = useCallback(() => {
            if (sliderRef.current) {
              const { min, low, middle, high, max } = thresholdValues;
              const lowThumb = calculateThumbPosition(
                low,

          Function onAdd has 30 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            onAdd() {
              this.div = document.createElement("div");
              this.div.style.position = "absolute";
              this.div.style.cursor = "pointer";
              this.div.title = this.title;
          Severity: Minor
          Found in app/javascript/react/components/Map/Markers/CustomMarker.tsx - About 1 hr to fix

            Function initializeSentry has 29 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export const initializeSentry = () => {
              let sentryEnvironment: string;
            
              switch (window.location.hostname) {
                case "aircasting.habitatmap.org":
            Severity: Minor
            Found in app/javascript/react/utils/initializeSentry.ts - About 1 hr to fix

              Method sync has 29 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                def sync(session_data)
                  tag_list = session_data[:tag_list] || ''
                  session_data =
                    session_data.merge(tag_list: SessionBuilder.normalize_tags(tag_list))
              
              
              Severity: Minor
              Found in app/models/session.rb - About 1 hr to fix

                Function handleSliderClick has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  const handleSliderClick = (
                    event: React.MouseEvent<HTMLDivElement> | React.TouchEvent<HTMLDivElement>
                  ) => {
                    if (sliderRef.current && activeInput === null) {
                      const rect = sliderRef.current.getBoundingClientRect();
                Severity: Minor
                Found in app/javascript/react/utils/thresholdEventHandlers.ts - About 1 hr to fix

                  Function TimeRangeButtons has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  const TimeRangeButtons = () => {
                    const timeRange = useAppSelector(selectTimelapseTimeRange);
                    const { t } = useTranslation();
                    const dispatch = useAppDispatch();
                  
                  

                    Function extraReducers has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      extraReducers: (builder) => {
                        builder
                          .addCase(fetchThresholds.pending, (state) => {
                            state.status = StatusEnum.Pending;
                            state.error = null;
                    Severity: Minor
                    Found in app/javascript/react/store/thresholdSlice.ts - About 1 hr to fix

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

                        var preprocessData = function (data, sessions) {
                          var times;
                      
                          _(data).each(function (session) {
                            if (session.start_time_local && session.end_time_local) {
                      Severity: Minor
                      Found in app/javascript/javascript/sessionsDownloader.js - About 1 hr to fix

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

                          def call
                            {
                              title: session.title,
                              username: session.is_indoor ? 'anonymous' : session.user.username,
                              sensorName: stream.sensor_name,
                        Severity: Minor
                        Found in app/services/api/to_fixed_session_hash.rb - About 1 hr to fix

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

                              (
                                minLatitude: number,
                                maxLatitude: number,
                                minLongitude: number,
                                maxLongitude: number
                          Severity: Minor
                          Found in app/javascript/react/components/Map/Markers/MobileMarkers.tsx - About 1 hr to fix

                            Method save has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                            Open

                              def save(streams)
                                persisted_streams =
                                  Stream
                                    .select(:id, :min_latitude, :min_longitude, :sensor_name, :session_id)
                                    .joins(:session)
                            Severity: Minor
                            Found in app/services/save_measurements.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 CopyLinkComponent has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                            Open

                            const CopyLinkComponent = ({
                              button,
                              isIconOnly,
                              showBelowButton,
                              onOpen,
                            Severity: Minor
                            Found in app/javascript/react/components/Popups/CopyLinkComponent.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 CustomSensorFilter has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                            Open

                            const CustomSensorFilter: React.FC<CustomSensorFilterProps> = ({
                              customSensors,
                              sessionsCount = 0,
                              onClose = () => {},
                              fetchableSessionsCount,

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

                            export const getBasicSensors = (
                              measurementType: string,
                              sessionType: string
                            ) => {
                              if (measurementType !== ParameterTypes.PARTICULATE_MATTER) {
                            Severity: Minor
                            Found in app/javascript/react/components/SessionFilters/SensorFilter.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 CustomParameterFilter has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                            Open

                            const CustomParameterFilter: React.FC<CustomParameterFilterProps> = ({
                              customParameters,
                              sessionsCount = 0,
                              onClose = () => {},
                              fetchableSessionsCount,

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

                              def build_measurements!(data = [])
                                data = data.map(&:deep_symbolize_keys)
                                factory = RGeo::Geographic.spherical_factory(srid: 4326)
                                time_zone = time_zone(data)
                            
                            
                            Severity: Minor
                            Found in app/models/stream.rb - About 1 hr to fix

                              Function setStartDate has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  setStartDate: function (startDate) {
                                    if (typeof startDate === "string")
                                      this.startDate = moment(startDate, this.locale.format);
                              
                                    if (typeof startDate === "object") this.startDate = moment(startDate);
                              Severity: Minor
                              Found in app/javascript/jquery.ui.daterangepicker.js - About 1 hr to fix
                                Severity
                                Category
                                Status
                                Source
                                Language