HabitatMap/AirCasting

View on GitHub

Showing 239 of 667 total issues

Method sync has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

  def sync(data)
    upload = []
    deleted = []

    data.each do |session_data|
Severity: Minor
Found in app/models/user.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 getXAxisOptions has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

const getXAxisOptions = (
  isMobile: boolean,
  rangeDisplayRef: React.RefObject<HTMLDivElement> | undefined,
  fixedSessionTypeSelected: boolean,
  isIndoor: string | null,
Severity: Minor
Found in app/javascript/react/components/Graph/graphConfig.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 updateCalendars has 39 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    updateCalendars: function () {
      if (this.timePicker) {
        var hour, minute, second;
        if (this.endDate) {
          hour = parseInt(this.container.find(".left .hourselect").val(), 10);
Severity: Minor
Found in app/javascript/jquery.ui.daterangepicker.js - About 1 hr to fix

    Function init has 38 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export const init = () => {
      const element = document.getElementById("map11");
      if (!element) {
        return setTimeout(init, 100);
      }
    Severity: Minor
    Found in app/javascript/javascript/googleMapsInit.js - About 1 hr to fix

      Function timeChanged has 38 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          timeChanged: function (e) {
            var cal = $(e.target).closest(".drp-calendar"),
              isLeft = cal.hasClass("left");
      
            var hour = parseInt(cal.find(".hourselect").val(), 10);
      Severity: Minor
      Found in app/javascript/jquery.ui.daterangepicker.js - About 1 hr to fix

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

          private applyStyles() {
            if (!this.div) return;
        
            this.div.innerHTML = "";
        
        
        Severity: Minor
        Found in app/javascript/react/components/Map/Markers/customMarkerLabel.ts - About 1 hr to fix

          Function fetch has 37 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              fetch: function (values = {}) {
                if (params.isSessionSelected()) return;
                const limit = values.amount || 100;
                const offset = values.fetchedSessionsCount || 0;
          
          
          Severity: Minor
          Found in app/javascript/javascript/fixedSessions.js - About 1 hr to fix

            Function googleMaps has 37 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            const googleMaps = () => {
              let onPanOrZoomHandle;
              let onPanOrZoomCallback = () => {};
            
              const unlistenPanOrZoom = (mapObj) =>
            Severity: Minor
            Found in app/javascript/javascript/googleMaps.js - About 1 hr to fix

              Function filterTimestamps has 37 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export const filterTimestamps = (
                timestamps: { [timestamp: string]: any },
                timeRange: TimeRanges
              ): string[] => {
                const now = moment.utc();
              Severity: Minor
              Found in app/javascript/react/utils/filterTimelapseData.ts - About 1 hr to fix

                Method perform has 37 lines of code (exceeds 25 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

                  Function updateIndoorFilters has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      (isIndoor: string) => {
                        if (isMobile) {
                          setUrlParams([
                            {
                              key: UrlParamsTypes.isIndoor,
                  Severity: Minor
                  Found in app/javascript/react/utils/mapParamsHandler.ts - About 1 hr to fix

                    Function getClusterPixelPosition has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    const getClusterPixelPosition = (
                      map: google.maps.Map,
                      latLng: google.maps.LatLng
                    ) => {
                      const zoom = map.getZoom();
                    Severity: Minor
                    Found in app/javascript/react/utils/getClusterPixelPosition.ts - About 1 hr to fix

                      Function UniformDistributionButton has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                      Open

                      const UniformDistributionButton: React.FC<UniformDistributionButtonProps> = ({
                        variant = ThresholdButtonVariant.IconOnly,
                        uniformDistributionButtonText,
                        swapIconTextPosition = false,
                        useDarkBlueIcon = false,

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

                          fetch: function (values = {}) {
                            if (params.isSessionSelected()) return;
                            const limit = values.amount || 100;
                            const offset = values.fetchedSessionsCount || 0;
                      
                      
                      Severity: Minor
                      Found in app/javascript/javascript/mobileSessions.js - About 1 hr to fix

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

                          def sync(data)
                            upload = []
                            deleted = []
                        
                            data.each do |session_data|
                        Severity: Minor
                        Found in app/models/user.rb - About 1 hr to fix

                          Method as_json has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            def as_json(opts = nil)
                              opts ||= {}
                          
                              methods = opts[:methods] || %i[notes]
                              methods << :type
                          Severity: Minor
                          Found in app/models/session.rb - About 1 hr to fix

                            Function exports has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            module.exports = (webpackConfig) => {
                              webpackConfig.devtool = "cheap-module-source-map"
                            
                              webpackConfig.stats = {
                                colors: true,
                            Severity: Minor
                            Found in config/webpack/development.js - About 1 hr to fix

                              Function createSessionFetchThunk has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              const createSessionFetchThunk = (
                                type: FixedSessionsTypes,
                                endpoint: (filters: string) => string
                              ) => {
                                return createAsyncThunk<
                              Severity: Minor
                              Found in app/javascript/react/store/fixedSessionsSlice.ts - About 1 hr to fix

                                Function createSessionFetchThunk has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                const createSessionFetchThunk = (
                                  type: FixedSessionsTypes,
                                  endpoint: (filters: string) => string
                                ) => {
                                  return createAsyncThunk<
                                Severity: Minor
                                Found in app/javascript/react/store/indoorSessionsSlice.ts - About 1 hr to fix

                                  Function FixedStreamStationHeader has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                  const FixedStreamStationHeader = () => {
                                    const {
                                      unitSymbol,
                                      title,
                                      profile,
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language