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
new CatchParameterName Check: to validate names of catch-block parameters only #2616
Comments
@romani |
We also have parameters in Lambdas.
it might be not that perfect in code , but for user it will be more clear. Both ways have their pros and cons. |
I find it odd the JLS calls the catch-clause variable a parameter. I never really thought of it as one. If anything I would have said it was a local variable, just like method parameters. I am for 2, the new CatchParameterName. My reason is, after trying I still can't think of the catch-clause variable as a parameter and would find another check spelling out that they are 2 separate items to be easier to understand. |
I'm for the second option, because:
|
I'm also for the option 2. I'll try to raise PR today - it would be easier to discuss on real code. |
@romani |
merged. |
@mkordas , in future we should not forget to update https://github.com/checkstyle/contribution/blob/master/checkstyle-tester/checks-nonjavadoc-error.xml#L372 for each new Check to keep our regression testing and be safe |
@romani, you are right, thanks for making the update. I think that this config should be part of main repo (test code) or at least we should have integration tests between two repositories. What do you think? |
This is file of regression testing tool, it should not be in main repo, one day we will just use config from main repo (we are not ready now) |
Yeah, so I think that's it's good idea to keep also regression testing tool in main repo, so that it is easy to use for everyone (e.g. by invoking maven with some special profile). |
May be, but unlikely. Whole contributions repo was inside main repo, i spend a lot of time simplify main repo for new contributors. But we will see ... |
Base on discussion at: #2549 , #2604, #2592
Root of the problem is #2549, where do need to remove support of parameters validation in LocalVariableName Check. Yes that is braking compatibility but Check will become logical.
Unfortunately the Check ParameterName does not validate catch parameters at all, it was hardcoded in is logic till #2290 (not released yet, so we could do revert).
Two ways to resolve the conflicts:
0) support of parameters should be removed from LocalVariableName.
two parameters "skipCatchParameter"(already done in ParameterName: new option to skip methods with Override annotation #2290, but not released) and "skipParameter" that will do skip for all other parameters. This will allow user to create two configurations in config and by these options adjust logic to validate parameters by separate format.
New Check - CatchParameterName. With hardcoded logic to skip non catch parameters.
I think that juggling by parameters are not human friendly and error prone, especially in such case I can not make name better then "skipParameter" but it is inversion of whole name of check. Yes, we have a lot of cases where all is done by options. Creation of new Check for each case is not good also. So lets vote on what is better.
@MEZk , @mkordas , @rnveach , @Vladlis - please share your opinions.
The text was updated successfully, but these errors were encountered: