Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
114 changes: 0 additions & 114 deletions SynonymsAPI/Services/BadService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -137,28 +137,6 @@ public bool Add(string word, string foo)
{
try
{
if (word == "A")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Getting better: Code Duplication
reduced similar code in: Calculate

Why does this problem occur?

Avoid duplicated, aka copy-pasted, code inside the module. More duplication lowers the code health. Read more.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No longer an issue: Complex Method
Add is no longer above the threshold for cyclomatic complexity

Why does this problem occur?

This function has many conditional statements (e.g. if, for, while), leading to lower code health. Avoid adding more conditionals and code to it without refactoring. Read more.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Getting better: Overall Code Complexity
The mean cyclomatic complexity decreases from 9.25 to 7.38, threshold = 4

Why does this problem occur?

This file has many conditional statements (e.g. if, for, while) across its implementation, leading to lower code health. Avoid adding more conditionals. Read more.

{

}
else if (word.Contains("B"))
{
if (word == "BA")
{

}
else if (word == "BB")
{
if (word == "A")
{

}
}
}
else if (word == "C")
{

}
return true;
}
catch (Exception)
Expand All @@ -172,65 +150,6 @@ public bool Add(string word, int foo)
{
try
{
if (word == "A")
{
if (word == "A")
{
if (word == "A")
{

}

}
else if (word.Contains("B"))
{
if (word == "BA")
{
if (word == "A")
{

}
else if (word.Contains("B"))
{
if (word == "BA")
{

}
else if (word == "BB")
{

}
}
else if (word == "C")
{

}
}
else if (word == "BB")
{

}
}
else if (word == "C")
{

}
}
else if (word.Contains("B"))
{
if (word == "BA")
{

}
else if (word == "BB")
{

}
}
else if (word == "C")
{

}
Comment on lines -175 to -233

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Getting better: Complex Method
Add decreases in cyclomatic complexity from 18 to 10, threshold = 9

Why does this problem occur?

This function has many conditional statements (e.g. if, for, while), leading to lower code health. Avoid adding more conditionals and code to it without refactoring. Read more.

Comment on lines -175 to -233

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No longer an issue: Bumpy Road Ahead
Add is no longer above the threshold for logical blocks with deeply nested code

Comment on lines -175 to -233

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No longer an issue: Deep, Nested Complexity
Add is no longer above the threshold for nested complexity depth

return true;
}
catch (Exception)
Expand Down Expand Up @@ -489,39 +408,6 @@ public decimal Calculate(decimal amount, int type, int years)
{
decimal result = 0;
decimal disc = (years > 5) ? (decimal)5 / 100 : (decimal)years / 100;
if (type == 1)
{
result = amount;
if (type == 1)
{
result = amount;
}
else if (type == 2)
{
result = (amount - (0.1m * amount)) - disc * (amount - (0.1m * amount));
}
else if (type == 3)
{
result = (0.7m * amount) - disc * (0.7m * amount);
}
else if (type == 4)
{
result = (amount - (0.5m * amount)) - disc * (amount - (0.5m * amount));
}
return result;
}
else if (type == 2)
{
result = (amount - (0.1m * amount)) - disc * (amount - (0.1m * amount));
}
else if (type == 3)
{
result = (0.7m * amount) - disc * (0.7m * amount);
}
else if (type == 4)
{
result = (amount - (0.5m * amount)) - disc * (amount - (0.5m * amount));
}
Comment on lines -492 to -524

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No longer an issue: Complex Method
Calculate is no longer above the threshold for cyclomatic complexity

Why does this problem occur?

This function has many conditional statements (e.g. if, for, while), leading to lower code health. Avoid adding more conditionals and code to it without refactoring. Read more.

return result;
}

Expand Down
64 changes: 64 additions & 0 deletions SynonymsAPI/Services/SynonymsService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,39 @@ public bool Add(string word, List<string> synonyms)
{
if (word == "BA")
{
if (word == "A")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ℹ Getting worse: Overall Code Complexity
The mean cyclomatic complexity increases from 6.15 to 7.54, threshold = 4

Why does this problem occur?

This file has many conditional statements (e.g. if, for, while) across its implementation, leading to lower code health. Avoid adding more conditionals. Read more.

To ignore this warning click here.

{
Comment on lines +108 to +109

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❌ Getting worse: Complex Method
Add increases in cyclomatic complexity from 15 to 24, threshold = 9

Why does this problem occur?

This function has many conditional statements (e.g. if, for, while), leading to lower code health. Avoid adding more conditionals and code to it without refactoring. Read more.

To ignore this warning click here.


}
else if (word.Contains("B"))
{
if (word == "BA")
{

}
else if (word == "BB")
{
if (word == "BA")
{

}
else if (word == "BB")
{
if (word == "BA")
{

}
else if (word == "BB")
{

}
}
}
}
else if (word == "C")
{

}
}
else if (word == "BB")
{
Expand Down Expand Up @@ -224,7 +256,39 @@ public bool AddTest(string word)
{
if (word == "BA")
{
if (word == "A")
{

}
else if (word.Contains("B"))
{
if (word == "BA")
{

}
else if (word == "BB")
{
if (word == "BA")
{

}
else if (word == "BB")
{
if (word == "BA")
{

}
else if (word == "BB")
{

}
}
}
}
else if (word == "C")
{

}
}
else if (word == "BB")
{
Expand Down
Binary file modified SynonymsAPI/obj/Debug/net6.0/SynonymsAPI.assets.cache
Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion SynonymsAPI/obj/SynonymsAPI.csproj.nuget.g.props
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">/Users/irmadzemidzic/.nuget/packages/</NuGetPackageRoot>
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">/Users/irmadzemidzic/.nuget/packages/</NuGetPackageFolders>
<NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle>
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">6.3.1</NuGetToolVersion>
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">6.4.0</NuGetToolVersion>
</PropertyGroup>
<ItemGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<SourceRoot Include="/Users/irmadzemidzic/.nuget/packages/" />
Expand Down
2 changes: 1 addition & 1 deletion SynonymsAPI/obj/project.assets.json
Original file line number Diff line number Diff line change
Expand Up @@ -2306,7 +2306,7 @@
"privateAssets": "all"
}
},
"runtimeIdentifierGraphPath": "/usr/local/share/dotnet/sdk/7.0.101/RuntimeIdentifierGraph.json"
"runtimeIdentifierGraphPath": "/usr/local/share/dotnet/sdk/7.0.200/RuntimeIdentifierGraph.json"
}
}
}
Expand Down
Binary file modified Test/obj/Debug/net6.0/Test.assets.cache
Binary file not shown.
Binary file modified Test/obj/Debug/net6.0/Test.csproj.AssemblyReference.cache
Binary file not shown.
4 changes: 2 additions & 2 deletions Test/obj/Test.csproj.nuget.dgspec.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
"privateAssets": "all"
}
},
"runtimeIdentifierGraphPath": "/usr/local/share/dotnet/sdk/7.0.100/RuntimeIdentifierGraph.json"
"runtimeIdentifierGraphPath": "/usr/local/share/dotnet/sdk/7.0.200/RuntimeIdentifierGraph.json"
}
}
},
Expand Down Expand Up @@ -165,7 +165,7 @@
"privateAssets": "all"
}
},
"runtimeIdentifierGraphPath": "/usr/local/share/dotnet/sdk/7.0.100/RuntimeIdentifierGraph.json"
"runtimeIdentifierGraphPath": "/usr/local/share/dotnet/sdk/7.0.200/RuntimeIdentifierGraph.json"
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion Test/obj/Test.csproj.nuget.g.props
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">/Users/irmadzemidzic/.nuget/packages/</NuGetPackageRoot>
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">/Users/irmadzemidzic/.nuget/packages/</NuGetPackageFolders>
<NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle>
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">6.3.1</NuGetToolVersion>
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">6.4.0</NuGetToolVersion>
</PropertyGroup>
<ItemGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<SourceRoot Include="/Users/irmadzemidzic/.nuget/packages/" />
Expand Down
2 changes: 1 addition & 1 deletion Test/obj/project.assets.json
Original file line number Diff line number Diff line change
Expand Up @@ -6061,7 +6061,7 @@
"privateAssets": "all"
}
},
"runtimeIdentifierGraphPath": "/usr/local/share/dotnet/sdk/7.0.100/RuntimeIdentifierGraph.json"
"runtimeIdentifierGraphPath": "/usr/local/share/dotnet/sdk/7.0.200/RuntimeIdentifierGraph.json"
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion Test/obj/project.nuget.cache
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"version": 2,
"dgSpecHash": "E4m49csFIS2W9uPs6fTmIKkPExzohhYc5HY7EBjobz4ilg7i0WK8U3trUxoaO53IFDRWvLfJHrM/Ht34+2NITw==",
"dgSpecHash": "w3bcz/GtNt+QWxDU/6n8SYqGKzLXGCk+Gm+m8GONJVXr1pW/NADjJAHJlpalu9y3485tZ/bIZOFKmpOZ9r9B2w==",
"success": true,
"projectFilePath": "/Users/irmadzemidzic/CSTesting/Test/Test.csproj",
"expectedPackageFiles": [
Expand Down