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

Move report base path handling to OutputReport #7234

Merged
merged 2 commits into from Apr 28, 2024
Merged

Conversation

3flex
Copy link
Member

@3flex 3flex commented Apr 27, 2024

Base path is only relevant for report output. This opens the next step of removing FilePath class and using absolute paths everywhere else.

Copy link

codecov bot commented Apr 27, 2024

Codecov Report

Attention: Patch coverage is 76.47059% with 4 lines in your changes are missing coverage. Please review.

Project coverage is 84.66%. Comparing base (537c4fe) to head (25aa867).

Files Patch % Lines
...otlin/io/github/detekt/report/md/MdOutputReport.kt 75.00% 1 Missing and 1 partial ⚠️
...n/io/github/detekt/report/html/HtmlOutputReport.kt 75.00% 0 Missing and 1 partial ⚠️
...lin/io/github/detekt/report/xml/XmlOutputReport.kt 80.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #7234      +/-   ##
============================================
- Coverage     84.68%   84.66%   -0.03%     
- Complexity     3984     3992       +8     
============================================
  Files           578      578              
  Lines         12158    12168      +10     
  Branches       2499     2499              
============================================
+ Hits          10296    10302       +6     
- Misses          626      627       +1     
- Partials       1236     1239       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@3flex 3flex mentioned this pull request Apr 27, 2024
@@ -34,4 +34,8 @@ abstract class OutputReport : Extension {
* Defines the translation process of detekt's result into a string.
*/
abstract fun render(detektion: Detektion): String?

companion object {
const val DETEKT_OUTPUT_REPORT_BASE_PATH_KEY = "detekt.output.report.base.path"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe what I'm talking about is for future PRs but I would like to know what do you think:

  1. Shouldn't we move this value to a proper property inside the context? Using this constant seems duck tape to avoid break the api. But with 2.0 we can avoid the duck tape.
  2. If we do that, should we make it nullable? I would vote for no. I think that we can always get good default values on our clients.

Copy link
Member Author

@3flex 3flex Apr 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. I was in two minds about this. Some reports use absolute paths so I figured it could be better to make it available but not part of the API since it's not used for all reports. But on the other hand it's more convenient to make it part of the API. Could we keep this for a future PR? I don't want to get blocked.
  2. Agree that base path should not be nullable if it's added to the API as suggested. I've actually found a couple of places where it wasn't being passed through properly which came out in a PR I'm working on now so some of those gaps will be closed and we can make that change.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we keep this for a future PR? I don't want to get blocked.

Sure! I'll open an issue :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@BraisGabin BraisGabin merged commit 0cab28d into detekt:main Apr 28, 2024
20 of 21 checks passed
@3flex 3flex deleted the location branch April 28, 2024 21:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants