Showing 239 of 667 total issues
Function IndoorOutdoorSwitch
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const IndoorOutdoorSwitch = () => {
const { t } = useTranslation();
const { isIndoor, updateIndoorFilters, setFilter } = useMapParams();
const dispatch = useAppDispatch();
Function monthOrYearChanged
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
monthOrYearChanged: function (e) {
var isLeft = $(e.target).closest(".drp-calendar").hasClass("left"),
leftOrRight = isLeft ? "left" : "right",
cal = this.container.find(".drp-calendar." + leftOrRight);
Method call
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def call
{
title: session.title,
average: stream.measurements.average(:value),
id: session.id,
Function extraReducers
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
extraReducers: (builder) => {
builder
.addCase(fetchUsernames.pending, (state) => {
state.fetchUsernamesStatus = StatusEnum.Pending;
state.usernamesError = null;
Function newRectangles
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const newRectangles = crowdMapRectangles.map((rectangle) => {
const newRectangle = new google.maps.Rectangle({
bounds: new google.maps.LatLngBounds(
new google.maps.LatLng(rectangle.south, rectangle.west),
new google.maps.LatLng(rectangle.north, rectangle.east)
Method build_json_output
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def build_json_output(anonymous = false)
sessions = formatted_sessions
streams = Stream.where(session_id: sessions.pluck('sessions.id'))
selected_sensor_streams =
streams.select do |stream|
Function createMarkerIcon
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
Open
export const createMarkerIcon = (
color: string,
value: string,
isSelected: boolean = false,
shouldPulse: 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 MapButtons
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
Open
const MapButtons: React.FC = () => {
const { goToUserSettings, currentUserSettings, sessionType, isIndoor } =
useMapParams();
const [activeButtons, setActiveButtons] = useState<ButtonTypes[]>([]);
const [activeCopyLinkButton, setActiveCopyLinkButton] = useState(false);
- 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 handleScrollEnd
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const handleScrollEnd = useCallback(() => {
const hasMoreSessions = listSessions.length < fetchableMobileSessionsCount;
const hasMoreDormantSessions =
isDormant && listSessions.length < fetchableFixedSessionsCount;
Function setSensorParams
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
(selectedSensor: string, sensors: Sensor[]) => {
const commonParams = [
{
key: UrlParamsTypes.previousUserSettings,
value: currentUserSettings,
Function SessionTypeToggle
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const SessionTypeToggle = () => {
const dispatch = useAppDispatch();
const { searchParams, sessionType, updateSessionType } = useMapParams();
const { t } = useTranslation();
Function extraReducers
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
extraReducers: (builder) => {
builder
.addCase(fetchActiveFixedSessions.pending, (state) => {
state.status = StatusEnum.Pending;
state.error = null;
Function htmlFor
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
htmlFor: function (data, sessionType) {
if (!data) {
return `
<div class="info-window">
<div>Contains more than 100 sessions</div>
Function sessionsDownloader
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const sessionsDownloader = () => {
var fetch = function (url, reqData, sessions, refreshSessionsCallback) {
var successCallback = function (data) {
// data is cached so better not mutate it
data = JSON.parse(JSON.stringify(data));
Function handleClusteringEnd
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const handleClusteringEnd = useCallback(() => {
const currentZoom = map?.getZoom() ?? null;
if (currentZoom === previousZoomRef.current) {
return;
Function handleMapIdle
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
(event: MapEvent) => {
const map = event.map;
if (!mapInstance) {
setMapInstance(map);
map.setOptions({
Function createHtml
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const createHtml = (index) => {
const data = notes[index].data;
const date = moment(data.date, "YYYY-MM-DDTHH:mm:ss").format(
"MM/DD/YYYY, HH:mm:ss"
);
Method change
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def change
begin
change_table :measurements do |t|
t.references :stream
end
Method to_mobile_sessions_array
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def to_mobile_sessions_array(sessions)
sessions.map do |session|
{
id: session.id,
title: session.title,
Function extraReducers
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
extraReducers: (builder) => {
builder
.addCase(fetchActiveIndoorSessions.pending, (state) => {
state.status = StatusEnum.Pending;
state.error = null;