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

The Detekt HTML Report should include date, version number, website link (Feature Request) #2416

Closed
ozmium opened this issue Mar 7, 2020 · 7 comments · Fixed by #2470
Closed

Comments

@ozmium
Copy link

ozmium commented Mar 7, 2020

Expected Behavior

The "detekt report" HTML file should contain the following:

  • The date the report was generated, using a suitable long date format, something like "Generated on: Saturday, 7 March 2020, 14:45, UTC"
  • The version number of the detekt tool.
  • A URL link to the detekt website (or to the detekt Github page)

Current Behavior

The HTML report does not contain any of these 3 items.

Context

When 1 or more HTML reports are viewed in a web browser, the user cannot tell when the report was generated, or which detekt version was used. This makes it difficult to compare reports. Other code analysis Lint tools, like SpotBugs, will display some of these things.

@ozmium ozmium changed the title The Detekt HTML Report should include date, version number, website link The Detekt HTML Report should include date, version number, website link (Feature Request) Mar 7, 2020
@schalkms
Copy link
Member

schalkms commented Mar 8, 2020

Good idea!
I agree with the first and second point.
What purpose does the third point serve? @ozmium

@ozmium
Copy link
Author

ozmium commented Mar 8, 2020

A URL link to the website has multiple purposes:

  • Attribution / referencing -- just in case there is another project called "detekt"
  • Branding and marketing -- increase awareness of the project
  • Make it easier for people to find out more about the tool, particularly if they are seeing the report for the first time, with no prior knowledge

@schalkms
Copy link
Member

schalkms commented Mar 8, 2020

Thanks for stating that!
Do you have resources to help us out here? @ozmium

The following class and the corresponding test cases should be adapted.
https://github.com/arturbosch/detekt/blob/master/detekt-cli/src/main/kotlin/io/gitlab/arturbosch/detekt/cli/out/HtmlOutputReport.kt

@ozmium
Copy link
Author

ozmium commented Mar 8, 2020

I can try. I could submit a pull request of an initial change. But I won't be able to check out the whole project or test the change, or write a unit test for it. Someone else will have to test it and tidy it up, but I don't mind helping to refine it, if given guidance. Let me know if that's acceptable to you.

@schalkms
Copy link
Member

schalkms commented Mar 8, 2020

That's acceptable. Please go ahead! Thanks for your time and help! 👍

@BraisGabin
Copy link
Member

I agree with all of them too, but: would the date mess up the gradle cache?

@schalkms
Copy link
Member

schalkms commented Mar 8, 2020

I agree with all of them too, but: would the date mess up the gradle cache?

I would add Date.now() to the HtmlReport. Thus it shouldn't be a problem.

schalkms added a commit that referenced this issue Mar 22, 2020
* Add date, detekt-version + link to HtmlReport

These tags are added to the beginning of the HtmlReport.

Closes #2416

* Format date in HtmlReport

Example: 2020-03-20 12:11:36 UTC

* Add test for 'generated with' header to HtmlReport

* Delete created file in unit test on exit

* Move generated with info to the bottom

of the HtmlReport
@arturbosch arturbosch added this to the 1.8.0 milestone Mar 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants