Skip to content

Commit f986f3a

Browse files
author
Gonzalo Diaz
committed
[BUGFIX] sonarcloud (Maintainability) Add a 'protected' constructor or the 'static' keyword to the class declaration.
Utility classes should not have public constructors csharpsquid:S1118
1 parent 8d42727 commit f986f3a

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

src/algorithm_exercises_csharp/hackerrank/interview_preparation_kit/dictionaries_and_hashmaps/CountTriplets.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,14 @@
44

55
namespace algorithm_exercises_csharp.hackerrank.interview_preparation_kit.dictionaries_and_hashmaps;
66

7+
using System.Diagnostics.CodeAnalysis;
78
using System.Collections.Generic;
89

910
public class CountTriplets
1011
{
12+
[ExcludeFromCodeCoverage]
13+
protected CountTriplets() { }
14+
1115
public static long countTriplets(List<long> arr, long r)
1216
{
1317
Dictionary<long, long> aCounter = [];

src/algorithm_exercises_csharp/hackerrank/interview_preparation_kit/dictionaries_and_hashmaps/CountTripletsBruteForce.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ namespace algorithm_exercises_csharp.hackerrank.interview_preparation_kit.dictio
77

88
public class CountTripletsBruteForce
99
{
10+
[ExcludeFromCodeCoverage]
11+
protected CountTripletsBruteForce() { }
12+
1013
public static long countTriplets(List<long> arr, long r)
1114
{
1215
long size = arr.Count;

src/algorithm_exercises_csharp/hackerrank/interview_preparation_kit/dictionaries_and_hashmaps/RansomNote.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ namespace algorithm_exercises_csharp.hackerrank.interview_preparation_kit.dictio
77

88
public class RansomNote
99
{
10+
[ExcludeFromCodeCoverage]
11+
protected RansomNote() { }
12+
1013
public class InvalidValueException : Exception
1114
{
1215
// constructor for the InvalidAgeException class
@@ -16,9 +19,6 @@ public InvalidValueException(string msg)
1619
}
1720
}
1821

19-
[ExcludeFromCodeCoverage]
20-
protected RansomNote() { }
21-
2222
private static readonly string __YES__ = "Yes";
2323
private static readonly string __NO__ = "No";
2424

0 commit comments

Comments
 (0)