Showing 667 of 667 total issues
Function TimeRangeButtons
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
const TimeRangeButtons = () => {
const timeRange = useAppSelector(selectTimelapseTimeRange);
const { t } = useTranslation();
const dispatch = useAppDispatch();
Function extraReducers
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
extraReducers: (builder) => {
builder
.addCase(fetchThresholds.pending, (state) => {
state.status = StatusEnum.Pending;
state.error = null;
Function preprocessData
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
var preprocessData = function (data, sessions) {
var times;
_(data).each(function (session) {
if (session.start_time_local && session.end_time_local) {
Method call
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def call
{
title: session.title,
username: session.is_indoor ? 'anonymous' : session.user.username,
sensorName: stream.sensor_name,
Function centerMapOnBounds
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
(
minLatitude: number,
maxLatitude: number,
minLongitude: number,
maxLongitude: number
Method save
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def save(streams)
persisted_streams =
Stream
.select(:id, :min_latitude, :min_longitude, :sensor_name, :session_id)
.joins(:session)
- 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 CopyLinkComponent
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
const CopyLinkComponent = ({
button,
isIconOnly,
showBelowButton,
onOpen,
- 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 CustomSensorFilter
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
const CustomSensorFilter: React.FC<CustomSensorFilterProps> = ({
customSensors,
sessionsCount = 0,
onClose = () => {},
fetchableSessionsCount,
- 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 getBasicSensors
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
export const getBasicSensors = (
measurementType: string,
sessionType: string
) => {
if (measurementType !== ParameterTypes.PARTICULATE_MATTER) {
- 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 CustomParameterFilter
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
const CustomParameterFilter: React.FC<CustomParameterFilterProps> = ({
customParameters,
sessionsCount = 0,
onClose = () => {},
fetchableSessionsCount,
- 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
Similar blocks of code found in 2 locations. Consider refactoring. Open
{
'stream_id' => other_stream.id,
'sensor_name' => other_stream.sensor_name,
'last_measurement_value' => other_stream.average_value,
'max_latitude' => 1.0,
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 50.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
{
'stream_id' => stream.id,
'sensor_name' => stream.sensor_name,
'last_measurement_value' => stream.average_value,
'max_latitude' => 1.0,
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 50.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Method build_measurements!
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def build_measurements!(data = [])
data = data.map(&:deep_symbolize_keys)
factory = RGeo::Geographic.spherical_factory(srid: 4326)
time_zone = time_zone(data)
Function setStartDate
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
setStartDate: function (startDate) {
if (typeof startDate === "string")
this.startDate = moment(startDate, this.locale.format);
if (typeof startDate === "object") this.startDate = moment(startDate);
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(() => {
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) {
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();
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;
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 } =