Skip to content
This repository has been archived by the owner on Dec 15, 2020. It is now read-only.

TAMAYA-379: enforce checkstyle validation #20

Merged
merged 3 commits into from
Jan 28, 2019

Conversation

acoburn
Copy link
Member

@acoburn acoburn commented Jan 25, 2019

Updates code to follow checkstyle rules.

For the most part, the changes are trivial and don't affect any visible API:

  • replaces star imports with explicit imports
  • removes unused imports
  • replaces tabs with spaces
  • adds missing JavaDocs

There were also a few instances where fields or methods didn't follow case rules. Some of these were private fields (e.g. resolver => RESOLVER), but some were protected (e.g. in the jodatime module, formatter => FORMATTER) and in one case it was a public method (i.e. in metamodel, o.a.t.m.internal.resolver.JavaResolver::TIME becomes JavaResolver::time)

Updates code to follow checkstyle rules.

Note: in the metamodule subproject, the
o.a.t.metamodel.internal.resolver.JavaResolver::TIME method is changed to JavaResolver::time
@ottlinger
Copy link
Contributor

@acoburn not sure about the checkstyle rules concerning the casing - following the "official" Javadoc guide I'd also uppercase the private final constants .... not sure, but if the rule is there, we could easily comply with it.

https://www.oracle.com/technetwork/java/codeconventions-135099.html

Constants
The names of variables declared class constants and of ANSI constants should be all uppercase with words separated by underscores ("_"). (ANSI constants should be avoided, for ease of debugging.)
static final int MIN_WIDTH = 4;
static final int MAX_WIDTH = 999;
static final int GET_THE_CPU = 1;

@acoburn
Copy link
Member Author

acoburn commented Jan 27, 2019

The current checkstyle configuration defines an allowable format for class-level constants. Our format varies from the default checkstyle format somewhat, permitting a wider range of valid names for class constants.

Would you like to see the checkstyle configuration be changed to be more strict? (i.e. UPPER_CASE?) That change would bring our configuration more in line with the default checkstyle format.

@ottlinger
Copy link
Contributor

ottlinger commented Jan 27, 2019 via email

@acoburn
Copy link
Member Author

acoburn commented Jan 28, 2019

I updated the checkstyle configuration to make use of the default rules for constant (and method) names. This change didn't require any additional code modifications, which means that the code is already (as of this PR) following the standard formatting rules.

Copy link
Contributor

@ottlinger ottlinger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work - thanks.

@ottlinger ottlinger merged commit 3da1c21 into apache:master Jan 28, 2019
@acoburn acoburn deleted the TAMAYA-379 branch January 28, 2019 20:05
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants