Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions .codacy.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
# Codacy configuration for excluding files and folders from analysis
# https://docs.codacy.com/repositories-configure/codacy-configuration-file/#ignore-files
# Uses Java GLOB syntax: https://docs.oracle.com/javase/tutorial/essential/io/fileOps.html#glob
# Uses Java glob syntax: https://docs.oracle.com/javase/tutorial/essential/io/fileOps.html#glob

exclude_paths:
# Ignore all project-level metadata and documentation

# Ignore all root-level metadata and documentation
- '.gitignore' # root Git ignore file
- '.runsettings' # root runsettings file
- 'LICENSE' # root license file
- 'README.md' # root readme

Expand All @@ -26,4 +28,4 @@ exclude_paths:
- '**/Models/**' # Domain and DTO models
- '**/Properties/**' # launchSettings.json or AssemblyInfo.cs
- '**/Utilities/**' # Helper extensions or static classes
- '**/test/**' # Entire test suite (unit + integration)
- 'test/**/*' # Entire test suite (unit + integration)
2 changes: 1 addition & 1 deletion .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
uses: actions/checkout@v4

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

- name: Install dotnet-coverage tool
run: dotnet tool install --global dotnet-coverage
Expand Down
19 changes: 19 additions & 0 deletions .runsettings
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<RunSettings>
<DataCollectionRunSettings>
<DataCollectors>
<DataCollector friendlyName="Code Coverage" uri="datacollector://Microsoft/CodeCoverage/2.0">
<Configuration>
<CodeCoverage>
<!-- Exclude all test projects -->
<ModulePaths>
<Exclude>
<ModulePath>.*\.Tests\.dll$</ModulePath>
</Exclude>
</ModulePaths>
</CodeCoverage>
</Configuration>
</DataCollector>
</DataCollectors>
</DataCollectionRunSettings>
</RunSettings>
97 changes: 55 additions & 42 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -1,52 +1,65 @@
# Codecov repository YAML
# https://docs.codecov.com/docs/codecov-yaml

coverage:

# https://docs.codecov.com/docs/commit-status
status:

project:
default:
target: 80% # Default target for all components
threshold: 10% # Allowable drop in coverage without failing
if_not_found: success # If no coverage report is found, don't fail
if_ci_failed: error # CI failure should fail coverage check

# Components for focused coverage metrics
controllers:
paths:
- "Dotnet.Samples.AspNetCore.WebApi/Controllers/"
services:
paths:
- "Dotnet.Samples.AspNetCore.WebApi/Services/"

patch:
default:
target: 80% # Target for changed lines
threshold: 10%
target: 80% # Default target for all components
threshold: 10% # Allowable drop in coverage without failing
if_not_found: success # If no coverage report is found, don't fail
if_ci_failed: error # CI failure should fail coverage check

patch:
default:
target: 80% # Target for changed lines
threshold: 10% # Allowable drop in coverage without failing

component_management:

default_rules: # default rules that will be inherited by all components
statuses:
- type: project # components that don't have a status defined will have a project type one
target: auto
branches:
- "!main"

individual_components:
- component_id: controllers # this is an identifier that should not be changed
name: Controllers # this is a display name, and can be changed freely
paths:
- 'src/Dotnet.Samples.AspNetCore.WebApi/Controllers/'
- component_id: services
name: Services
paths:
- 'src/Dotnet.Samples.AspNetCore.WebApi/Services/'

comment:
layout: "header, diff, flags, components"

# https://docs.codecov.com/docs/ignoring-paths
ignore:
# Ignore common project metadata and config files
- '.*\.sln' # Solution files
- '.*\.csproj' # C# project files
- '.*\.json' # JSON config files (e.g., appsettings)
- '.*\.yml' # YAML config files (e.g., pipelines)
- '.*\.png' # Image assets (e.g., Swagger diagram)

# Ignore test project entirely
- '.*\/test\/.*' # Any file in the test folder (unit/integration/utils)

# Ignore infrastructure and support folders anywhere in the project
- '.*\/Data\/.*' # Repositories, DbContext, database files
- '.*\/Enums\/.*' # Enums like Position
- '.*\/Mappings\/.*' # AutoMapper profiles
- '.*\/Migrations\/.*' # EF Core migration artifacts
- '.*\/Models\/.*' # Domain and DTO models
- '.*\/Properties\/.*' # launchSettings.json or other system files
- '.*\/Utilities\/.*' # Static helper and extension classes

# Ignore application entry point and documentation files
- '.*\/Program\.cs' # ASP.NET Core entry point
- '.*\/\.gitignore' # Git ignore file
- '.*\/LICENSE' # License text
- '.*\/README\.md' # Project readme
# Ignoring specific file yypes
- '**/*.sln' # Solution files
- '**/*.csproj' # C# project files
- '**/*.json' # JSON config files (e.g., appsettings)
- '**/*.yml' # YAML config files (e.g., pipelines)
- '**/*.png' # Image assets (e.g., Swagger diagram)

# Ignoring a specific folder
- 'src/**/Data/**/*' # Repositories, DbContext, database files
- 'src/**/Enums/**/*' # Enums like Position
- 'src/**/Mappings/**/*' # AutoMapper profiles
- 'src/**/Migrations/**/*' # EF Core migration artifacts
- 'src/**/Models/**/*' # Domain and DTO models
- 'src/**/Properties/**/*' # launchSettings.json or other system files
- 'src/**/Utilities/**/*' # Static helper and extension classes
- 'test' # Any file in the test folder (unit/integration/utils)

# Ignoring Specific Files At All Depths
- '**/Program.cs' # ASP.NET Core entry point
- '**/.gitignore' # Git ignore file
- '**/LICENSE' # License text
- '**/README.md' # Project readme
Loading