Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add checkstyle#3229

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
MysterAitch wants to merge16 commits intojavaparser:master
base:master
Choose a base branch
Loading
fromMysterAitch:add_checkstyle

Conversation

MysterAitch
Copy link
Member

This PR adds checkstyle to the build, to help minimise the amount of churn of e.g. import statements. The config is adapted from the default Sun style, with changes made to match our current codebase.

  • Where I have been able to get a "quick win" to adopt a consistent style then that is included within this PR (e.g. adding comments topublic static final fields and making themUPPER_CASE, tweaking whitespace around operators, tweaking imports).

  • Where it's not feasible to apply the rule yet or the rule is in default sun style but might not be relevant / applicable to our project, I have added it to the suppressions (exceptions) file. Preferably these suppressions are limited to the relevant files, but there are some rules added as a global supression.

It's a TODO for future PRs to investigate whether the remaining "suppressed" checks are applicable or if they definitely don't apply / we don't care.

For example, there are lots of warnings about magic numbers where we use31 in thehashCode() methods - maybe one day we will convert them all to useObjects.hashCode(...) but perhaps not right now and certainly not within this PR. Ditto for ensuring there is javadoc for all public methods/classes - this is something we probably should be doing, but there are too many places we don't have this that it's a substantial piece of work (assuming we want to do it - again a separate discussion / PR 👍 ).

@MysterAitch
Copy link
MemberAuthor

I suspect theavoidStarImports rule might be a potentially controversial one.

Personally I have a mild preference to avoid start imports simply because

  • it is objective (otherwise, where is the cut-off where we want star imports?) and
  • diffs will show when/where uses of classes are added/removed (e.g. when introducing new AST nodes)

...but this is a weakly held view -- any advocates for star imports are welcome to comment and we can roll that bit back! 👍 😄

@koppor
Copy link
Contributor

koppor commentedSep 2, 2021
edited
Loading

Nitpick 😇: There should be an ADR (refs#2714) on using custom checkstyle rules versusGoogle Java Style Guide. Besides thetwo spaces rule, I personally like it, because there is good tooling:Google Java Format: Formats the code, ...

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@MysterAitch@koppor

[8]ページ先頭

©2009-2025 Movatter.jp