Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 79f0b42

Browse files
authored
Merge pull request #114 from sir-gon/develop
[REFACTOR] Codefactor issues, fixed.
2 parents ffefa59 + 2826c96 commit 79f0b42

File tree

4 files changed

+42
-42
lines changed

4 files changed

+42
-42
lines changed

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@ namespace algorithm_exercises_csharp.hackerrank.interview_preparation_kit;
55
using System.Diagnostics.CodeAnalysis;
66
using System.Collections.Generic;
77

8-
public class InvalidValueException:Exception
8+
public class RansomNote
99
{
10-
// constructor for the InvalidAgeException class
11-
public InvalidValueException(string msg)
10+
public class InvalidValueException : Exception
1211
{
13-
Console.WriteLine(msg);
12+
// constructor for the InvalidAgeException class
13+
public InvalidValueException(string msg)
14+
{
15+
Console.WriteLine(msg);
16+
}
1417
}
15-
}
1618

17-
public class RansomNote
18-
{
1919
[ExcludeFromCodeCoverage]
2020
protected RansomNote() { }
2121

‎algorithm_exercises_csharp/src/hackerrank/interview_preparation_kit/greedy_algorithms/LuckBalance.cs‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ namespace algorithm_exercises_csharp.hackerrank.interview_preparation_kit;
44

55
using System.Diagnostics.CodeAnalysis;
66

7-
public class Competition(int _luck, int _important)
8-
{
9-
public int luck => _luck;
10-
public int important => _important;
11-
}
12-
137
public class LuckBalance
148
{
9+
public class Competition(int _luck, int _important)
10+
{
11+
public int luck => _luck;
12+
public int important => _important;
13+
}
14+
1515
[ExcludeFromCodeCoverage]
1616
protected LuckBalance() { }
1717

‎algorithm_exercises_csharp/src/hackerrank/projecteuler/Euler003.cs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ protected Euler003() { }
2222
int i = 2;
2323
while (i <= Math.Sqrt(divisor))
2424
{
25-
if (0==divisor % i)
25+
if (divisor % i==0)
2626
{
2727
divisor = divisor / i;
2828
max_prime_factor = divisor;

‎algorithm_exercises_csharp_base/src/Logger.cs‎

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -3,45 +3,45 @@ namespace algorithm_exercises_csharp;
33
using Microsoft.Extensions.Logging;
44
using System;
55

6-
public sealed class LoggerSingleton
6+
public static class Log
77
{
8-
privatestaticreadonlyLazy<LoggerSingleton>_instance=new(()=>newLoggerSingleton());
9-
10-
publicstatic LoggerSingletonInstance=>_instance.Value;
8+
sealedclassLoggerSingleton
9+
{
10+
privatestatic readonlyLazy<LoggerSingleton>_instance=new(()=>newLoggerSingleton());
1111

12-
public ILoggerLogger{get;}
12+
public staticLoggerSingletonInstance=>_instance.Value;
1313

14-
private LoggerSingleton()
15-
{
16-
// Read the LOG_LEVEL environment variable
17-
var logLevelEnv = Environment.GetEnvironmentVariable("LOG_LEVEL") ?? "Information";
14+
public ILogger Logger { get; }
1815

19-
// Convert the environment variable value to LogLevel
20-
if (!Enum.TryParse<LogLevel>(logLevelEnv, ignoreCase: true, out var logLevel))
16+
private LoggerSingleton()
2117
{
22-
logLevel=LogLevel.Information;// Set the minimum logging level
23-
}
18+
// Read the LOG_LEVEL environment variable
19+
varlogLevelEnv=Environment.GetEnvironmentVariable("LOG_LEVEL")??"Information";
2420

25-
var loggerFactory = LoggerFactory.Create(builder =>
26-
{
27-
builder
28-
.AddConsole()
29-
.SetMinimumLevel(logLevel); // set minimum logging level
30-
});
21+
// Convert the environment variable value to LogLevel
22+
if (!Enum.TryParse<LogLevel>(logLevelEnv, ignoreCase: true, out var logLevel))
23+
{
24+
logLevel = LogLevel.Information; // Set the minimum logging level
25+
}
3126

32-
Logger = loggerFactory.CreateLogger("GlobalLogger");
27+
var loggerFactory = LoggerFactory.Create(builder =>
28+
{
29+
builder
30+
.AddConsole()
31+
.SetMinimumLevel(logLevel); // set minimum logging level
32+
});
3333

34-
Logger.LogInformation("Initializing");
34+
Logger=loggerFactory.CreateLogger("GlobalLogger");
3535

36-
Logger.LogInformation("Info level enabled");
37-
Logger.LogWarning("Warning level enabled");
38-
Logger.LogError("Error level enabled");
39-
Logger.LogDebug("Debug level enabled");
36+
Logger.LogInformation("Initializing");
37+
38+
Logger.LogInformation("Info level enabled");
39+
Logger.LogWarning("Warning level enabled");
40+
Logger.LogError("Error level enabled");
41+
Logger.LogDebug("Debug level enabled");
42+
}
4043
}
41-
}
4244

43-
public static class Log
44-
{
4545
public static ILogger getLogger()
4646
{
4747
return LoggerSingleton.Instance.Logger;

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /