Skip to content

Fundamentals : Checkstylework#694

Closed
dhaval24 wants to merge 12 commits into
masterfrom
checkstylework
Closed

Fundamentals : Checkstylework#694
dhaval24 wants to merge 12 commits into
masterfrom
checkstylework

Conversation

@dhaval24

Copy link
Copy Markdown
Contributor

This PR is to enforce checkstyle rules on the entire project. The style guide is under /config/checkstyle/checkstyle.xml

I have currently used Google Java Style for this and integration in the build is done using the Gradle Checkstyle plugin.

This PR is an initial commit, and we can adopt to and relax some of the style rules here.

@littleaj @grlima please take a look and feel free to add commits on top to update the style as per our usecase here.

@dhaval24 dhaval24 self-assigned this Jun 28, 2018
@dhaval24 dhaval24 requested review from grlima and littleaj June 28, 2018 18:12
@dhaval24

dhaval24 commented Jul 3, 2018

Copy link
Copy Markdown
Contributor Author

@grlima @littleaj did any one of you had a chance to take a look at this. I would suggest we close on this soon :)

@littleaj

littleaj commented Jul 3, 2018

Copy link
Copy Markdown
Contributor

@dhaval24, I mostly want to review the config for checkstyle and where it was added to the build script. Is the config included in this PR?

@dhaval24

dhaval24 commented Jul 3, 2018

Copy link
Copy Markdown
Contributor Author

@littleaj yep /config/checkstyle/checkstyle.xml is the file for the checkstyle config. And it is added to the build script in common-java.gradle file.

Comment thread core/native.gradle
import org.gradle.nativeplatform.SharedLibraryBinarySpec
import org.gradle.nativeplatform.StaticLibraryBinarySpec
import org.gradle.nativeplatform.platform.NativePlatform
import org.gradle.nativeplatform.toolchain.VisualCpp

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

These are used below. Removing this breaks the script.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

ah okay didn't carefully looked at it after checkstyle ran

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed

<message key="ws.notPreceded"
value="GenericWhitespace ''{0}'' is not preceded with whitespace."/>
</module>
<module name="Indentation">

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

IMO, I think all these values should be doubled.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ok, let's take Gustavo's suggestion too and whatever is fit we can adopt to that.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

sounds good

/**
* Created by gupele on 7/27/2015.
*/
/** Created by gupele on 7/27/2015. */

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I don't like this style. Javadoc should always be 3 lines like before.

<property name="allowByTailComment" value="true"/>
<property name="allowNonPrintableEscapes" value="true"/>
</module>
<module name="LineLength">

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'd prefer to remove this module. A lot of the changes done are because of this rule and most of them make the code look worse, IMO.

@dhaval24

dhaval24 commented Jul 3, 2018

Copy link
Copy Markdown
Contributor Author

@littleaj thanks let's use one triage meeting to finalize the rules and then it would be easy to apply! This was just to see how it works with build

<message key="name.invalidPattern"
value="Method name ''{0}'' must match pattern ''{1}''."/>
</module>
<module name="SingleLineJavadoc">

@littleaj littleaj Jul 3, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

(Mentioned in another file where this was applied) I'd like to remove this module.

@littleaj

littleaj commented Jul 3, 2018

Copy link
Copy Markdown
Contributor

@dhaval24 Sounds good.

@dhaval24

dhaval24 commented Dec 2, 2018

Copy link
Copy Markdown
Contributor Author

@littleaj Abandoning the PR. I will create a new one with only checkstyle.xml for us to review the rules.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants