-
Notifications
You must be signed in to change notification settings - Fork 12
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
Add implementation of package linting rule and tests #45
Conversation
a2a6cb9
to
7baf84d
Compare
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("/", "."); |
There was a problem hiding this comment.
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)){ |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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
7baf84d
to
02edb47
Compare
No description provided.