Local variable names shouldn't start with capital
@leventov, I would like to work on this. Let me know how to begin with as I'm new to making contributions. Please share any document for beginner contributors to Druid. Thanks in advance.
Hi @sashidhar, welcome to the community!
You can add LocalVariableName and LocalFinalVariableName patterns to this file: https://github.com/apache/incubator-druid/blob/master/codestyle/checkstyle.xml. Then trying to mvn install -DskipTests from the root of the project, Checkstyle will show you all violations.
@sashidhar , have you started working on this yet?
Yes, I've started working on this. I'll update once I've made code changes.
On Fri, May 17, 2019 at 11:45 AM lml2468 [email protected] wrote:
@sashidhar https://github.com/sashidhar , have you started working on this yet?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/apache/incubator-druid/issues/7609?email_source=notifications&email_token=AACGIELEUVUH57TDB74HG23PVZEQHA5CNFSM4HLJBCT2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODVT25RQ#issuecomment-493334214, or mute the thread https://github.com/notifications/unsubscribe-auth/AACGIENOJCS26HFPJCSGB2LPVZEQHANCNFSM4HLJBCTQ .
@leventov
-
This is the match pattern I'm currently using for Local Variable names
'^[a-z_](_?[a-zA-Z0-9_]+)*$'considering variables starting with and ending with underscores as well. Let me know if this is fine. -
There are several occurrences of variables which are not constants (non final) and have variables all capitalized for instance, Pattern DOT_OR_WHITESPACE = Pattern.compile("[\s]+|[.]+"); etc. I'm changing these to lower case. Is that fine ?
@leventov,
- For local final variables example here http://checkstyle.sourceforge.net/config_naming.html#LocalFinalVariableName suggests names that are only upper case letters and digits
"^[A-Z][A-Z0-9]*$".
As per this pattern, following variable should be changed from final ObjectMapper mapper = new ObjectMapper(); to final ObjectMapper MAPPER = new ObjectMapper();
I'm not sure if this makes sense changing non static variable names to all caps !!
There are several occurrences of variables which are not constants (i.e non static fields) which have variables all capitalized for instance, Pattern DOT_OR_WHITESPACE = Pattern.compile("[\s]+|[.]+"); etc. I'm changing these to lower case. Is that fine ?
For some of these, it might be an indication that the variable was intended to be a static constant, but the original developer just forgot to include the static keyword. So I would approach these with an open mind to fixing bugs like that too, not necessarily just fixing the names to match the current state.
For local final variables example here http://checkstyle.sourceforge.net/config_naming.html#LocalFinalVariableName suggests names that are only upper case letters and digits "^[A-Z][A-Z0-9]*$".
IMO, this is silly, I don't see a reason to require this pattern. In fact, I'd be more inclined to require the opposite (local final variables should start with lowercase letters).
How do I create a pull request ? I've made changes in a local branch and unable to commit the local branch to remote. I was thinking to push local branch to remote and then raise a pull request.
@sashidhar it looks like there is a collision and @lml2468 has already solved this problem. In general, please consult to Github Help and web search to resolve such questions: https://help.github.com/en/articles/creating-a-pull-request