Showing 239 of 667 total issues
Function setFilter
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
(key: UrlParamsTypes, value: string) => {
if (isMobile) {
setUrlParams([
{
key: key,
Function updateIsActive
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
(newIsActive: boolean) => {
if (sessionType === SessionTypes.MOBILE) {
newIsActive = true;
}
setUrlParams([
Consider simplifying this complex logical expression. Open
if lat.nil? || lng.nil? || lat.zero? || lng.zero? || lat > 90 ||
lat < -90 || lng > 180 || lng < -180
return 'UTC'
end
Consider simplifying this complex logical expression. Open
if lat.nil? || lng.nil? || lat.zero? || lng.zero? || lat > 90 ||
lat < -90 || lng > 180 || lng < -180
return 'UTC'
end
Method session_data
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def session_data(attributes)
"[
{\"calibration\":0,
\"contribute\":true,
\"drawable\":2131165435,
Function sensors
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const sensors = (params) => {
var Sensors = function () {
this.sensors = {};
};
Function hoverDate
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
hoverDate: function (e) {
//ignore dates that can't be selected
if (!$(e.target).hasClass("available")) return;
var title = $(e.target).attr("data-title");
Function createObserver
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const createObserver = (config) => {
const {
observerConfig = DEFAULT_OBSERVER_CONFIG,
rootElement = DEFAULT_ROOT_ELEMENT,
selector,
Function setPreviousZoomInTheURL
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
const setPreviousZoomInTheURL = () => {
const desktopCondition: boolean =
!isMobile &&
currentUserSettings !== UserSettings.ModalView &&
previousUserSettings !== UserSettings.CalendarView;
Method generate_link
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def generate_link(stream)
threshold_min = stream.threshold_set.threshold_very_low.to_i
threshold_low = stream.threshold_set.threshold_low.to_i
threshold_middle = stream.threshold_set.threshold_medium.to_i
threshold_high = stream.threshold_set.threshold_high.to_i
Method filter_
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.filter_(data = {})
sessions =
order('sessions.start_time_local DESC')
.where(contribute: true)
.joins(:user)
Function setEndDate
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
setEndDate: function (endDate) {
if (typeof endDate === "string")
this.endDate = moment(endDate, this.locale.format);
if (typeof endDate === "object") this.endDate = moment(endDate);
Method call
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def call
{
id: session.id,
title: session.title,
username: session.is_indoor ? 'anonymous' : session.user.username,
Method as_json
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def as_json(opts = nil)
opts ||= {}
methods = opts[:methods] || %i[notes]
methods << :type
- 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 buildQueryParamsForCrowdMapLayer_
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
const buildQueryParamsForCrowdMapLayer_ = (gridSizeX, params, sensors) => ({
call: (streamIds, bounds) => {
if (!sensors.selected()) return false;
if (!hasTruthyValues(bounds)) return false;
const data = params().data;
- 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 createObserver
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
export const createObserver = (config) => {
const {
observerConfig = DEFAULT_OBSERVER_CONFIG,
rootElement = DEFAULT_ROOT_ELEMENT,
selector,
- 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
Method filter_
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def self.filter_(data = {})
sessions =
order('sessions.start_time_local DESC')
.where(contribute: true)
.joins(:user)
- 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
Method fixed_active_government_sessions
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def fixed_active_government_sessions(sensor_name:, west:, east:, north:, south:)
sensor_name = ActiveRecord::Base.connection.quote(sensor_name)
sql = <<-SQL
WITH recent_sessions AS (
Function RealtimeMapUpdatesButton
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
const RealtimeMapUpdatesButton = () => {
const { t } = useTranslation();
const isMobile = useScreenSizeDetection(screenSizes.mobile);
const dispatch = useAppDispatch();
Function selectMobileStreamShortInfo
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
(mobileStreamData, mobileSessionState): MobileStreamShortInfo => {
const maxMeasurementValue = Math.max(
...mobileStreamData.measurements.map((m) => m.value)
);
const minMeasurementValue = Math.min(