Skip to content

Commit d8d6927

Browse files
committed
Merge develop branch and resolve conflicts
2 parents 3fd284e + 18580f9 commit d8d6927

File tree

87 files changed

+1309
-1232
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

87 files changed

+1309
-1232
lines changed

.azuredevops/pipelines/templates/stages/integration-tests-git-repository.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,10 @@ stages:
2424
pool:
2525
vmImage: $(imageName)
2626
steps:
27+
- checkout: self
28+
lfs: true
2729
- template: ../steps/install-net8.yml
2830
- template: ../steps/provide-nuget-packages.yml
2931
- powershell: ./build.ps1 --verbosity=diagnostic
3032
workingDirectory: ./tests/Cake.Issues.GitRepository/script-runner
31-
displayName: 'Run integration tests'
32-
- publish: $(Build.SourcesDirectory)/BuildArtifacts/TestResults/Integration
33-
artifact: Integration Tests Cake.Issues.GitRepository Cake Scripting $(System.JobName)
34-
displayName: 'Publish generated reports as build artifact'
33+
displayName: 'Run integration tests'

.github/copilot-instructions.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
This is a .NET based repository containing addins for the Cake Build Automation System.
2+
The individual addins are published as NuGet packages.
3+
Follow these guidelines when contributing:
4+
5+
## Before committing code
6+
- Ensure no warning or error messages from Roslyn analyzers are present in the code.
7+
- Ensure Tests are passing.
8+
- Ensure Integration Tests for the affected addins are passing.
9+
10+
## Development Flow
11+
- Only building: `build.sh --target=DotNetCore-Build`
12+
- Publish NuGet Packages: `build.sh --target=Create-NuGet-Packages`
13+
- Run Tests: `build.sh --target=Test`
14+
- Run Integration Tests:
15+
- Run first `build.sh --target=Create-NuGet-Packages` in the root directory to create the NuGet packages.
16+
- Run `build.sh` in the `tests/<ADDIN-NAME>/script-runner` or `tests/<ADDIN-NAME>/frosting` directory to run the integration tests for the corresponding addin
17+
- Full CI check: `build.sh` (includes build, publish, test)
18+
- Building website: `build.sh --target=website`. Website is available on http://127.0.0.1:8000/
19+
20+
## Repository Structure
21+
- `src`: Contains the source code for the addins
22+
- Each addin should have its own subdirectory under `src`
23+
- Use a consistent naming convention for directories and files
24+
- `nuspec/nuget`: Contains the NuGet specification files for each addin
25+
- Each addin should have its own `.nuspec` file
26+
- Each addin is published for Cake .NET Tool and Cake Frosting in their separate `.nuspec` files
27+
- Each package should have a README file in Markdown format
28+
- Cake Frosting packages should contain a targets file to import the namespace of the addin
29+
- `docs`: Contains documentation for the addins
30+
- Documentation is created uses Material for MkDocs
31+
- Use Markdown format for documentation files
32+
- Include usage examples where applicable
33+
- `tests`: Contains integration tests for the addins
34+
- Each addin should have its own subdirectory under `tests`
35+
- Cake .NET Tool tests should be in `tests/<ADDIN-NAME>/script-runner`
36+
- Cake Frosting tests should be in `tests/<ADDIN-NAME>/frosting`
37+
- Cake Frosting tests should be available for all supported .NET Framework versions
38+
- `.github/workflows`: Contains GitHub Actions workflows for CI/CD which need to be maintained
39+
- `.azuredevops/pipelines/templates`: Contains Azure Pipelines templates which need to be maintained. The main file is `azure-pipelines.yml` in the root directory.
40+
41+
## Key Guidelines
42+
1. Follow best practices for writing Cake addins as documented at https://cakebuild.net/docs/extending/addins/best-practices
43+
2. For specific issue providers, report formats and pull request systems, refer to the documentation at https://cakeissues.net/latest/documentation/extending/ and sub pages.
44+
3. Maintain existing code structure and organization
45+
4. Write unit tests for new functionality.
46+
- Use helpers from `src/Cake.Issues.Testing` when writing unit tests.
47+
- Use `src/Cake.Issues.Testing/IssueChecker.cs` to compare issues against expected results.
48+
5. Write integration tests for new functionality which can't be tested with unit tests.
49+
6. Maintain basic documentation in the `docs/` folder. Avoid API documentation which is automatically generated.
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: "Copilot Setup Steps"
2+
3+
# Automatically run the setup steps when they are changed to allow for easy validation, and
4+
# allow manual testing through the repository's "Actions" tab
5+
on:
6+
workflow_dispatch:
7+
push:
8+
paths:
9+
- .github/workflows/copilot-setup-steps.yml
10+
pull_request:
11+
paths:
12+
- .github/workflows/copilot-setup-steps.yml
13+
14+
jobs:
15+
# The job MUST be called `copilot-setup-steps` or it will not be picked up by Copilot.
16+
copilot-setup-steps:
17+
runs-on: ubuntu-latest
18+
19+
# Set the permissions to the lowest permissions possible needed for the steps.
20+
# Copilot will be given its own token for its operations.
21+
permissions:
22+
contents: read
23+
24+
# Defined steps will run before the agent starts.
25+
steps:
26+
- name: Checkout code
27+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
28+
- name: Fetch all tags and branches
29+
run: git fetch --prune --unshallow
30+
- name: Install .NET
31+
uses: actions/setup-dotnet@67a3573c9a986a3f9c594539f4ab511d57bb3ce9 # v4
32+
with:
33+
# .NET 5 required for GitVersion
34+
dotnet-version: |
35+
5.x
36+
8.x
37+
9.x
38+
# Ubuntu 24.04 does not have Mono installed, which is Required for Cake.Recipe
39+
- name: Install Mono
40+
run: sudo apt-get install mono-complete

.vscode/settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"dotnet.defaultSolution": "src\\Cake.Issues.sln",
2+
"dotnet.defaultSolution": "src\\Cake.Issues.slnx",
33
"yaml.schemas": {
44
"https://squidfunk.github.io/mkdocs-material/schema.json": "mkdocs.yml"
55
},

docs/input/documentation/issue-providers/gitrepository/examples.md renamed to docs/input/documentation/issue-providers/gitrepository/examples/basic-usage.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
2-
title: Examples
3-
description: Examples for using the Cake.Issues.GitRepository addin.
2+
title: Basic repository analysis
3+
description: Example showing basic Git repository analysis.
44
icon: material/test-tube
55
---
66

@@ -136,4 +136,4 @@ The following example prints the number of binary files which are not tracked by
136136
context.Information("{0} issues are found.", issues.Count());
137137
}
138138
}
139-
```
139+
```
Lines changed: 191 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,191 @@
1+
---
2+
title: Excluding files with patterns
3+
description: Example showing how to exclude files from repository analysis using glob patterns.
4+
icon: material/test-tube
5+
---
6+
7+
To analyze Git repositories you need to import the Git repository issue provider:
8+
9+
=== "Cake .NET Tool"
10+
11+
```csharp title="build.cake"
12+
#addin nuget:?package=Cake.Issues&version={{ cake_issues_version }}
13+
#addin nuget:?package=Cake.Issues.GitRepository&version={{ cake_issues_version }}
14+
```
15+
16+
!!! note
17+
In addition to the Git repository issue provider the `Cake.Issues` core addin needs to be added.
18+
19+
=== "Cake SDK"
20+
21+
```csharp title="Build.csproj"
22+
<Project Sdk="Cake.Sdk">
23+
<PropertyGroup>
24+
<TargetFramework>{{ example_tfm }}</TargetFramework>
25+
<RunWorkingDirectory>$(MSBuildProjectDirectory)</RunWorkingDirectory>
26+
</PropertyGroup>
27+
<ItemGroup>
28+
<PackageReference Include="Cake.Frosting.Issues.GitRepository" Version="{{ cake_issues_version }}" />
29+
</ItemGroup>
30+
</Project>
31+
```
32+
33+
=== "Cake Frosting"
34+
35+
```csharp title="Build.csproj"
36+
<Project Sdk="Microsoft.NET.Sdk">
37+
<PropertyGroup>
38+
<OutputType>Exe</OutputType>
39+
<TargetFramework>{{ example_tfm }}</TargetFramework>
40+
<RunWorkingDirectory>$(MSBuildProjectDirectory)</RunWorkingDirectory>
41+
<ImplicitUsings>enable</ImplicitUsings>
42+
</PropertyGroup>
43+
<ItemGroup>
44+
<PackageReference Include="Cake.Frosting" Version="{{ cake_version }}" />
45+
<PackageReference Include="Cake.Frosting.Issues.GitRepository" Version="{{ cake_issues_version }}" />
46+
</ItemGroup>
47+
</Project>
48+
```
49+
50+
The following example shows how to exclude files from repository analysis using glob patterns.
51+
52+
=== "Cake .NET Tool"
53+
54+
```csharp title="build.cake"
55+
Task("Analyze-Repo-With-Exclusions")
56+
.Does(() =>
57+
{
58+
// Read issues.
59+
var repoRootPath = MakeAbsolute(Directory("./"));
60+
var settings =
61+
new GitRepositoryIssuesSettings
62+
{
63+
CheckBinaryFilesTrackedByLfs = true,
64+
CheckFilesPathLength = true,
65+
MaxFilePathLength = 260
66+
};
67+
68+
// Exclude temporary files from all checks
69+
settings.FilesToExclude.Add("*.tmp");
70+
settings.FilesToExclude.Add("temp/**");
71+
72+
// Exclude specific binary files from LFS tracking checks
73+
settings.FilesToExcludeFromBinaryFilesLfsCheck.Add("*.dll");
74+
settings.FilesToExcludeFromBinaryFilesLfsCheck.Add("bin/**");
75+
settings.FilesToExcludeFromBinaryFilesLfsCheck.Add("obj/**");
76+
77+
// Exclude generated code from path length checks
78+
settings.FilesToExcludeFromFilePathLengthCheck.Add("generated/**");
79+
settings.FilesToExcludeFromFilePathLengthCheck.Add("**/AssemblyInfo.cs");
80+
81+
var issues =
82+
ReadIssues(
83+
GitRepositoryIssues(settings),
84+
repoRootPath);
85+
86+
Information("{0} issues are found.", issues.Count());
87+
});
88+
```
89+
90+
=== "Cake SDK"
91+
92+
```csharp title="build.cs"
93+
Task("Analyze-Repo-With-Exclusions")
94+
.Does(() =>
95+
{
96+
// Read issues.
97+
var repoRootPath = MakeAbsolute(Directory("./"));
98+
var settings =
99+
new GitRepositoryIssuesSettings
100+
{
101+
CheckBinaryFilesTrackedByLfs = true,
102+
CheckFilesPathLength = true,
103+
MaxFilePathLength = 260
104+
};
105+
106+
// Exclude temporary files from all checks
107+
settings.FilesToExclude.Add("*.tmp");
108+
settings.FilesToExclude.Add("temp/**");
109+
110+
// Exclude specific binary files from LFS tracking checks
111+
settings.FilesToExcludeFromBinaryFilesLfsCheck.Add("*.dll");
112+
settings.FilesToExcludeFromBinaryFilesLfsCheck.Add("bin/**");
113+
settings.FilesToExcludeFromBinaryFilesLfsCheck.Add("obj/**");
114+
115+
// Exclude generated code from path length checks
116+
settings.FilesToExcludeFromFilePathLengthCheck.Add("generated/**");
117+
settings.FilesToExcludeFromFilePathLengthCheck.Add("**/AssemblyInfo.cs");
118+
119+
var issues =
120+
ReadIssues(
121+
GitRepositoryIssues(settings),
122+
repoRootPath);
123+
124+
Information("{0} issues are found.", issues.Count());
125+
});
126+
```
127+
128+
=== "Cake Frosting"
129+
130+
```csharp title="Program.cs"
131+
using Cake.Common.Diagnostics;
132+
using Cake.Frosting;
133+
134+
public static class Program
135+
{
136+
public static int Main(string[] args)
137+
{
138+
return new CakeHost()
139+
.Run(args);
140+
}
141+
}
142+
143+
[TaskName("Analyze-Repo-With-Exclusions")]
144+
public sealed class AnalyzeRepoWithExclusionsTask : FrostingTask<FrostingContext>
145+
{
146+
public override void Run(FrostingContext context)
147+
{
148+
// Read issues.
149+
var repoRootPath = context.MakeAbsolute(context.Directory("./"));
150+
var settings =
151+
new GitRepositoryIssuesSettings
152+
{
153+
CheckBinaryFilesTrackedByLfs = true,
154+
CheckFilesPathLength = true,
155+
MaxFilePathLength = 260
156+
};
157+
158+
// Exclude temporary files from all checks
159+
settings.FilesToExclude.Add("*.tmp");
160+
settings.FilesToExclude.Add("temp/**");
161+
162+
// Exclude specific binary files from LFS tracking checks
163+
settings.FilesToExcludeFromBinaryFilesLfsCheck.Add("*.dll");
164+
settings.FilesToExcludeFromBinaryFilesLfsCheck.Add("bin/**");
165+
settings.FilesToExcludeFromBinaryFilesLfsCheck.Add("obj/**");
166+
167+
// Exclude generated code from path length checks
168+
settings.FilesToExcludeFromFilePathLengthCheck.Add("generated/**");
169+
settings.FilesToExcludeFromFilePathLengthCheck.Add("**/AssemblyInfo.cs");
170+
171+
var issues =
172+
context.ReadIssues(
173+
context.GitRepositoryIssues(settings),
174+
repoRootPath);
175+
176+
context.Information("{0} issues are found.", issues.Count());
177+
}
178+
}
179+
```
180+
181+
## Supported exclusion patterns
182+
183+
The exclusion functionality supports glob-style patterns:
184+
185+
| Pattern | Description | Example matches |
186+
|--------------|--------------------------------------------------|----------------------------------------------|
187+
| `*.txt` | All files with .txt extension in current level | `file.txt`, `readme.txt` |
188+
| `**/*.txt` | All .txt files in any subdirectory | `docs/file.txt`, `a/b/c/file.txt` |
189+
| `temp/**` | All files in temp directory and subdirectories | `temp/file.log`, `temp/sub/file.txt` |
190+
| `**/bin/**` | All files in any bin directory | `project/bin/file.dll`, `bin/debug/file.exe` |
191+
| `file?.txt` | Files matching single character wildcard | `file1.txt`, `fileA.txt` |
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
title: Examples
3+
description: Examples for using the Cake.Issues.GitRepository addin.
4+
icon: material/test-tube
5+
---
6+
7+
<div class="grid cards" markdown>
8+
9+
- :material-test-tube: [Basic repository analysis](basic-usage.md)
10+
- :material-test-tube: [Excluding files with patterns](excluding-files.md)
11+
12+
</div>

