You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@seatunnel.apache.org by GitBox <gi...@apache.org> on 2022/01/23 14:21:00 UTC
[GitHub] [incubator-seatunnel] asdf2014 opened a new pull request #1145: [SeaTunnel#1144] Add a rule into Code Style for the order of improts
asdf2014 opened a new pull request #1145:
URL: https://github.com/apache/incubator-seatunnel/pull/1145
<!--
Thank you for contributing to SeaTunnel! Please make sure that your code changes
are covered with tests. And in case of new features or big changes
remember to adjust the documentation.
Feel free to ping committers for the review!
## Contribution Checklist
- Make sure that the pull request corresponds to a [GITHUB issue](https://github.com/apache/incubator-seatunnel/issues).
- Name the pull request in the form "[SeaTunnel #XXXX] [component] Title of the pull request", where *SeaTunnel #XXXX* should be replaced by the actual issue number.
- Minor fixes should be named following this pattern: `[hotfix] [docs] Fix typo in README.md doc`.
-->
## Purpose of this pull request
<!-- Describe the purpose of this pull request. For example: This pull request adds checkstyle plugin.-->
Fixes #1144
## Check list
* [x] Code changed are covered with tests, or it does not need tests for reason:
* [x] If any new Jar binary package adding in you PR, please add License Notice according
[New License Guide](https://github.com/apache/incubator-seatunnel/blob/dev/docs/en/developement/NewLicenseGuide.md)
* [x] If necessary, please update the documentation to describe the new feature. https://github.com/apache/incubator-seatunnel/tree/dev/docs
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-seatunnel] asdf2014 commented on a change in pull request #1145: [SeaTunnel#1144] Add a rule into Code Style for the order of improts
Posted by GitBox <gi...@apache.org>.
asdf2014 commented on a change in pull request #1145:
URL: https://github.com/apache/incubator-seatunnel/pull/1145#discussion_r790631970
##########
File path: tools/checkstyle/checkStyle.xml
##########
@@ -81,6 +81,14 @@
</module>
<module name="TreeWalker">
+ <module name="CustomImportOrder">
+ <property name="customImportOrderRules"
+ value="THIRD_PARTY_PACKAGE###STANDARD_JAVA_PACKAGE###SPECIAL_IMPORTS###STATIC"/>
+ <property name="standardPackageRegExp" value="^java\."/>
+ <property name="specialImportsRegExp" value="^javax\."/>
+ <property name="sortImportsInGroupAlphabetically" value="true"/>
+ <property name="separateLineBetweenGroups" value="false"/>
+ </module>
Review comment:
Hi @leo65535, thanks for your comment, let me try this out
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-seatunnel] leo65535 commented on a change in pull request #1145: [SeaTunnel#1144] Add a rule into Code Style for the order of improts
Posted by GitBox <gi...@apache.org>.
leo65535 commented on a change in pull request #1145:
URL: https://github.com/apache/incubator-seatunnel/pull/1145#discussion_r790589012
##########
File path: tools/checkstyle/checkStyle.xml
##########
@@ -81,6 +81,14 @@
</module>
<module name="TreeWalker">
+ <module name="CustomImportOrder">
+ <property name="customImportOrderRules"
+ value="THIRD_PARTY_PACKAGE###STANDARD_JAVA_PACKAGE###SPECIAL_IMPORTS###STATIC"/>
+ <property name="standardPackageRegExp" value="^java\."/>
+ <property name="specialImportsRegExp" value="^javax\."/>
+ <property name="sortImportsInGroupAlphabetically" value="true"/>
+ <property name="separateLineBetweenGroups" value="false"/>
+ </module>
Review comment:
hi, can you try use the following rule?
```
<module name="ImportOrder">
<!-- Checks for out of order import statements. -->
<property name="severity" value="error"/>
<property name="groups"
value="org.apache.seatunnel,org.apache.seatunnel.shade,*,javax,java,scala"/>
<property name="separated" value="true"/>
<property name="sortStaticImportsAlphabetically" value="true"/>
<property name="option" value="bottom"/>
<property name="tokens" value="STATIC_IMPORT, IMPORT"/>
<message key="import.ordering"
value="Import {0} appears after other imports that it should precede"/>
</module>
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-seatunnel] leo65535 commented on a change in pull request #1145: [SeaTunnel#1144] Add a rule into Code Style for the order of improts
Posted by GitBox <gi...@apache.org>.
leo65535 commented on a change in pull request #1145:
URL: https://github.com/apache/incubator-seatunnel/pull/1145#discussion_r790589012
##########
File path: tools/checkstyle/checkStyle.xml
##########
@@ -81,6 +81,14 @@
</module>
<module name="TreeWalker">
+ <module name="CustomImportOrder">
+ <property name="customImportOrderRules"
+ value="THIRD_PARTY_PACKAGE###STANDARD_JAVA_PACKAGE###SPECIAL_IMPORTS###STATIC"/>
+ <property name="standardPackageRegExp" value="^java\."/>
+ <property name="specialImportsRegExp" value="^javax\."/>
+ <property name="sortImportsInGroupAlphabetically" value="true"/>
+ <property name="separateLineBetweenGroups" value="false"/>
+ </module>
Review comment:
hi, can you try use the following rule?
```
<module name="ImportOrder">
<!-- Checks for out of order import statements. -->
<property name="severity" value="error"/>
<property name="groups"
value="org.apache.seatunnel,org.apache.flink.seatunnel,*,javax,java,scala"/>
<property name="separated" value="true"/>
<property name="sortStaticImportsAlphabetically" value="true"/>
<property name="option" value="bottom"/>
<property name="tokens" value="STATIC_IMPORT, IMPORT"/>
<message key="import.ordering"
value="Import {0} appears after other imports that it should precede"/>
</module>
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-seatunnel] asdf2014 commented on pull request #1145: [SeaTunnel#1144] Add a rule into Code Style for the order of improts
Posted by GitBox <gi...@apache.org>.
asdf2014 commented on pull request #1145:
URL: https://github.com/apache/incubator-seatunnel/pull/1145#issuecomment-1020032566
Hi @CalvinKirs, thank you for your comment. I agree with you. It has been addressed. PTAL.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-seatunnel] CalvinKirs merged pull request #1145: [SeaTunnel#1144] Add a rule into Code Style for the order of improts
Posted by GitBox <gi...@apache.org>.
CalvinKirs merged pull request #1145:
URL: https://github.com/apache/incubator-seatunnel/pull/1145
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-seatunnel] asdf2014 commented on a change in pull request #1145: [SeaTunnel#1144] Add a rule into Code Style for the order of improts
Posted by GitBox <gi...@apache.org>.
asdf2014 commented on a change in pull request #1145:
URL: https://github.com/apache/incubator-seatunnel/pull/1145#discussion_r790680623
##########
File path: tools/checkstyle/checkStyle.xml
##########
@@ -81,6 +81,14 @@
</module>
<module name="TreeWalker">
+ <module name="CustomImportOrder">
+ <property name="customImportOrderRules"
+ value="THIRD_PARTY_PACKAGE###STANDARD_JAVA_PACKAGE###SPECIAL_IMPORTS###STATIC"/>
+ <property name="standardPackageRegExp" value="^java\."/>
+ <property name="specialImportsRegExp" value="^javax\."/>
+ <property name="sortImportsInGroupAlphabetically" value="true"/>
+ <property name="separateLineBetweenGroups" value="false"/>
+ </module>
Review comment:
@leo65535 This is great, also I make two improvements for it, as follows:
1. Use `/^java\./` instand of `java` to ensure the accuracy;
2. Add `staticGroups` as well, otherwise this check plugin will never be satisfying.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org