-
Notifications
You must be signed in to change notification settings - Fork 506
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 tests for missing rules in a ruleset #477
Conversation
|
||
open class RuleSetProviderTest( | ||
private val rulesetClass: Class<out RuleSetProvider>, | ||
private val packageName: 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.
nit: We could, in theory, get the package name from rulesetClass
and this would work with current ktlint structure, but in case of custom rulesets, the rules could be located in a different folder, so I would rather leave it like that
import org.junit.Test | ||
import java.io.File | ||
|
||
open class RuleSetProviderTest( |
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.
I'm not sure that this is the best way for the centralized test code - this could be just a simple top-level function, which may be called from within a test method (e.g. in case StandardRuleSetProviderTest
contains other tests), so I'm open for changing this, but currently it works.
This looks like a reasonable approach to me. We can merge it in the future. |
662ef4d
to
2a12348
Compare
@shashachu updated the PR accordingly. Thanks! |
This is a follow up for #476. I would suggest merging this after the
.ktlintignore
landed onmaster
. Or I could also implement ignores list for this kind of tests for now, but I would rather wait for global ignores. It just grabs the source files from the specified location and then checks that all of them are being returned from the specified ruleset.