Skip to content

Conversation

@baywet
Copy link
Member

@baywet baywet commented Feb 12, 2021

  • adds checkstyle configuration
  • aligns indent size in editor config with checkstyle
  • adds recommended extensions
  • fixes the style of chaos handler as demonstration

fixes #148

Context: This repo is lacking of linting + static analysis to improve code quality and maintainability.
At this point I haven't enabled build fail on lint fail because we still have another 6500+ linting issues in main.

I just wanted to get feedback on this tool which only does styling checks of things like indent, naming conventions, import ordering etc...
It does not run a deep static analysis and try to "understand what the code does" like other tools might. But it's really fast to run.
I think we could use a combination of tools, as long as they don't conflict with one another.
Before I go and furiously fix defects, I wanted to check with the team:

  • Are we happy with the indent style?
  • Are we happy with other modifications? (. at the end of javadoc comments, line length, naming conventions, import conventions...)
  • Are we happy with the suppression style?
  • Are we missing anything that should have been called out?

@baywet baywet added this to the 2.0.0-release milestone Feb 12, 2021
@baywet baywet self-assigned this Feb 12, 2021
@baywet
Copy link
Member Author

baywet commented Feb 12, 2021

@hosmanagic-axcient I thought you might provide interesting feedback for this one considering your previous comments on pull requests.

@baywet baywet mentioned this pull request Feb 12, 2021
@hosmanagic-axcient
Copy link
Contributor

@hosmanagic-axcient I thought you might provide interesting feedback for this one considering your previous comments on pull requests.

From the top of my head, I think you need a rule which forbids interface names starting with a capital I.:D Just kidding. I appreciate you tagging me, I'll try to review at earliest!

@baywet
Copy link
Member Author

baywet commented Feb 12, 2021

@hosmanagic-axcient Because there's already a rule against consecutive capital letters in interface/classes names, they all already trigger. We might suppress that rule though.

<message key="ws.notPreceded"
value="WhitespaceAround: ''{0}'' is not preceded with whitespace."/>
</module>
<module name="OneStatementPerLine"/>
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm wondering if some useful ternary operator could be forbidden by this, something in the style of return obj != null ? obj.toString() : "no description". Then again, it might not even come often.

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't believe ternary expressions count as more than one statement. Looking at the documentation for the rule it looks like this rule is mostly looking for semicolon separation. But thanks for the heads up.

COMPACT_CTOR_DEF"/>
<property name="allowNoEmptyLineBetweenFields" value="true"/>
</module>
<module name="SeparatorWrap">
Copy link
Contributor

Choose a reason for hiding this comment

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

Of course, it's a matter of preference, but IIUC, this means that following is not correct

graph.users(userId)
    .mailFolders(mfId)
    .delta();

Personally, I find that style a bit better, because it makes it clear that's a method call continuing from the previous line, and we're not calling a method from the same class.

Copy link
Member Author

@baywet baywet Feb 16, 2021

Choose a reason for hiding this comment

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

@hosmanagic-axcient meaning the dots would have to be at the previous line?

Copy link
Contributor

Choose a reason for hiding this comment

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

@baywet Yes, that's my understanding based on this here: https://checkstyle.org/config_whitespace.html#SeparatorWrap

@hosmanagic-axcient
Copy link
Contributor

@baywet from what I can could check (I tried checking them one by one and looking up the definition), the rules look good to me. I added 2 minor comments. I believe we'll know more and better once we run the rules. That will likely be a process of polishing them over time.: )

@baywet
Copy link
Member Author

baywet commented Feb 16, 2021

@hosmanagic-axcient thank for giving it a look. Are you aware of any command line tool that would go ahead and fix all the trivial issues (indent, curly braces...)? So far my research has only brought back IDE plugins in intelliJ and such.
Or this

@github-actions

This comment has been minimized.

@baywet baywet force-pushed the feature/checkstyles branch from b97afbf to f03056a Compare February 19, 2021 13:20
@hosmanagic-axcient
Copy link
Contributor

@hosmanagic-axcient thank for giving it a look. Are you aware of any command line tool that would go ahead and fix all the trivial issues (indent, curly braces...)? So far my research has only brought back IDE plugins in intelliJ and such.
Or this

Sorry for the late reply!

Unfortunately, I don't know of an alternative. I've used my IDE (IntelliJ) to format code (at all levels: from code blocks to complete packages).

@baywet baywet modified the milestones: 2.0.0-release, 2.1.0 Mar 15, 2021
Base automatically changed from feature/v2 to dev March 15, 2021 15:48
@github-actions
Copy link
Contributor

This pull request has conflicting changes, the author must resolve the conflicts before this pull request can be merged.

@baywet baywet closed this Jun 1, 2021
@ramsessanchez ramsessanchez deleted the feature/checkstyles branch May 26, 2022 18:04
@maisarissi maisarissi removed this from the 2.1.0 milestone Sep 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

this repo lacks a linting tool

4 participants