Skip to content

Commit 2a68b49

Browse files
authored
Merge pull request #199 from nanotaboada/feature/dot-runsettings-file
feature/dot-runsettings-file
2 parents b9713d8 + b47e6f9 commit 2a68b49

File tree

4 files changed

+80
-46
lines changed

4 files changed

+80
-46
lines changed

.codacy.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
# Codacy configuration for excluding files and folders from analysis
22
# https://docs.codacy.com/repositories-configure/codacy-configuration-file/#ignore-files
3-
# Uses Java GLOB syntax: https://docs.oracle.com/javase/tutorial/essential/io/fileOps.html#glob
3+
# Uses Java glob syntax: https://docs.oracle.com/javase/tutorial/essential/io/fileOps.html#glob
44

55
exclude_paths:
6-
# Ignore all project-level metadata and documentation
6+
7+
# Ignore all root-level metadata and documentation
78
- '.gitignore' # root Git ignore file
9+
- '.runsettings' # root runsettings file
810
- 'LICENSE' # root license file
911
- 'README.md' # root readme
1012

@@ -26,4 +28,4 @@ exclude_paths:
2628
- '**/Models/**' # Domain and DTO models
2729
- '**/Properties/**' # launchSettings.json or AssemblyInfo.cs
2830
- '**/Utilities/**' # Helper extensions or static classes
29-
- '**/test/**' # Entire test suite (unit + integration)
31+
- 'test/**/*' # Entire test suite (unit + integration)

.github/workflows/dotnet.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ jobs:
4646
uses: actions/checkout@v4
4747

4848
- name: Run tests and generate Cobertura coverage reports
49-
run: dotnet test --results-directory "coverage" --collect:"Code Coverage;Format=cobertura"
49+
run: dotnet test --results-directory "coverage" --collect:"Code Coverage;Format=cobertura" --settings .runsettings
5050

5151
- name: Install dotnet-coverage tool
5252
run: dotnet tool install --global dotnet-coverage

.runsettings

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<RunSettings>
3+
<DataCollectionRunSettings>
4+
<DataCollectors>
5+
<DataCollector friendlyName="Code Coverage" uri="datacollector://Microsoft/CodeCoverage/2.0">
6+
<Configuration>
7+
<CodeCoverage>
8+
<!-- Exclude all test projects -->
9+
<ModulePaths>
10+
<Exclude>
11+
<ModulePath>.*\.Tests\.dll$</ModulePath>
12+
</Exclude>
13+
</ModulePaths>
14+
</CodeCoverage>
15+
</Configuration>
16+
</DataCollector>
17+
</DataCollectors>
18+
</DataCollectionRunSettings>
19+
</RunSettings>

codecov.yml

Lines changed: 55 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,65 @@
1+
# Codecov repository YAML
12
# https://docs.codecov.com/docs/codecov-yaml
2-
33
coverage:
44

55
# https://docs.codecov.com/docs/commit-status
66
status:
7+
78
project:
89
default:
9-
target: 80% # Default target for all components
10-
threshold: 10% # Allowable drop in coverage without failing
11-
if_not_found: success # If no coverage report is found, don't fail
12-
if_ci_failed: error # CI failure should fail coverage check
13-
14-
# Components for focused coverage metrics
15-
controllers:
16-
paths:
17-
- "Dotnet.Samples.AspNetCore.WebApi/Controllers/"
18-
services:
19-
paths:
20-
- "Dotnet.Samples.AspNetCore.WebApi/Services/"
21-
22-
patch:
23-
default:
24-
target: 80% # Target for changed lines
25-
threshold: 10%
10+
target: 80% # Default target for all components
11+
threshold: 10% # Allowable drop in coverage without failing
12+
if_not_found: success # If no coverage report is found, don't fail
13+
if_ci_failed: error # CI failure should fail coverage check
14+
15+
patch:
16+
default:
17+
target: 80% # Target for changed lines
18+
threshold: 10% # Allowable drop in coverage without failing
19+
20+
component_management:
21+
22+
default_rules: # default rules that will be inherited by all components
23+
statuses:
24+
- type: project # components that don't have a status defined will have a project type one
25+
target: auto
26+
branches:
27+
- "!main"
28+
29+
individual_components:
30+
- component_id: controllers # this is an identifier that should not be changed
31+
name: Controllers # this is a display name, and can be changed freely
32+
paths:
33+
- 'src/Dotnet.Samples.AspNetCore.WebApi/Controllers/'
34+
- component_id: services
35+
name: Services
36+
paths:
37+
- 'src/Dotnet.Samples.AspNetCore.WebApi/Services/'
38+
39+
comment:
40+
layout: "header, diff, flags, components"
2641

2742
# https://docs.codecov.com/docs/ignoring-paths
2843
ignore:
29-
# Ignore common project metadata and config files
30-
- '.*\.sln' # Solution files
31-
- '.*\.csproj' # C# project files
32-
- '.*\.json' # JSON config files (e.g., appsettings)
33-
- '.*\.yml' # YAML config files (e.g., pipelines)
34-
- '.*\.png' # Image assets (e.g., Swagger diagram)
35-
36-
# Ignore test project entirely
37-
- '.*\/test\/.*' # Any file in the test folder (unit/integration/utils)
38-
39-
# Ignore infrastructure and support folders anywhere in the project
40-
- '.*\/Data\/.*' # Repositories, DbContext, database files
41-
- '.*\/Enums\/.*' # Enums like Position
42-
- '.*\/Mappings\/.*' # AutoMapper profiles
43-
- '.*\/Migrations\/.*' # EF Core migration artifacts
44-
- '.*\/Models\/.*' # Domain and DTO models
45-
- '.*\/Properties\/.*' # launchSettings.json or other system files
46-
- '.*\/Utilities\/.*' # Static helper and extension classes
47-
48-
# Ignore application entry point and documentation files
49-
- '.*\/Program\.cs' # ASP.NET Core entry point
50-
- '.*\/\.gitignore' # Git ignore file
51-
- '.*\/LICENSE' # License text
52-
- '.*\/README\.md' # Project readme
44+
# Ignoring specific file yypes
45+
- '**/*.sln' # Solution files
46+
- '**/*.csproj' # C# project files
47+
- '**/*.json' # JSON config files (e.g., appsettings)
48+
- '**/*.yml' # YAML config files (e.g., pipelines)
49+
- '**/*.png' # Image assets (e.g., Swagger diagram)
50+
51+
# Ignoring a specific folder
52+
- 'src/**/Data/**/*' # Repositories, DbContext, database files
53+
- 'src/**/Enums/**/*' # Enums like Position
54+
- 'src/**/Mappings/**/*' # AutoMapper profiles
55+
- 'src/**/Migrations/**/*' # EF Core migration artifacts
56+
- 'src/**/Models/**/*' # Domain and DTO models
57+
- 'src/**/Properties/**/*' # launchSettings.json or other system files
58+
- 'src/**/Utilities/**/*' # Static helper and extension classes
59+
- 'test' # Any file in the test folder (unit/integration/utils)
60+
61+
# Ignoring Specific Files At All Depths
62+
- '**/Program.cs' # ASP.NET Core entry point
63+
- '**/.gitignore' # Git ignore file
64+
- '**/LICENSE' # License text
65+
- '**/README.md' # Project readme

0 commit comments

Comments
 (0)