Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code style: Introduce Checkstyle and Spotbugs #374

Merged
merged 5 commits into from
Dec 6, 2019

Conversation

ahennr
Copy link
Member

@ahennr ahennr commented Oct 15, 2019

This PR introduces static code analysis tools checkstyle and SpotBugs (the successor of FindBugs) to SHOGun-core to improve /check code style and quality.

@ahennr ahennr changed the title Code style: Introduce Checkstyle and Sportbugs Code style: Introduce Checkstyle and Spotbugs Oct 15, 2019
@ahennr ahennr marked this pull request as ready for review October 18, 2019 15:03
@ahennr
Copy link
Member Author

ahennr commented Dec 4, 2019

Please review @terrestris/devs

Copy link
Member

@hwbllmnn hwbllmnn left a comment

Choose a reason for hiding this comment

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

🔝 Just a few minor remarks

if (userGroup.getMembers().contains(user)) {
Set<Permission> groupPermissions = groupPermissionsMap.get(userGroup).getPermissions();
Set<Permission> groupPermissions =userGroupEntry.getValue().getPermissions();
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Set<Permission> groupPermissions =userGroupEntry.getValue().getPermissions();
Set<Permission> groupPermissions = userGroupEntry.getValue().getPermissions();

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've added further checkstyle rule<module name="WhitespaceAround"/> to check for this as well.


for (Map.Entry<UserGroup, PermissionCollection> userGroupEntry: groupPermissionsMap.entrySet()) {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
for (Map.Entry<UserGroup, PermissionCollection> userGroupEntry: groupPermissionsMap.entrySet()) {
for (Map.Entry<UserGroup, PermissionCollection> userGroupEntry : groupPermissionsMap.entrySet()) {

}

return null;
return requestMappingHandlerMapping.getHandlerMethods().keySet();
Copy link
Member

Choose a reason for hiding this comment

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

Doesn't this now blow up in case requestMappingHandlerMapping.getHandlerMethods() is null?

Copy link
Member Author

Choose a reason for hiding this comment

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

No, it doesn't since getHandlerMethods never returns null in any case.

@@ -66,7 +65,7 @@ public E cloneAndPersistTreeNode(E node) throws Exception {
// recursive call for all children
clonedChildren.add(cloneAndPersistTreeNode(childNode));
}
((TreeFolder) node).setChildren((List<TreeNode>) children);
((TreeFolder) node).setChildren((List<TreeNode>) clonedChildren);
Copy link
Member

Choose a reason for hiding this comment

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

I think @annarieger and I may recently have ran into exactly the problem you fixed here, 🔝

Copy link
Member

Choose a reason for hiding this comment

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

🙏 I hope it'll fix the bug while cloning of applications

<!-- Checks for Size Violations. -->
<!-- See http://checkstyle.sf.net/config_sizes.html -->
<module name="FileLength">
<property name="max" value="2500"/>
Copy link
Member

Choose a reason for hiding this comment

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

I'd like to get this below 1000 at some point :-)

Copy link
Member Author

Choose a reason for hiding this comment

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

👍 , currently "only" the HttpUtil exceeds file length limitation of 1,000.

@ahennr
Copy link
Member Author

ahennr commented Dec 6, 2019

TXH for reviews @annarieger and @hwbllmnn

@ahennr ahennr merged commit 5fe7327 into terrestris:master Dec 6, 2019
@ahennr ahennr deleted the code-style branch December 6, 2019 12:18
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.

3 participants