HabitatMap/AirCasting

View on GitHub

Showing 239 of 667 total issues

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

const useShortenedLink = (url: string, accessToken: string) => {
  const [shortenedLink, setShortenedLink] = useState<string>(url);
  const [error, setError] = useState<Error | null>(null);

  useEffect(() => {
Severity: Minor
Found in app/javascript/react/utils/useShortenedLink.ts - About 1 hr to fix

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

        show: function (e) {
          if (this.isShowing) return;
    
          // Create a click proxy that is private to this instance of datepicker, for unbinding
          this._outsideClickProxy = $.proxy(function (e) {
    Severity: Minor
    Found in app/javascript/jquery.ui.daterangepicker.js - About 1 hr to fix

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

        render: (cluster: Cluster) => {
          // Accept the entire Cluster object
          const { count, position, markers = [] } = cluster;
      
          const customMarkers = markers as CustomMarker[];

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

        const BackButton = () => {
          const { t } = useTranslation();
          const handleCalendarGoBack = useCalendarBackNavigation();
        
          const { previousUserSettings } = useMapParams();
        Severity: Minor
        Found in app/javascript/react/components/Navbar/BackButton.tsx - About 1 hr to fix

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

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

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

            const useCalendarBackNavigation = () => {
              const navigate = useNavigate();
              const isMobile = useMobileDetection();
            
              const { currentUserSettings, previousUserSettings, searchParams } =
            Severity: Minor
            Found in app/javascript/react/hooks/useBackNavigation.tsx - About 1 hr to fix

              Function EventManager has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              var EventManager = new (function () {
                var events = {};
                var happened = [];
              
                this.publish = function (name, data) {
              Severity: Minor
              Found in app/javascript/javascript/pubsub.js - About 1 hr to fix

                Function updateView has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    updateView: function () {
                      if (this.timePicker) {
                        this.renderTimePicker("left");
                        this.renderTimePicker("right");
                        if (!this.endDate) {
                Severity: Minor
                Found in app/javascript/jquery.ui.daterangepicker.js - About 1 hr to fix

                  Method up has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    def up
                      Session.transaction do
                        Session
                          .all
                          .select { |s| !s.timezone_offset }
                  Severity: Minor
                  Found in db/migrate/20120220090451_fix_missing_timezones.rb - About 1 hr to fix

                    Function YearPickerButtons has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    const YearPickerButtons = () => {
                      const dispatch = useAppDispatch();
                      const { timeFrom, updateTime } = useMapParams();
                    
                      const handleYear = useCallback(

                      Consider simplifying this complex logical expression.
                      Open

                              if (
                                !this.singleDatePicker &&
                                this.leftCalendar.month &&
                                this.rightCalendar.month &&
                                (this.startDate.format("YYYY-MM") ==
                      Severity: Major
                      Found in app/javascript/jquery.ui.daterangepicker.js - About 1 hr to fix

                        Function infoWindow has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                        Open

                        const infoWindow = () => {
                          var InfoWindow = function () {
                            this.popup = new google.maps.InfoWindow();
                          };
                        
                        
                        Severity: Minor
                        Found in app/javascript/javascript/infoWindow.js - About 55 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 processes_pids has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                        Open

                        def processes_pids
                          pids = []
                          sidekiq_roles = Array(fetch(:sidekiq_role))
                          sidekiq_roles.each do |role|
                            next unless host.roles.include?(role)
                        Severity: Minor
                        Found in config/deploy.rb - About 55 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 DesktopHeader has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                        Open

                        const DesktopHeader: React.FC<DesktopHeaderProps> = ({
                          isMapPage,
                          isTimelapseView,
                          navMenuVisible,
                          toggleMenuVisibility,
                        Severity: Minor
                        Found in app/javascript/react/components/Navbar/DesktopHeader.tsx - About 55 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

                        Avoid deeply nested control flow statements.
                        Open

                                    if (ampm === "PM" && hour < 12) hour += 12;
                        Severity: Major
                        Found in app/javascript/jquery.ui.daterangepicker.js - About 45 mins to fix

                          Method sync has a Cognitive Complexity of 8 (exceeds 5 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 45 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 getPlotOptions has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                          Open

                          const getPlotOptions = (
                            fixedSessionTypeSelected: boolean,
                            streamId: number | null,
                            dispatch: any,
                            isIndoorParameterInUrl: boolean
                          Severity: Minor
                          Found in app/javascript/react/components/Graph/graphConfig.ts - About 45 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

                          Avoid deeply nested control flow statements.
                          Open

                                      if (ampm === "AM" && hour === 12) hour = 0;
                          Severity: Major
                          Found in app/javascript/jquery.ui.daterangepicker.js - About 45 mins to fix

                            Function TagsInput has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                            Open

                            const TagsInput = () => {
                              const [items, setItems] = useState<string[]>([""]);
                              const [inputValue, setInputValue] = useState<string>("");
                              const [selectedItem, setSelectedItem] = useState<string>("");
                              const dispatch = useAppDispatch();
                            Severity: Minor
                            Found in app/javascript/react/components/SessionFilters/TagsInput.tsx - About 45 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 SessionsListTile has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                            Open

                            const SessionsListTile: React.FC<SessionListTile> = ({
                              id,
                              sessionName,
                              sensorName,
                              averageValue,

                            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