-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Issue #14487: add support to ignore JSNI methods for LineLength check in google config #14501
Conversation
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.
please update
checkstyle/src/xdocs/google_style.xml
Lines 790 to 793 in a4411aa
<a href="https://webtoolkit.googleblog.com/2008/07/getting-to-really-know-gwt-part-1-jsni.html"> | |
JSNI</a> | |
could not be detected right now, but might be possible after | |
comments and javadoc support appear in Checkstyle. |
items:
.../google/checkstyle/test/chapter4formatting/rule44columnlimit/InputLineLengthJsniMethods.java
Outdated
Show resolved
Hide resolved
src/it/java/com/google/checkstyle/test/chapter4formatting/rule44columnlimit/LineLengthTest.java
Show resolved
Hide resolved
sorry I accidently requested a re-review from you.. I don't have permission to dismiss it |
I have added the suppression description in google_style.xml but it is still complaining about it. What do I need to do to fix this? And also I added following to the <li>
<a href="https://github.com/search?q=path%3Asrc%2Fmain%2Fresources+path%3A**%2Fgoogle_checks.xml+repo%3Acheckstyle%2Fcheckstyle+SuppressWithPlainTextCommentFilter">
Google Style</a>
</li> but this gets automatically removed after note: the link I specified in |
@romani ping |
This is generated from the associated template file, please update that.
Please use git blame to find some commit where we added other filters, there might be some special changes needed for these. |
thanks for the help, I have resolved these errors. I'm facing some new errors after running
some warning classes mentioned in the last errors are:
note: It mentioned so many warning classes, I did not add all of them otherwise the comment would be too long... I also tried to run I did not touched these classes at all, I think the error is not caused by the changes I made, it is caused by something else... I'm not so sure what to do with these errors. Can you help me out with this? @nrmancuso |
You can always check this by checking out master and running |
IDK how but now |
@nrmancuso @romani is my PR ready to merged? |
0dd911b
to
2d80f72
Compare
@nrmancuso did the and sorry for the late reply, GitHub didn't notified me about the force push |
@Zopsss spellcheck failure is valid, please fix it |
done. I also needed to modify |
dont know why circleci and semaphoreci are complaining, they didn't specify proper error message ;__; |
@Zopsss please resolve conflicts |
Done and now all checks are passing expect the Cirrus @nrmancuso |
the website looks fine to me. I guess we're good to go now |
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.
Items:
.../google/checkstyle/test/chapter4formatting/rule44columnlimit/InputLineLengthJsniMethods.java
Outdated
Show resolved
Hide resolved
…ngth check in google 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.
@Zopsss thanks a lot, it is always good to see more ✅ on the google config!
@romani ping |
GitHub, generate website |
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.
Ok to merge
the only question can be: |
Umm I'm not so sure about it because there are other Checks too which uses suppressions but we've not added them to the table. For example,
we're using Maybe we can add the suppression to the Suppressions section, like I did here #14501 (review), I've removed thay code as Mr Nick suggested but if you agree with me then I can add it again. Again I'm not so sure that we should follow this approach or we should do as you suggested. |
We can always improve in separate issue. If maintainers find it useful. I am not sure about it. |
<!-- See https://google.github.io/styleguide/javaguide.html#s4.4-column-limit --> | ||
<module name="SuppressWithPlainTextCommentFilter"> | ||
<property name="offCommentFormat" value="\/\*-\{"/> | ||
<property name="onCommentFormat" value="\}-\*\/"/> |
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.
@nrmancuso @romani Why are we ignoring the entire JSNI method?
https://google.github.io/styleguide/javaguide.html#s4.4-column-limit
Lines where obeying the column limit is not possible (for example, ... a long JSNI method reference)
Google seems pretty clear it should only be the method reference, in the issue's case seems to be the method declaration which I am not sure it is a reference, and not the entire method.
The console.log
violation in the issue seems valid to me. I am starting to think the other violation is valid.
https://checkstyle.org/google_style.html#a4.4
JSNI could not be detected right now, but might be possible after comments and javadoc support appear in Checkstyle.
We cannot detect JSNI references without parsing support IMO.
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.
If we are to ignore JSNI completely because it is not supported by us, then https://checkstyle.org/google_style.html#a4.4 needs to be updated to say that and shouldn't be removed or turned green. The example in the issue doesn't seem to be a valid reason to ignore JSNI. It should be centered around we cannot identify JSNI method references which is what Google says we must be able to identify.
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.
Google seems pretty clear it should only be the method reference
Do you have examples of method reference?
What is this? And how it looks like?
I found https://groups.google.com/g/Google-Web-Toolkit/c/8PXM54IwtDE/m/9naSp1CTYdcJ , so looks like @com.ecopy.gwt.client.Utils::messageBox(Ljava/lang/String;,Ljava/lang/ String;);
is a jsni method reference. But I don't know why it can not be wrapped and how it can be used
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.
It comes down to this: without more details or examples, we really have no idea what the author of the google style guide had in mind when they wrote it. If we want to make sure we are doing the right thing here, we should open an issue at https://github.com/google/styleguide?tab=readme-ov-file for clarification in this section.
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.
@Zopsss , please create issue on Google style to clarify reason of such special allowance for long JSNI method reference
as it is wrap-able.
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.
@Zopsss your posts are very well written, thanks for that.
Thankk youuuu 😺✨
I am not sure what the lift required is to set up the GWT compiler, but at this point it might be a good idea to do this and see if such references can be line wrapped or not.
Yeahh I don't think many people uses GWT compiler. But it's better to ask the community before moving on
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.
To be clear:
but at this point it might be a good idea to do this and see if such references can be line wrapped or not
This means that you might be able to get a definitive answer on the line wrapping without waiting for a reply in your posts.
The style guide makes it sound like it’s not possible to do this, but if it is, then this statement from the style guide is either outdated or plain incorrect.
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.
This means that you might be able to get a definitive answer on the line wrapping without waiting for a reply in your posts.
Can you elaborate what do you mean by definitive answer?
The style guide makes it sound like it’s not possible to do this, but if it is, then this statement from the style guide is either outdated or plain incorrect.
The style guide is really old, I guess the documentation is not changed since it was created so it is outdated.
JSNI could not be detected right now, but might be possible after comments and javadoc support appear in Checkstyle
As you can see at the time google_checks.xml was created, Checkstyle did not had support for comments/javadocs.
Support for google java style guide was introduced in 2014. Here's the GSoC project link https://github.com/checkstyle/checkstyle/wiki/Checkstyle-GSoC-2014-Project-Ideas#project-name-checkstyle-configuration-for-googles-java-style-guide
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.
Can you elaborate...
I am referring to the comment at #14501 (comment), if we are going to spend a bunch of time writing posts and waiting for replies, we can at least learn more about JSNI and see what the hubbub about line wrapping is.
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.
ohh okhay, I would love to do more research on JSNI but my mid-term exams coming and I'm also working on other issues too, it is really difficult to get some time for doing the research stuff. So it would be really helpful if you or other maintainer can find the reason about why there is need to ignore JSNI method for LineLength module. I'm really sorry for asking maintainers to do this. @nrmancuso
ok, @Zopsss , we need to move this PR from being stuck. Please spend some time to get GWT example project to work in any IDE and test yourself if there is problem with line wrap. please share images, log outputs of errors or no errors. even we found that wrapping is not problem, it is success, as we can close issue on our issue tracker. And simply state to google style to remove this point about JSNI) or we will suggest to use your config only for people who carers, but looks like nobody care as nobody created issue to do such suppression. But your config will be in our issue as workaround. |
yeah I'll do my research as soon as I get some time. |
Back to this PR, so I was trying to setup GWT project to test if JSNI method references are wrap-able or not. But I had a doubt, how are we going to recognize the JSNI method reference? Here is an example of jsni method reference:
how can we recognize it using regex? I guess it is not possible? The example was taken from official GWT documentation: https://www.gwtproject.org/doc/latest/DevGuideCodingBasicsJSNI.html from Plus IDEs now does not have support for GWT, it's really difficult to setup project locally and execute it. There are tutorials available on how to setup GWT project but they are mostly 7-8 years old, the setup process mentioned in documentation is also really old and outdated. Should we close this issue? @romani |
https://www.gwtproject.org/doc/latest/DevGuideCodingBasicsJSNI.html
https://www.gwtproject.org/doc/latest/DevGuideCodingBasicsJsInterop.html
|
Ok.
Still present at I do see clear reason that it is deprecated, so no reason to add support for it. Please create new issue and let's close this PR and related issue as won't fix |
Done. New issue: #14938 |
Issue #14487
Ignore JSNI methods' length in google config based on 4.4 Column Limit: 100