Skip to content

Commit 4a1e052

Browse files
committed
Put the antlr4formatter stuff back into the README. (as promised in #328)
1 parent bd97695 commit 4a1e052

File tree

3 files changed

+73
-16
lines changed

3 files changed

+73
-16
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ lib('generic.LicenseHeaderStep') +'{{yes}} | {{yes}}
4545
lib('generic.ReplaceRegexStep') +'{{yes}} | {{yes}} | {{no}} |',
4646
lib('generic.ReplaceStep') +'{{yes}} | {{yes}} | {{no}} |',
4747
lib('generic.TrimTrailingWhitespaceStep') +'{{yes}} | {{yes}} | {{no}} |',
48+
lib('antlr4.Antlr4FormatterStep') +'{{yes}} | {{yes}} | {{no}} |',
4849
extra('cpp.EclipseFormatterStep') +'{{yes}} | {{yes}} | {{no}} |',
4950
extra('groovy.GrEclipseFormatterStep') +'{{yes}} | {{no}} | {{no}} |',
5051
lib('java.GoogleJavaFormatStep') +'{{yes}} | {{yes}} | {{no}} |',
@@ -76,6 +77,7 @@ extra('wtp.EclipseWtpFormatterStep') +'{{yes}} | {{yes}}
7677
| [`generic.ReplaceRegexStep`](lib/src/main/java/com/diffplug/spotless/generic/ReplaceRegexStep.java) | :+1: | :+1: | :white_large_square: |
7778
| [`generic.ReplaceStep`](lib/src/main/java/com/diffplug/spotless/generic/ReplaceStep.java) | :+1: | :+1: | :white_large_square: |
7879
| [`generic.TrimTrailingWhitespaceStep`](lib/src/main/java/com/diffplug/spotless/generic/TrimTrailingWhitespaceStep.java) | :+1: | :+1: | :white_large_square: |
80+
| [`antlr4.Antlr4FormatterStep`](lib/src/main/java/com/diffplug/spotless/antlr4/Antlr4FormatterStep.java) | :+1: | :+1: | :white_large_square: |
7981
| [`cpp.EclipseFormatterStep`](lib-extra/src/main/java/com/diffplug/spotless/extra/cpp/EclipseFormatterStep.java) | :+1: | :+1: | :white_large_square: |
8082
| [`groovy.GrEclipseFormatterStep`](lib-extra/src/main/java/com/diffplug/spotless/extra/groovy/GrEclipseFormatterStep.java) | :+1: | :white_large_square: | :white_large_square: |
8183
| [`java.GoogleJavaFormatStep`](lib/src/main/java/com/diffplug/spotless/java/GoogleJavaFormatStep.java) | :+1: | :+1: | :white_large_square: |

plugin-gradle/README.md

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,11 @@ BUILD SUCCESSFUL
5858
- [Java](#java) ([google-java-format](#google-java-format), [eclipse jdt](#eclipse-jdt), [prettier](#prettier))
5959
- [Groovy](#groovy) ([eclipse groovy](#eclipse-groovy))
6060
- [Kotlin](#kotlin) ([ktlint](#ktlint), [ktfmt](#ktmt), [prettier](#prettier))
61-
- [Scala](#scala) ([scalafmt](https://github.com/scalameta/scalafmt/releases))
62-
- [C/C++](#c-c++) ([eclipse cdt](https://www.eclipse.org/cdt/))
61+
- [Scala](#scala) ([scalafmt](#scalafmt))
62+
- [C/C++](#c-c++) ([eclipse cdt](#eclipse-cdt))
6363
- Markdown ([freshmark](#freshmark))
64-
- [SQL](#SQL) ([dbeaver](#dbeaver), [prettier](#prettier))
64+
- [SQL](#sql) ([dbeaver](#dbeaver), [prettier](#prettier))
65+
- [Antlr4](#antlr4) ([antlr4formatter](#antlr4formatter))
6566
- [Typescript](#typescript) ([tsfmt](#tsfmt), [prettier](#prettier))
6667
- Multiple filetypes
6768
- [Prettier](#prettier) ([plugins](#prettier-plugins), [npm detection](#npm-detection))
@@ -362,6 +363,28 @@ spotless {
362363
}
363364
```
364365
366+
## Antlr4
367+
368+
`com.diffplug.gradle.spotless.Antlr4Extension` [javadoc](https://javadoc.io/static/com.diffplug.spotless/spotless-plugin-gradle/4.4.0/com/diffplug/gradle/spotless/Antlr4Extension.html), [code](https://github.com/diffplug/spotless/blob/main/plugin-gradle/src/main/java/com/diffplug/gradle/spotless/Antlr4Extension.java)
369+
370+
```gradle
371+
spotless {
372+
antlr4 {
373+
target 'src/*/antlr4/**/*.g4' // default value, you can change if you want
374+
antlr4Formatter() // has its own section below
375+
licenseHeader '/* (C) $YEAR */' // or licenseHeaderFile
376+
}
377+
}
378+
```
379+
380+
### antlr4formatter
381+
382+
[homepage](https://github.com/antlr/Antlr4Formatter). [available versions](https://search.maven.org/artifact/com.khubla.antlr4formatter/antlr4-formatter).
383+
384+
```gradle
385+
antlr4formatter('1.2.1') // version is optional
386+
```
387+
365388
<a name="sql-dbeaver"></a>
366389
<a name="applying-dbeaver-to-sql-scripts"></a>
367390

plugin-maven/README.md

Lines changed: 45 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,9 @@ user@machine repo % mvn spotless:check
4848
- **Languages**
4949
- [Java](#java) ([android](#android), [google-java-format](#google-java-format), [eclipse jdt](#eclipse-jdt), [prettier](#prettier))
5050
- [Kotlin](#kotlin) ([ktlint](#ktlint), [ktfmt](#ktmt), [prettier](#prettier))
51-
- [Scala](#scala) ([scalafmt](https://github.com/scalameta/scalafmt/releases))
52-
- [C/C++](#c-c++) ([eclipse cdt](https://www.eclipse.org/cdt/))
51+
- [Scala](#scala) ([scalafmt](#scalafmt))
52+
- [C/C++](#c-c++) ([eclipse cdt](#eclipse-cdt))
53+
- [Antlr4](#antlr4) ([antlr4formatter](#antlr4formatter))
5354
- [Typescript](#typescript) ([tsfmt](#tsfmt), [prettier](#prettier))
5455
- Multiple filetypes
5556
- [Prettier](#prettier) (and [plugins](#prettier-plugins))
@@ -139,18 +140,18 @@ Spotless requires Maven to be running on JRE 8+.
139140
<include>src/test/java/**/*.java</include>
140141
</includes>
141142

142-
<importOrder/> <!-- standard import order -->
143+
<importOrder /> <!-- standard import order -->
143144
<importOrder> <!-- or a custom ordering -->
144145
<order>java,javax,org,com,com.diffplug,</order> <!-- or use <file>${basedir}/eclipse.importorder</file> -->
145146
<!-- You probably want an empty string at the end - all of the
146147
imports you didn't specify explicitly will go there. -->
147148
</importOrder>
148149

149-
<removeUnusedImports/> <!-- self-explanatory -->
150+
<removeUnusedImports /> <!-- self-explanatory -->
150151

151-
<googleJavaFormat/> <!-- has its own section below -->
152-
<eclipse/> <!-- has its own section below -->
153-
<prettier/> <!-- has its own section below -->
152+
<googleJavaFormat /> <!-- has its own section below -->
153+
<eclipse /> <!-- has its own section below -->
154+
<prettier /> <!-- has its own section below -->
154155

155156
<licenseHeader>
156157
<content>/* (C)$YEAR */</content> <!-- or <file>${basedir}/license-header</file> -->
@@ -203,11 +204,11 @@ Spotless requires Maven to be running on JRE 8+.
203204
imports you didn't specify explicitly will go there. -->
204205
</importOrder>
205206

206-
<removeUnusedImports/> <!-- self-explanatory -->
207+
<removeUnusedImports /> <!-- self-explanatory -->
207208

208-
<ktlint/> <!-- has its own section below -->
209-
<ktfmt/> <!-- has its own section below -->
210-
<prettier/> <!-- has its own section below -->
209+
<ktlint /> <!-- has its own section below -->
210+
<ktfmt /> <!-- has its own section below -->
211+
<prettierv/> <!-- has its own section below -->
211212

212213
<licenseHeader>
213214
<content>/* (C)$YEAR */</content> <!-- or <file>${basedir}/license-header</file> -->
@@ -257,7 +258,7 @@ Spotless requires Maven to be running on JRE 8+.
257258
<include>src/test/scala/**/*.sc</include>
258259
</includes>
259260

260-
<scalafmt/> <!-- has its own section below -->
261+
<scalafmt /> <!-- has its own section below -->
261262

262263
<licenseHeader>
263264
<content>/* (C)$YEAR */</content> <!-- or <file>${basedir}/license-header</file> -->
@@ -297,7 +298,7 @@ Spotless requires Maven to be running on JRE 8+.
297298
<include>src/native/**</inclue>
298299
</includes>
299300

300-
<eclipseCdt> <!-- has its own section below -->
301+
<eclipseCdt /> <!-- has its own section below -->
301302

302303
<licenseHeader>
303304
<content>/* (C)$YEAR */</content> <!-- or <file>${basedir}/license-header</file> -->
@@ -317,6 +318,37 @@ Spotless requires Maven to be running on JRE 8+.
317318
</eclipseCdt>
318319
```
319320

321+
## Antlr4
322+
323+
[code](https://github.com/diffplug/spotless/blob/main/plugin-maven/src/main/java/com/diffplug/spotless/maven/antlr4/Antlr4.java). [available steps](https://github.com/diffplug/spotless/tree/main/plugin-maven/src/main/java/com/diffplug/spotless/maven/antlr4).
324+
325+
```xml
326+
<configuration>
327+
<antlr4>
328+
<!-- These are the defaults, you can override if you want -->
329+
<includes>
330+
<include>src/*/antlr4/**/*.g4</include>
331+
</includes>
332+
333+
<antlr4formatter /> <!-- has its own section below -->
334+
335+
<licenseHeader>
336+
<content>/* (C)$YEAR */</content> <!-- or <file>${basedir}/license-header</file> -->
337+
</licenseHeader>
338+
</antlr4>
339+
</configuration>
340+
```
341+
342+
### antlr4formatter
343+
344+
[homepage](https://github.com/antlr/Antlr4Formatter). [available versions](https://search.maven.org/artifact/com.khubla.antlr4formatter/antlr4-formatter). [code](https://github.com/diffplug/spotless/blob/main/plugin-maven/src/main/java/com/diffplug/spotless/maven/antlr4/Antlr4Formatter.java).
345+
346+
```xml
347+
<antlr4formatter>
348+
<version>1.2.1</version> <!-- optional -->
349+
</antlr4formatter>
350+
```
351+
320352
<a name="applying-to-typescript-source"></a>
321353

322354
## Typescript

0 commit comments

Comments
 (0)