Skip to content

Qlty: Found 29 lines of similar code in 4 locations (mass = 159) #8

@CropWatchDevelopment

Description

@CropWatchDevelopment

Issue on Qlty

Found 27 lines of similar code in 4 locations (mass = 83)
src/air/air.controller.spec.ts

import
{ Test, TestingModule }
from

'@nestjs/testing'
;
import
{ AirController }
from

'./air.controller'
;
import
{ AirService }
from

'./air.service'
;
import
{ SupabaseService }
from

'../supabase/supabase.service'
;
import
{ TimezoneFormatterService }
from

'../common/timezone-formatter.service'
;
describe(
'AirController'
,
() =>
{

let
controller: AirController;
beforeEach(
async
() => {
Found 25 lines of similar code in 4 locations (mass = 79)
src/air/air.service.spec.ts

import
{ Test, TestingModule }
from

'@nestjs/testing'
;
import
{ AirService }
from

'./air.service'
;
import
{ SupabaseService }
from

'../supabase/supabase.service'
;
import
{ TimezoneFormatterService }
from

'../common/timezone-formatter.service'
;
describe(
'AirService'
,
() =>
{

let
service: AirService;
beforeEach(
async
() => {

const

module
: TestingModule =
await
Test.createTestingModule({
Found 29 lines of similar code in 4 locations (mass = 159)
src/air/air.service.ts

devEui: 

string
,

startDate
:
Date
,

endDate
:
Date
,
timezone?:
string
,
):
Promise
<TableRow<
'cw_air_data'

[]> {

const
normalizedTimeZone = timezone?.trim() ||
null
;

if
(normalizedTimeZone) {

this
.timezoneFormatter.assertValidTimeZone(normalizedTimeZone);
}
Found 19 lines of similar code in 2 locations (mass = 71)
src/power/power.service.spec.ts

import
{ Test, TestingModule }
from

'@nestjs/testing'
;
import
{ PowerService }
from

'./power.service'
;
describe(
'PowerService'
,
() =>
{

let
service: PowerService;
beforeEach(
async
() => {

const

module
: TestingModule =
await
Test.createTestingModule({

providers
: [PowerService],
}).compile();
Found 19 lines of similar code in 2 locations (mass = 71)
src/realtime/realtime.service.spec.ts

import
{ Test, TestingModule }
from

'@nestjs/testing'
;
import
{ RealtimeService }
from

'./realtime.service'
;
describe(
'RealtimeService'
,
() =>
{

let
service: RealtimeService;
beforeEach(
async
() => {

const

module
: TestingModule =
await
Test.createTestingModule({

providers
: [RealtimeService],
}).compile();
Found 27 lines of similar code in 4 locations (mass = 83)
src/soil/soil.controller.spec.ts

import
{ Test, TestingModule }
from

'@nestjs/testing'
;
import
{ SoilController }
from

'./soil.controller'
;
import
{ SoilService }
from

'./soil.service'
;
import
{ SupabaseService }
from

'../supabase/supabase.service'
;
import
{ TimezoneFormatterService }
from

'../common/timezone-formatter.service'
;
describe(
'SoilController'
,
() =>
{

let
controller: SoilController;
beforeEach(
async
() => {
Found 90 lines of similar code in 3 locations (mass = 423)
src/soil/soil.controller.ts

import
{ BadRequestException, Controller, Get, Post, Body, Patch, Param, Delete, Query, UseGuards }
from

'@nestjs/common'
;
import
{ SoilService }
from

'./soil.service'
;
import
{ SoilDataDto }
from

'./dto/soil-data.dto'
;
import

type
{ CreateSoilDto }
from

'./dto/create-soil.dto'
;
import

type
{ UpdateSoilDto }
from

'./dto/update-soil.dto'
;
import
{ JwtAuthGuard }
from

'../auth/guards/jwt.auth.guard'
;
import
{ ApiBadRequestResponse, ApiBearerAuth, ApiInternalServerErrorResponse, ApiOkResponse, ApiParam, ApiQuery, ApiSecurity, ApiUnauthorizedResponse }
from

'@nestjs/swagger'
;
import
{ ErrorResponseDto }
from

'../common/dto/error-response.dto'
;
@controller
(
'soil'
)
Found 25 lines of similar code in 4 locations (mass = 79)
src/soil/soil.service.spec.ts

import
{ Test, TestingModule }
from

'@nestjs/testing'
;
import
{ SoilService }
from

'./soil.service'
;
import
{ SupabaseService }
from

'../supabase/supabase.service'
;
import
{ TimezoneFormatterService }
from

'../common/timezone-formatter.service'
;
describe(
'SoilService'
,
() =>
{

let
service: SoilService;
beforeEach(
async
() => {

const

module
: TestingModule =
await
Test.createTestingModule({
Found 29 lines of similar code in 4 locations (mass = 159)
src/soil/soil.service.ts

devEui: 

string
,

startDate
:
Date
,

endDate
:
Date
,
timezone?:
string
,
):
Promise
<TableRow<
'cw_soil_data'

[]> {

const
normalizedTimeZone = timezone?.trim() ||
null
;

if
(normalizedTimeZone) {

this
.timezoneFormatter.assertValidTimeZone(normalizedTimeZone);
}
Found 27 lines of similar code in 4 locations (mass = 83)
src/traffic/traffic.controller.spec.ts

import
{ Test, TestingModule }
from

'@nestjs/testing'
;
import
{ TrafficController }
from

'./traffic.controller'
;
import
{ TrafficService }
from

'./traffic.service'
;
import
{ SupabaseService }
from

'../supabase/supabase.service'
;
import
{ TimezoneFormatterService }
from

'../common/timezone-formatter.service'
;
describe(
'TrafficController'
,
() =>
{

let
controller: TrafficController;
beforeEach(
async
() => {
Found 90 lines of similar code in 3 locations (mass = 423)
src/traffic/traffic.controller.ts

import
{ BadRequestException, Controller, Get, Post, Body, Patch, Param, Delete, Query, UseGuards }
from

'@nestjs/common'
;
import
{ TrafficService }
from

'./traffic.service'
;
import
{ TrafficDataDto }
from

'./dto/traffic-data.dto'
;
import

type
{ CreateTrafficDto }
from

'./dto/create-traffic.dto'
;
import

type
{ UpdateTrafficDto }
from

'./dto/update-traffic.dto'
;
import
{ JwtAuthGuard }
from

'../auth/guards/jwt.auth.guard'
;
import
{ ApiBadRequestResponse, ApiBearerAuth, ApiInternalServerErrorResponse, ApiOkResponse, ApiParam, ApiQuery, ApiSecurity, ApiUnauthorizedResponse }
from

'@nestjs/swagger'
;
import
{ ErrorResponseDto }
from

'../common/dto/error-response.dto'
;
@controller
(
'traffic'
)
Found 25 lines of similar code in 4 locations (mass = 79)
src/traffic/traffic.service.spec.ts

import
{ Test, TestingModule }
from

'@nestjs/testing'
;
import
{ TrafficService }
from

'./traffic.service'
;
import
{ SupabaseService }
from

'../supabase/supabase.service'
;
import
{ TimezoneFormatterService }
from

'../common/timezone-formatter.service'
;
describe(
'TrafficService'
,
() =>
{

let
service: TrafficService;
beforeEach(
async
() => {

const

module
: TestingModule =
await
Test.createTestingModule({
Found 29 lines of similar code in 4 locations (mass = 159)
src/traffic/traffic.service.ts

devEui: 

string
,

startDate
:
Date
,

endDate
:
Date
,
timezone?:
string
,
):
Promise
<TableRow<
'cw_traffic2'

[]> {

const
normalizedTimeZone = timezone?.trim() ||
null
;

if
(normalizedTimeZone) {

this
.timezoneFormatter.assertValidTimeZone(normalizedTimeZone);
}
Found 27 lines of similar code in 4 locations (mass = 83)
src/water/water.controller.spec.ts

import
{ Test, TestingModule }
from

'@nestjs/testing'
;
import
{ WaterController }
from

'./water.controller'
;
import
{ WaterService }
from

'./water.service'
;
import
{ SupabaseService }
from

'../supabase/supabase.service'
;
import
{ TimezoneFormatterService }
from

'../common/timezone-formatter.service'
;
describe(
'WaterController'
,
() =>
{

let
controller: WaterController;
beforeEach(
async
() => {
Found 90 lines of similar code in 3 locations (mass = 423)
src/water/water.controller.ts

import
{ BadRequestException, Controller, Get, Post, Body, Patch, Param, Delete, Query, UseGuards }
from

'@nestjs/common'
;
import
{ WaterService }
from

'./water.service'
;
import
{ WaterDataDto }
from

'./dto/water-data.dto'
;
import

type
{ CreateWaterDto }
from

'./dto/create-water.dto'
;
import

type
{ UpdateWaterDto }
from

'./dto/update-water.dto'
;
import
{ JwtAuthGuard }
from

'../auth/guards/jwt.auth.guard'
;
import
{ ApiBadRequestResponse, ApiBearerAuth, ApiInternalServerErrorResponse, ApiOkResponse, ApiParam, ApiQuery, ApiSecurity, ApiUnauthorizedResponse }
from

'@nestjs/swagger'
;
import
{ ErrorResponseDto }
from

'../common/dto/error-response.dto'
;
@controller
(
'water'
)
Found 25 lines of similar code in 4 locations (mass = 79)
src/water/water.service.spec.ts

import
{ Test, TestingModule }
from

'@nestjs/testing'
;
import
{ WaterService }
from

'./water.service'
;
import
{ SupabaseService }
from

'../supabase/supabase.service'
;
import
{ TimezoneFormatterService }
from

'../common/timezone-formatter.service'
;
describe(
'WaterService'
,
() =>
{

let
service: WaterService;
beforeEach(
async
() => {

const

module
: TestingModule =
await
Test.createTestingModule({
Found 29 lines of similar code in 4 locations (mass = 159)
src/water/water.service.ts

devEui: 

string
,

startDate
:
Date
,

endDate
:
Date
,
timezone?:
string
,
):
Promise
<TableRow<
'cw_water_data'

[]> {

const
normalizedTimeZone = timezone?.trim() ||
null
;

if
(normalizedTimeZone) {

this
.timezoneFormatter.assertValidTimeZone(normalizedTimeZone);
}

Metadata

Metadata

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions