Skip to content

Commit a14692a

Browse files
committed
Add evaluate mode feature with cli command example
1 parent dd9f976 commit a14692a

4 files changed

Lines changed: 74 additions & 0 deletions

File tree

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ The list of plugins must be specified in the [configuration file](./TeamTools.Li
1717

1818
| Parameter | Shortcut | Description |
1919
|-----------|----------|-------------|
20+
| `--evaluate` || Evaluate mode to test linter features. It uses severity = warning and EvaluateConfig.json |
2021
| `--config` | `-c` | Path to the configuration file |
2122
| `--dir` | `-d` | Path to a directory containing files to be linted |
2223
| `--file` | `-f` | Path to a single file to be linted |
@@ -34,6 +35,17 @@ The list of plugins must be specified in the [configuration file](./TeamTools.Li
3435

3536
## Usage Examples
3637

38+
### 🚀 First time run to evaluate linter features and capabilities
39+
40+
```cmd
41+
.\TeamTools.Linter.CommandLine.exe --dir "c:\source\my_project" --evaluate
42+
```
43+
44+
Evaluate-mode raises minimal severity to `warning` and forces `EvaluateConfig.json` to be used.
45+
Use this mode to find significant violations in a project which has never been analyzed by this linter before
46+
to test if the linter suffices your needs. Rules related to formatting standard, naming convention and such
47+
are disabled in this mode.
48+
3749
### Linting diff for a directory
3850

3951
```cmd

TeamTools.Linter.CommandLine/Config/CommandLineOptions.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ namespace TeamTools.TSQL.Linter.CommandLine.Config
88
public class CommandLineOptions
99
{
1010
private string configFile = SanitizePath(Path.Combine(AppContext.BaseDirectory, "DefaultConfig.json"));
11+
private string evaluateConfigFile = SanitizePath(Path.Combine(AppContext.BaseDirectory, "EvaluateConfig.json"));
1112
private string directoryName;
1213
private string fileName;
1314
private string fileListSource;
@@ -250,6 +251,23 @@ public string BasePath
250251
HelpText = "Show current version")]
251252
public bool Version { get; set; }
252253

254+
[Option(
255+
longName: "evaluate",
256+
Required = false,
257+
Default = false,
258+
HelpText = "Use this option for first run to detect significant violations only")]
259+
public bool EvaluateApp
260+
{
261+
set
262+
{
263+
if (value)
264+
{
265+
minimalSeverity = Severity.Warning;
266+
configFile = evaluateConfigFile;
267+
}
268+
}
269+
}
270+
253271
private static string SanitizePath(string value)
254272
{
255273
if (string.IsNullOrWhiteSpace(value))
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
{
2+
"plugins": {
3+
"SSDT": {
4+
"dll": "./Plugins/TeamTools.Linter.SSDT/TeamTools.SSDT.ProjectValidator.dll",
5+
"config": "./Plugins/TeamTools.Linter.SSDT/DefaultConfig.json"
6+
},
7+
"TSQL": {
8+
"dll": "./Plugins/TeamTools.Linter.TSQL/TeamTools.TSQL.Linter.dll",
9+
"config": "./Plugins/TeamTools.Linter.TSQL/EvaluateConfig.json"
10+
}
11+
},
12+
"ignore": {
13+
"folders": [
14+
".git",
15+
".vs",
16+
".stylecop",
17+
"bin",
18+
"obj",
19+
"Framework",
20+
"TestResults",
21+
"TestSources",
22+
"node_packages",
23+
"packages",
24+
"tSQLt"
25+
],
26+
"extensions": [
27+
".dll",
28+
".orig",
29+
".exe",
30+
".user",
31+
".local",
32+
".dbmdl",
33+
".jfm",
34+
".dacpac",
35+
".rar",
36+
".zip",
37+
".7z"
38+
]
39+
},
40+
"options": {
41+
"mainBranch": "master"
42+
}
43+
}

TeamTools.Linter.CommandLine/TeamTools.Linter.CommandLine.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
<ItemGroup>
3434
<Content Include="..\LICENSE" Pack="true" CopyToOutputDirectory="PreserveNewest" />
3535
<Content Include="DefaultConfig.json" CopyToOutputDirectory="PreserveNewest" />
36+
<Content Include="EvaluateConfig.json" CopyToOutputDirectory="PreserveNewest" />
3637
<Folder Include="plugins\" />
3738
</ItemGroup>
3839

0 commit comments

Comments
 (0)