docs/input/documentation/issue-providers/gitrepository/features.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ provides the following features.
1111

1212
- [x] Checks path length of files. See [FilePathTooLong] for details.
1313
- [x] Checks if binary files are tracked by Git LFS. See [BinaryFileNotTrackedByLfs] for details.
14+
- [x] Supports excluding files from checks using glob patterns.
15+
See [Examples](examples/excluding-files.md#supported-exclusion-patterns) for details.
1416

1517
## Supported IIssue properties
1618

docs/input/documentation/issue-providers/gitrepository/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Support for analyzing Git repositories is implemented in the
99
<div class="grid cards" markdown>
1010

1111
- :material-creation-outline: [Features](features.md)
12-
- :material-test-tube: [Examples](examples.md)
12+
- :material-test-tube: [Examples](examples/index.md)
1313
- :fontawesome-solid-scroll: [Rules](rules/index.md)
1414
- :material-api: [API](https://cakebuild.net/extensions/cake-issues-gitrepository){target="_blank"}
1515

docs/mkdocs.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,10 @@ nav:
206206
- Git Repository:
207207
- documentation/issue-providers/gitrepository/index.md
208208
- Features: documentation/issue-providers/gitrepository/features.md
209-
- Examples: documentation/issue-providers/gitrepository/examples.md
209+
- Examples:
210+
- documentation/issue-providers/gitrepository/examples/index.md
211+
- Basic usage: documentation/issue-providers/gitrepository/examples/basic-usage.md
212+
- Excluding files: documentation/issue-providers/gitrepository/examples/excluding-files.md
210213
- Rules:
211214
- documentation/issue-providers/gitrepository/rules/index.md
212215
- BinaryFileNotTrackedByLfs: documentation/issue-providers/gitrepository/rules/BinaryFileNotTrackedByLfs.md

0 commit comments

Comments
 (0)