-
-
Notifications
You must be signed in to change notification settings - Fork 757
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
📃 add detekt-generator module to generate documentation and default config #563
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very good work! :)
I like it.
I know this is just the first prototype. However, I think for generating the markdown content detekt should use an internal DSL. Furthermore, I think it would be a good idea to decouple the generation process. This means detekt could easily provide generators producing other formats.
@schalkms Yep, you're totally correct that the printing part could be a bit nicer. For this first version I mostly focussed on gathering all the necessary data with the collectors. |
Yep, I like it! For an indepth review I need more time but looks fine so far! I like the rule template which we can mention in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
Gonna add a small |
👍 |
@@ -3,7 +3,7 @@ package io.gitlab.arturbosch.detekt.generator.out | |||
/** | |||
* @author Marvin Ramin | |||
*/ | |||
class Markdown(var content: String = "") { | |||
sealed class MD(open var content: String = "") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we find a better name here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about naming the sealed class Markdown
and then have MarkdownContent
and MarkdownList
that extend Markdown
?
should make printing a bit more descriptive
4797c12
to
e344f5e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work! I like it. This is no more WIP?
@schalkms I think this is good to go for now. We can still improve it later on. |
Right. I agree. |
} | ||
|
||
private fun printRule(rule: Rule): String { | ||
return markdown { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we refactor all such functions to expression syntax? -> less indentation + looks better
Or is it just me?
@ all printers
Awesome work looks good with all the dls and stuff :D |
One thing: The rule sources path is hardcoded to |
Yeah, I hardcoded it because it only really makes sense at the moment to run the generator over the rules module. |
Yep, then lets delete the |
@arturbosch Sounds good. Will do that. |
I think it is ok for now. Well we could move it to top level so all github repo visitors see a |
Resolves #343
This PR:
detekt-generator
which is a new CLI module that compiles sources from thedetekt-rules
module and scans them for relevant content to be put into the documentation.RuleSetProvider
s,Rules
andMultiRules
to compose a list of all necessary data to print the documentation and the default-content.*.md
file for the documentation of each Rule Set Provider and it's rules and their configuration options.default-detekt-config.yml
is generated.Currently I still included the generated documentation and the default config. But they're mostly useless at the moment as we only have very few rules documented in the correct style.
Next steps would be adding the necessary KDoc so that we get a full documentation generated from the script.
Currently missing: Tests (working on it, but wanted to share this first for feedback)