google / styleguide

Style guides for Google-originated open-source projects
https://google.github.io/styleguide/
Apache License 2.0
37.53k stars 13.3k forks source link

How the 4.4 Column Limit: 100 rule works for JSNI Method Reference? #808

Open Zopsss opened 8 months ago

Zopsss commented 8 months ago

Hey, I'm a contributor at Checkstyle. I was working on this issue to add support for detecting JSNI method for rule 4.4 Column Limit: 100. I made a PR regarding this issue, but there I got stuck on how we should approach this issue. Initially I discussed with the maintainers and we came up with the idea of ignoring the column limit for whole JSNI method declaration for this rule. You can take a look at this file for better understanding how we are ignoring JSNI methods for this rule: https://github.com/checkstyle/checkstyle/blob/40934dddede18b5f004f678f6704a84e32847cb2/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule44columnlimit/InputLineLengthJsniMethods.java

Lines where obeying the column limit is not possible (for example, a long URL in Javadoc, or a long JSNI method reference).

But as you can see google style guide says we only need to ignore the long JSNI method references. One of the maintainer suggested that the JSNI method reference is wrap-able so why there is a need to ignore JSNI reference for this rule when we can wrap it to make it under the column limit?

Here is the conversation link for your reference. Can anyone explain us how the Column Limit rule should work for JSNI Methods? Thank you.