Skip to content

Commit 2e63290

Browse files
authored
Merge pull request #19 from magic5644:feature-run-directly-if-one-solution
Refactor code for clarity by removing unused directives
2 parents a41ae19 + 48412bf commit 2e63290

File tree

6 files changed

+9
-20
lines changed

6 files changed

+9
-20
lines changed

CodeLineCounter.Tests/DependencyGraphGeneratorTests.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
1-
using CodeLineCounter.Utils;
21
using CodeLineCounter.Models;
32
using CodeLineCounter.Services;
4-
using System.Collections.Generic;
5-
using System.IO;
6-
using Xunit;
73

84
namespace CodeLineCounter.Tests
95
{

CodeLineCounter.Tests/JsonHandlerTests.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
using CodeLineCounter.Utils;
22
using System.Text.Json;
3-
using System.Text.Json.Serialization;
4-
using Xunit.Sdk;
53

64
namespace CodeLineCounter.Tests
75
{

CodeLineCounter/Program.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,21 @@ static void Main(string[] args)
1212
return;
1313

1414
// file deepcode ignore PT: Not a web server. This software is a console application.
15-
var solutionFiles = FileUtils.GetSolutionFiles(settings.DirectoryPath);
15+
List <string> solutionFiles = FileUtils.GetSolutionFiles(settings.DirectoryPath);
1616
if (solutionFiles.Count == 0)
1717
{
1818
Console.WriteLine("No solution (.sln) found in the specified directory.");
1919
return;
2020
}
2121

22+
// If only one solution found in directory, select it automatically
23+
// if more than one waiting for user selection
24+
if (solutionFiles.Count == 1)
25+
{
26+
SolutionAnalyzer.AnalyzeAndExportSolution(solutionFiles[0], settings.Verbose, settings.format);
27+
return;
28+
}
29+
2230
var solutionFilenameList = CoreUtils.GetFilenamesList(solutionFiles);
2331
CoreUtils.DisplaySolutions(solutionFilenameList);
2432

CodeLineCounter/Services/CodeDuplicationChecker.cs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,7 @@
1-
using System;
21
using System.Collections.Concurrent;
3-
using System.Collections.Generic;
4-
using System.IO;
5-
using System.Linq;
6-
using System.Security.Cryptography;
72
using System.Text;
8-
using System.Threading.Tasks;
93
using CodeLineCounter.Models;
104
using CodeLineCounter.Utils;
11-
using Microsoft.CodeAnalysis;
125
using Microsoft.CodeAnalysis.CSharp;
136
using Microsoft.CodeAnalysis.CSharp.Syntax;
147

CodeLineCounter/Services/DependencyAnalyzer.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,6 @@
44
using CodeLineCounter.Models;
55
using CodeLineCounter.Utils;
66
using System.Collections.Concurrent;
7-
using System;
8-
using System.Collections.Generic;
9-
using System.IO;
10-
using System.Linq;
11-
using System.Threading.Tasks;
127

138

149
namespace CodeLineCounter.Services

CodeLineCounter/Services/DependencyGraphGenerator.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
using CodeLineCounter.Models;
22
using QuikGraph;
33
using QuikGraph.Graphviz;
4-
using System.Diagnostics;
54

65
namespace CodeLineCounter.Services
76
{

0 commit comments

Comments
 (0)