-
Notifications
You must be signed in to change notification settings - Fork 1
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 DoNotUseIsOneAssertions rule #37
Conversation
6806a47
to
ff7a853
Compare
PR to remove the inverse rule from backend - https://github.com/Faire/backend/pull/146826 |
{ DoNotUseIsOneAssertions(it) }, | ||
) { | ||
@Test | ||
fun `using isOne causes failure`() { |
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.
Add a test for calling isOne()
with a receiver context that is not an assertion method?
@@ -42,6 +43,7 @@ internal class FaireRulesProvider : RuleSetProvider { | |||
DoNotUseHasSizeForEmptyListInAssert(config), | |||
DoNotUseIsEqualToWhenArgumentIsOne(config), | |||
DoNotUseIsEqualToWhenArgumentIsZero(config), | |||
DoNotUseIsOneAssertions(config), |
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.
Because this rule directly contradicts DoNotUseIsEqualToWhenArgumentIsOne
, do we have to worry about both rules being enabled by default? I think the official detekt team usually adds rules disabled by default.
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.
Is the way to have it disabled by default to just not add it to this file? I'm dropping that one for backend in this PR.
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.
Talked offline, we'll let users of these rules just update their config file when they update the version.
76eca40
to
4539950
Compare
Following these steps from @Adriel-M to get my rule available in the backend repo - #37 To do a release you must: * [This PR] bump version here (after your change gets merged in): https://github.com/Faire/faire-detekt-rules/blob/main/gradle.properties * Run this workflow https://github.com/Faire/faire-detekt-rules/actions/workflows/release.yml (at this point, this is going to publish to maven central :nodders: ) * (optional but you should) git tag that commit to the same version in 1 * create a release here: https://github.com/Faire/faire-detekt-rules/releases * If you want to test out the rule on backend before actually creating a release, I did create this write up in our other repo: https://github.com/Faire/sqldelight-cockroachdb-dialect?tab=readme-ov-file#using-a-snapshot-release
Moving it over here as per https://github.com/Faire/backend/pull/144173#discussion_r1586541528.
JIRA Ticket: https://fairewholesale.atlassian.net/browse/FD-208736