Showing 239 of 667 total issues
Function renderTimePicker
has 159 lines of code (exceeds 25 allowed). Consider refactoring. Open
renderTimePicker: function (side) {
// Don't bother updating the time picker if it's currently disabled
// because an end date hasn't been clicked yet
if (side == "right" && !this.endDate) return;
Function determineZoomLevel
has 158 lines of code (exceeds 25 allowed). Consider refactoring. Open
const determineZoomLevel = (results: google.maps.GeocoderResult[]) => {
const locationTypes = results[0].types;
const primaryType = locationTypes[0];
// Based on: https://developers.google.com/maps/documentation/places/web-service/supported_types
File sessions_controller_spec.rb
has 420 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'rails_helper'
describe Api::Fixed::Active::SessionsController do
describe '#index' do
it 'returns active sessions json' do
Function getRangeSelectorOptions
has 137 lines of code (exceeds 25 allowed). Consider refactoring. Open
const getRangeSelectorOptions = (
isMobile: boolean,
fixedSessionTypeSelected: boolean,
totalDuration: number,
selectedRange: number,
Function ProfileNamesInput
has 135 lines of code (exceeds 25 allowed). Consider refactoring. Open
const ProfileNamesInput = () => {
const [items, setItems] = useState<string[]>([""]);
const [inputValue, setInputValue] = useState<string>("");
const [selectedItem, setSelectedItem] = useState<string>("");
const dispatch = useAppDispatch();
Function TagsInput
has 130 lines of code (exceeds 25 allowed). Consider refactoring. Open
const TagsInput = () => {
const [items, setItems] = useState<string[]>([""]);
const [inputValue, setInputValue] = useState<string>("");
const [selectedItem, setSelectedItem] = useState<string>("");
const dispatch = useAppDispatch();
Function ControlPanel
has 124 lines of code (exceeds 25 allowed). Consider refactoring. Open
const ControlPanel: React.FC = () => {
const { mapTypeId, searchParams } = useMapParams();
const navigate = useNavigate();
const isFirstRender = useRef(true);
const { t } = useTranslation();
Function addNavigationArrows
has 123 lines of code (exceeds 25 allowed). Consider refactoring. Open
const addNavigationArrows = (
chart: Highcharts.Chart,
isCalendarPage: boolean,
isMobile: boolean
) => {
Function ThresholdSlider
has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring. Open
const ThresholdSlider: React.FC<ThresholdSliderProps> = ({
isMobileOldStyle,
useColorBoxStyle,
setErrorMessage,
}) => {
- Read upRead up
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 createMarkerIcon
has 116 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const createMarkerIcon = (
color: string,
value: string,
isSelected: boolean = false,
shouldPulse: boolean
File TimelapseComponent.style.tsx
has 359 lines of code (exceeds 250 allowed). Consider refactoring. Open
import Popup from "reactjs-popup";
import styled from "styled-components";
import {
acBlue,
Function addNavigationArrows
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
const addNavigationArrows = (
chart: Highcharts.Chart,
isCalendarPage: boolean,
isMobile: boolean
) => {
- Read upRead up
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 MobileSessionFilters
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
const MobileSessionFilters = ({
onClose,
fetchableSessionsCount,
}: MobileSessionFiltersProps) => {
const indoorSessionsState = useAppSelector(selectIndoorSessionsState);
- Read upRead up
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
File Graph.tsx
has 348 lines of code (exceeds 250 allowed). Consider refactoring. Open
// Graph.tsx
import HighchartsReact from "highcharts-react-official";
import Highcharts, { Chart } from "highcharts/highstock";
import NoDataToDisplay from "highcharts/modules/no-data-to-display";
Function handleSelectedStreamId
has 108 lines of code (exceeds 25 allowed). Consider refactoring. Open
const handleSelectedStreamId = (streamId: number | null) => {
if (fixedStreamStatus === StatusEnum.Pending) return;
if (streamId) {
const { latitude, longitude } = fixedStreamData?.stream ?? {};
File ThresholdSlider.tsx
has 346 lines of code (exceeds 250 allowed). Consider refactoring. Open
import _ from "lodash";
import React, {
useCallback,
useEffect,
useLayoutEffect,
File user_sessions_controller_spec.rb
has 333 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'rails_helper'
describe Api::UserSessionsController do
let(:user) { FactoryBot.create(:user) }
Function MapButtons
has 99 lines of code (exceeds 25 allowed). Consider refactoring. Open
const MapButtons: React.FC = () => {
const { goToUserSettings, currentUserSettings, sessionType, isIndoor } =
useMapParams();
const [activeButtons, setActiveButtons] = useState<ButtonTypes[]>([]);
const [activeCopyLinkButton, setActiveCopyLinkButton] = useState(false);
Function customMarkerClass
has 95 lines of code (exceeds 25 allowed). Consider refactoring. Open
const customMarkerClass = () => {
let klass;
let zIndex = 10000;
return (() => {
Function CrowdMapToggle
has 95 lines of code (exceeds 25 allowed). Consider refactoring. Open
const CrowdMapToggle = () => {
const {
currentUserSettings,
goToUserSettings,
previousUserSettings,