Below is the screenshot that I took after removing the trailing comma from line #185 :
steps to reproduce
Not quite sure how to reproduce it in any other scenario, but perhaps having a similar code structure like above might reproduce this issue.
potential workaround
Since here the two rules seem to contradict each other, I don’t think this has any workaround other than disabling those rules from within the settings.
These 2 rules are not enabled by default, so you should probably only enable the one that makes sense according to your project’s or team’s conventions.
I was just thinking we can have a single rule for it instead of having two separate rules. We can have a single rule enabled by default(preferably the convention that is widely accepted/recommended) and still keep that customizable(like having a single checkbox that says trailing comma ).
Having a single rule will simplify the user experience and not cause any confusion. This will abstract away similar rules.
We can get some inspiration from already existing rule javascript:S1441 : Quotes for string literals should be used consistently.
The rule description box for S1441 provides a neat and clear instruction for overriding the preference:
Thank you so much for considering this. Just curious : why has this already been marked Solved ?
Another common rules that pop up from time to time are the ones regarding the code formatting conventions like java:S1106 An open curly brace should be located at the beginning of a line. This too can be looked into.
Just like the trailing comma issue, this also can be merged into one with either of those two conventions being made default and providing with option to configure.
I feel there might be other similar rules too which can be merged. I’ll do bring them to your notice if I encounter any.