Skip to content

Commit

Permalink
Document syntax for ordering static imports (#1071)
Browse files Browse the repository at this point in the history
  • Loading branch information
nedtwigg authored Jan 6, 2022
2 parents c0d569f + c47e09f commit e5f16f6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
8 changes: 4 additions & 4 deletions plugin-gradle/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,8 @@ spotless {
// Use the default importOrder configuration
importOrder()
// optional: you can specify import groups directly
// note: You probably want an empty string at the end - all of the imports you didn't specify explicitly will go there.
importOrder('java', 'javax', 'com.acme', '')
// note: you can use an empty string for all the imports you didn't specify explicitly, and '\\#` prefix for static imports
importOrder('java', 'javax', 'com.acme', '', '\\#com.acme', '\\#')
// optional: instead of specifying import groups directly you can specify a config file
// export config file: https://github.com/diffplug/spotless/blob/main/ECLIPSE_SCREENSHOTS.md#creating-spotlessimportorder
importOrderFile('eclipse-import-order.txt') // import order file as exported from eclipse
Expand Down Expand Up @@ -234,8 +234,8 @@ spotless {
// Use the default importOrder configuration
importOrder()
// optional: you can specify import groups directly
// note: You probably want an empty string at the end - all of the imports you didn't specify explicitly will go there.
importOrder('java', 'javax', 'com.acme', '')
// note: you can use an empty string for all the imports you didn't specify explicitly, and '\\#` prefix for static imports
importOrder('java', 'javax', 'com.acme', '', '\\#com.acme', '\\#')
// optional: instead of specifying import groups directly you can specify a config file
// export config file: https://github.com/diffplug/spotless/blob/main/ECLIPSE_SCREENSHOTS.md#creating-spotlessimportorder
importOrderFile('eclipse-import-order.txt') // import order file as exported from eclipse
Expand Down
11 changes: 4 additions & 7 deletions plugin-maven/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,9 +181,8 @@ any other maven phase (i.e. compile) then it can be configured as below;
<importOrder /> <!-- standard import order -->
<importOrder> <!-- or a custom ordering -->
<wildcardsLast>false</wildcardsLast> <!-- Optional, default false. Sort wildcard import after specific imports -->
<order>java,javax,org,com,com.diffplug,</order> <!-- or use <file>${project.basedir}/eclipse.importorder</file> -->
<!-- You probably want an empty string at the end - all of the
imports you didn't specify explicitly will go there. -->
<order>java,javax,org,com,com.diffplug,,\\#com.diffplug,\\#</order> <!-- or use <file>${project.basedir}/eclipse.importorder</file> -->
<!-- you can use an empty string for all the imports you didn't specify explicitly, and '\\#` prefix for static imports. -->
</importOrder>

<removeUnusedImports /> <!-- self-explanatory -->
Expand Down Expand Up @@ -250,10 +249,8 @@ This is a workaround to a [pending issue](https://github.com/diffplug/spotless/i

<importOrder /> <!-- standard import order -->
<importOrder> <!-- or a custom ordering -->
<order>java,javax,org,com,com.diffplug,</order> <!-- or use <file>
/eclipse.importorder</file> -->
<!-- You probably want an empty string at the end - all of the
imports you didn't specify explicitly will go there. -->
<order>java,javax,org,com,com.diffplug,,\\#com.diffplug,\\#</order> <!-- or use <file>${project.basedir}/eclipse.importorder</file> -->
<!-- you can use an empty string for all the imports you didn't specify explicitly, and '\\#` prefix for static imports -->
</importOrder>

<greclipse /> <!-- has its own section below -->
Expand Down

0 comments on commit e5f16f6

Please sign in to comment.