Skip to content
This repository was archived by the owner on Apr 6, 2024. It is now read-only.

Commit 5938cef

Browse files
authored
Add DupFinder to demos (#331)
1 parent a654692 commit 5938cef

File tree

6 files changed

+54
-4
lines changed

6 files changed

+54
-4
lines changed

demos/build.cake

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
1+
#addin "Cake.Markdownlint"
12
#addin "Cake.Issues&prerelease"
23
#addin "Cake.Issues.MsBuild&prerelease"
34
#addin "Cake.Issues.Markdownlint&prerelease"
5+
#addin "Cake.Issues.DupFinder&prerelease"
46
#addin "Cake.Issues.InspectCode&prerelease"
57
#addin "Cake.Issues.Reporting&prerelease"
68
#addin "Cake.Issues.Reporting.Generic&prerelease"
79

10+
#tool "nuget:?package=JetBrains.ReSharper.CommandLineTools"
11+
812
#load build/build/build.cake
913
#load build/analyze/analyze.cake
1014
#load build/create-reports/create-reports.cake

demos/build/analyze/analyze.cake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1+
#load dupfinder.cake
12
#load inspectcode.cake
23
#load markdownlint.cake
34
#load custom-issue.cake
45

56
Task("Analyze")
67
.IsDependentOn("Build")
8+
.IsDependentOn("Run-DupFinder")
79
.IsDependentOn("Run-InspectCode")
810
.IsDependentOn("Lint-Documentation")
911
.IsDependentOn("Create-CustomIssues");

demos/build/analyze/dupfinder.cake

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
Task("Run-DupFinder")
2+
.Description("Runs JetBrains DupFinder analysis")
3+
.WithCriteria((context) => context.IsRunningOnWindows(), "DupFinder is only supported on Windows.")
4+
.Does<BuildData>((data) =>
5+
{
6+
var dupFinderLogFilePath =
7+
data.RepoRootFolder.CombineWithFilePath("dupFinder.log");
8+
9+
// Run DupFinder
10+
var settings = new DupFinderSettings() {
11+
OutputFile = dupFinderLogFilePath
12+
};
13+
14+
DupFinder(
15+
data.SourceFolder.CombineWithFilePath("ClassLibrary1.sln"),
16+
settings);
17+
18+
// Read issues
19+
var readIssuesSettings = new ReadIssuesSettings(data.RepoRootFolder)
20+
{
21+
FileLinkSettings =
22+
IssueFileLinkSettingsForGitHubBranch(
23+
new System.Uri("https://github.com/cake-contrib/Cake.Issues.Reporting.Generic"),
24+
"develop",
25+
"demos"
26+
)
27+
};
28+
29+
data.Issues.AddRange(
30+
ReadIssues(
31+
DupFinderIssuesFromFilePath(dupFinderLogFilePath),
32+
readIssuesSettings));
33+
});

demos/build/analyze/inspectcode.cake

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#tool "nuget:?package=JetBrains.ReSharper.CommandLineTools"
2-
31
Task("Run-InspectCode")
42
.Description("Runs JetBrains InspectCode analysis")
53
.WithCriteria((context) => context.IsRunningOnWindows(), "InspectCode is only supported on Windows.")

demos/build/analyze/markdownlint.cake

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#addin "Cake.Markdownlint"
2-
31
Task("Lint-Documentation")
42
.IsDependentOn("Lint-DemoDocumentation")
53
.IsDependentOn("Lint-TemplateGalleryDocumentation");

demos/src/ClassLibrary1/Class1.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,21 @@ public class Class1
1111
public void Foo()
1212
{
1313
var foo = "foo";
14+
var bar = "bar";
15+
if (!string.IsNullOrEmpty(foo) && !string.IsNullOrEmpty(bar))
16+
{
17+
var foobar = foo + bar;
18+
}
19+
}
20+
21+
public void Bar()
22+
{
23+
var foo = "foo";
24+
var bar = "bar";
25+
if (!string.IsNullOrEmpty(foo) && !string.IsNullOrEmpty(bar))
26+
{
27+
var foobar = foo + bar;
28+
}
1429
}
1530
}
1631
}

0 commit comments

Comments
 (0)