HabitatMap/AirCasting

View on GitHub

Showing 239 of 667 total issues

Avoid too many return statements within this function.
Open

        return "default";
Severity: Major
Found in app/javascript/javascript/heat.js - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

        if (!data.gridResolution) return false;
    Severity: Major
    Found in app/javascript/javascript/buildQueryParamsForCrowdMapLayer.js - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

          return {
            west: bounds.west,
            east: bounds.east,
            south: bounds.south,
            north: bounds.north,
      Severity: Major
      Found in app/javascript/javascript/buildQueryParamsForCrowdMapLayer.js - About 30 mins to fix

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

          def authenticate_admin_user!
            redirect_to(new_user_session_path) && return unless current_user
            redirect_to(new_user_session_path) && return unless current_user.admin?
          end
        Severity: Minor
        Found in app/controllers/application_controller.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 change has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

          def change
            if column_exists?(:sessions, :timezone_offset)
              remove_column :sessions, :timezone_offset
            end
            if column_exists?(:sessions, :os_version)
        Severity: Minor
        Found in db/migrate/20190917070820_remove_colums_from_session.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 setSensor has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        const setSensor = (
          selectedParameter: ParameterType,
          sensors: Sensor[],
          sessionType: string
        ) => {
        Severity: Minor
        Found in app/javascript/react/utils/setSensor.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 EventManager has a Cognitive Complexity of 6 (exceeds 5 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 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 prepare_data has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def prepare_data(params)
              if params[:q].is_a?(String)
                data =
                  ActiveSupport::JSON.decode(params.to_unsafe_hash[:q]).symbolize_keys
              else
        Severity: Minor
        Found in app/controllers/api/averages_controller.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 drawSession has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        export const drawSession = () => {
          let DrawSession = function () {};
        
          DrawSession.prototype = {
            drawMobileSession: function (session, drawSessionStartingMarker) {
        Severity: Minor
        Found in app/javascript/javascript/drawSession.js - 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 params has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        const params = () => {
          var Params = function () {
            this.init(getParams2());
          };
          Params.prototype = {
        Severity: Minor
        Found in app/javascript/javascript/params2.js - 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 sign_in_and_redirect has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

          def sign_in_and_redirect(resource_or_scope, resource = nil)
            scope = Devise::Mapping.find_scope!(resource_or_scope)
            resource ||= resource_or_scope
            sign_in(scope, resource) unless warden.user(scope) == resource
            if resource.admin?
        Severity: Minor
        Found in app/controllers/sessions_controller.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 useMapEventListeners has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        const useMapEventListeners = (
          map: google.maps.Map | null,
          eventHandlers: { [eventName: string]: () => void }
        ) => {
          useEffect(() => {
        Severity: Minor
        Found in app/javascript/react/utils/mapEventListeners.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 applyStyles has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

          private applyStyles() {
            if (!this.div) return;
        
            const size = this.isSelected ? 44 : 36;
            const blurValue = this.isSelected ? 0 : 3;
        Severity: Minor
        Found in app/javascript/react/components/Map/Markers/customMarkerOverlay.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

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

          def delete_session_streams
            GoogleAnalyticsWorker::RegisterEvent.async_call(
              'User Sessions#delete session streams'
            )
            session_data = decode_and_deep_symbolize(params)
        Severity: Minor
        Found in app/controllers/api/user_sessions_controller.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 LocationSearch has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        const LocationSearch: React.FC<LocationSearchProps> = ({
          isMapPage,
          isTimelapseView,
        }) => {
          const dispatch = useAppDispatch();
        Severity: Minor
        Found in app/javascript/react/components/LocationSearch/LocationSearch.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 CalendarPage has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        const CalendarPage: React.FC<CalendarPageProps> = ({ children }) => {
          const dispatch = useAppDispatch();
          const isMobile = useMobileDetection();
          const { t } = useTranslation();
          const handleCalendarGoBack = useCalendarBackNavigation();
        Severity: Minor
        Found in app/javascript/react/pages/CalendarPage/CalendarPage.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 ProfileNamesInput has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        const ProfileNamesInput = () => {
          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/ProfileNamesInput.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 useScrollEndListener has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        const useScrollEndListener = (
          elementRef: React.RefObject<HTMLElement>,
          onScrollEnd: () => void
        ) => {
          useEffect(() => {
        Severity: Minor
        Found in app/javascript/react/hooks/useScrollEndListener.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 ScrollCalendarButton has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        const ScrollCalendarButton: React.FC<ScrollButtonComponentProps> = ({
          direction,
          handleClick,
          disabled = 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

        Severity
        Category
        Status
        Source
        Language