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

Add implementation of package linting rule and tests #45

Merged

Conversation

carlosliarte
Copy link

No description provided.

@carlosliarte carlosliarte force-pushed the feature/package_lint_rule branch from a2a6cb9 to 7baf84d Compare April 4, 2019 09:44
@wscheep
Copy link
Contributor

wscheep commented Apr 4, 2019

Solves #29

Descriptors.FileDescriptor fileDescriptor = proto.getFileDescriptorByFileName(ref.getFile().getName());
String protoPackageName = fileDescriptor.getPackage();
String fileName = ref.getFile().getFullName();
fileName = fileName.substring(0, fileName.lastIndexOf("/")).replace("/", ".");
Copy link
Member

Choose a reason for hiding this comment

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

The result of the substring is a directory name. Use a new variable dirName to indicate what it is.

String protoPackageName = fileDescriptor.getPackage();
String fileName = ref.getFile().getFullName();
fileName = fileName.substring(0, fileName.lastIndexOf("/")).replace("/", ".");
if(!fileName.equals(protoPackageName)){
Copy link
Member

Choose a reason for hiding this comment

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

Use your IntelliJ code formatter to make sure your code is correctly formatted. Add space before opening bracket.

@@ -27,4 +27,7 @@ enum LintRule {
LINT_METHOD_RTYPE_END_WITH_RESPONSE = 50003;

LINT_GENERAL_CUSTOM = 60000;

LINT_PACKAGE_CUSTOM = 70000;
LINT_PACKAGE_NAME_SHOULD_BE_VALID = 70001;
Copy link
Member

Choose a reason for hiding this comment

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

change to LINT_PACKAGE_NO_DIR_ALIGNMENT

@carlosliarte carlosliarte force-pushed the feature/package_lint_rule branch from 7baf84d to 02edb47 Compare April 5, 2019 07:27
@alexvanboxel alexvanboxel merged commit 40f468b into anemos-io:master Apr 5, 2019
@carlosliarte carlosliarte deleted the feature/package_lint_rule branch April 5, 2019 11:42
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