Skip to content

Commit 864df8b

Browse files
authored
Fixed SonarQube warnings
1 parent d2de2a9 commit 864df8b

File tree

9 files changed

+10
-10
lines changed

9 files changed

+10
-10
lines changed

src/main/java/g2601_2700/s2619_array_prototype_last/solution.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ declare global {
77
}
88

99
Array.prototype.last = function () { //NOSONAR
10-
return this.length !== 0 ? this[this.length - 1] : -1
10+
return this.length !== 0 ? this[this.length - 1] : -1 //NOSONAR
1111
}
1212

1313
/*
1414
* const arr = [1, 2, 3];
1515
* arr.last(); // 3
1616
*/
1717

18-
export {}
18+
export {} //NOSONAR

src/main/java/g2601_2700/s2624_snail_traversal/solution.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@ Array.prototype.snail = function (rowsCount: number, colsCount: number): number[
2424
* arr.snail(1,4); // [[1,2,3,4]]
2525
*/
2626

27-
export {}
27+
export {} //NOSONAR

src/main/java/g2601_2700/s2626_array_reduce_transformation/solution.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ type Fn = (accum: number, curr: number) => number
44

55
function reduce(nums: number[], fn: Fn, init: number): number {
66
let accumulator = init
7-
nums.forEach((num) => {
7+
nums.forEach((num) => { //NOSONAR
88
accumulator = fn(accumulator, num)
99
})
1010
return accumulator

src/main/java/g2601_2700/s2630_memoize_ii/solution.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ function memoize(fn: Fn): Fn {
3636

3737
let value = fn(...args)
3838

39-
currentCache.set(args[args.length - 1], value)
39+
currentCache.set(args[args.length - 1], value) //NOSONAR
4040
return value
4141
}
4242
}

src/main/java/g2601_2700/s2631_group_by/solution.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@ Array.prototype.groupBy = function <T>(fn: (item: T) => string) { //NOSONAR
2323
* [1,2,3].groupBy(String) // {"1":[1],"2":[2],"3":[3]}
2424
*/
2525

26-
export {}
26+
export {} //NOSONAR

src/main/java/g2601_2700/s2693_call_function_with_custom_context/solution.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ Function.prototype.callPolyfill = function (context, ...args): any { //NOSONAR
1616
* increment.callPolyfill({count: 1}); // 2
1717
*/
1818

19-
export {}
19+
export {} //NOSONAR

src/main/java/g2601_2700/s2694_event_emitter/solution.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class EventEmitter {
3232

3333
emit(eventName: string, args: any[] = []): any[] {
3434
const res = []
35-
this.eventMap.get(eventName)?.forEach((cb) => res.push(cb(...args)))
35+
this.eventMap.get(eventName)?.forEach((cb) => res.push(cb(...args))) //NOSONAR
3636
return res
3737
}
3838
}

src/main/java/g2701_2800/s2705_compact_object/solution.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ type Obj = Record<any, any>
55
function compactObject(obj: Obj): Obj {
66
if (Array.isArray(obj)) {
77
let retArr = []
8-
obj.forEach((e, idx) => {
8+
obj.forEach((e, idx) => { //NOSONAR
99
if (e) {
1010
retArr.push(compactObject(e))
1111
}

src/main/java/g2701_2800/s2726_calculator_with_method_chaining/solution.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class Calculator {
2323
}
2424

2525
divide(value: number): Calculator { //NOSONAR
26-
if (value === 0) throw Error('Division by zero is not allowed')
26+
if (value === 0) throw new Error('Division by zero is not allowed')
2727
this.init /= value
2828
return this
2929
}

0 commit comments

Comments
 (0)