-
-
Notifications
You must be signed in to change notification settings - Fork 89
Remove code duplication on temp mod role revocation failure #414
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
Comments
I honestly disagree, just like you used to, see here. They aren't the same thing, and nothing is wrong with handling them differently. |
@Tais993 Suppress is the definitely wrong action, instead it should be acknownledged as wont-fix in sonar itself. That said, I definitely agree to wont-fix on the other duplicate it flagged (the arg extraction of the command options). But for this one I genuinely agree with Sonar. They are identical and will stay identical. This is the failure handle for removing a temporary mod revocation role from a member. In particular, if we introduce another temp mod action that is based on roles, it will get the identical failure handle -> it should be one place and not duplicated. |
I looked a bit into it, and if we want to move the method into |
Doesn't sound like a good idea, it probably makes a lot more sense to become an utility emthod in ModerationUtils |
I agree, it sounds a bit sketchy, I just wanted to point it out :) the thing is, this logic is (and will probably stay) exclusive to |
Should probably end up as utiltiy in the temp mod package thing. |
In a completely new class? |
Sure, why not. Or just make it public in the moderation util. I dont really see a big issue here. Its a bit unfortunate that there is no concept of "subpackage visibility" but it is what it is. The ModUtils helper is only really meaningful for mod stuff anyways and there are already classes outside of the package using it, no? Doesnt really hurt if the subpackage As in, adding a |
only problem I see with that is that |
Thats because it is not a "handleTempModRoleRevocationFailure" (emphasis on role for role-based). Hence it is also not a duplicate. I havent checked its failure handler, is it that similar? I didnt really intend to unify it here as well. |
the thing is, I got a bit confused about the method reference, as all of the three actions share one |
I'll look into it. |
Overview
Sonar correctly flags this as code duplication:
We should unify this section. Maybe move it into
ModerationUtils
as a helper like "handle temporary moderation role revocation failure" or similar.It is currently causing our quality gate to fail (since I made some adjustments on its strictness)
The text was updated successfully, but these errors were encountered: