Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exclude from generated code from code coverage #123

Merged
merged 6 commits into from
Aug 22, 2023

Conversation

christianhelle
Copy link
Owner

The changes here add the [GeneratedCode] attribute to the generated types

Refitted the CodeCov workflow for simplicity. The 'Build' step was removed because it was redundant as 'dotnet test' also builds the project. Also, the 'Test' command was modified to directly target the test project, which makes it more precise and potentially speeds up the process. Redundant commands listing files were also eliminated.
The refit interface generators have been updated to include the GeneratedCode attribute in the interface declarations. This has been done to clearly mark automatically generated code and provide clarity about its source and version.
New tests have been added to the 'SwaggerPetstoreTests' in 'Refitter.Tests' to verify the functionality of the 'GenerateCode' method with respect to different versions and formats of the SwaggerPetstore specification (both JSON and YAML, V2 and V3), and different settings of the 'MultipleInterfaces' property. The aim is to ensure that the generated code includes the proper 'GeneratedCode' attribute.
A new test file named MultipleInterfacesByTagsTests.cs was added in Refitter.Tests/Examples. The test ensures that the Refitter API generator creates the correct interfaces when the API specification contains multiple tags. The tests also verify that generated code can be built successfully. The addition of this test improves the code coverage and assure the functionality of MultipleInterfaces.
Added a new test file 'MultipleInterfacesByEndpointTests.cs' in the 'Refitter.Tests' project to verify the multiple interfaces' handling. Tests ensure the correctness of the system in generating different endpoints like 'IGetAllFoosEndpoint' and 'IGetAllBarsEndpoint', ensuring the handling of different operations for every endpoint.
@christianhelle christianhelle added the enhancement New feature, bug fix, or request label Aug 22, 2023
@codecov
Copy link

codecov bot commented Aug 22, 2023

Codecov Report

Merging #123 (27479e7) into main (7b01141) will increase coverage by 12.03%.
Report is 3 commits behind head on main.
The diff coverage is 100.00%.

@@             Coverage Diff             @@
##             main     #123       +/-   ##
===========================================
+ Coverage   86.21%   98.25%   +12.03%     
===========================================
  Files          34       31        -3     
  Lines        1030      972       -58     
===========================================
+ Hits          888      955       +67     
+ Misses        131        6      -125     
  Partials       11       11               
Flag Coverage Δ
unittests 98.25% <100.00%> (+12.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Changed Coverage Δ
src/Refitter.Core/RefitInterfaceGenerator.cs 100.00% <100.00%> (+1.26%) ⬆️
...itter.Core/RefitMultipleInterfaceByTagGenerator.cs 94.52% <100.00%> (+0.23%) ⬆️
...c/Refitter.Core/RefitMultipleInterfaceGenerator.cs 100.00% <100.00%> (ø)
...ests/Examples/MultipleInterfacesByEndpointTests.cs 100.00% <100.00%> (ø)
...er.Tests/Examples/MultipleInterfacesByTagsTests.cs 100.00% <100.00%> (ø)
src/Refitter.Tests/SwaggerPetstoreTests.cs 99.31% <100.00%> (+0.02%) ⬆️

... and 5 files with indirect coverage changes

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

100.0% 100.0% Coverage
0.0% 0.0% Duplication

@christianhelle christianhelle merged commit f5db96f into main Aug 22, 2023
@christianhelle christianhelle deleted the exclude-from-code-coverage branch August 22, 2023 22:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature, bug fix, or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant