Skip to content

Commit 807bf7b

Browse files
committed
integrating PR feedback
1 parent ade884a commit 807bf7b

File tree

5 files changed

+20
-14
lines changed

5 files changed

+20
-14
lines changed

lib/src/main/java/com/diffplug/spotless/JarState.java

+9-3
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,13 @@
2020
import java.io.Serializable;
2121
import java.net.URI;
2222
import java.net.URL;
23-
import java.util.*;
23+
import java.util.Arrays;
24+
import java.util.Collection;
25+
import java.util.Collections;
26+
import java.util.NoSuchElementException;
27+
import java.util.Objects;
28+
import java.util.Set;
29+
import java.util.TreeSet;
2430
import java.util.stream.Collectors;
2531

2632
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
@@ -29,7 +35,7 @@
2935
* Grabs a jar and its dependencies from maven,
3036
* and makes it easy to access the collection in
3137
* a classloader.
32-
* <p>
38+
*
3339
* Serializes the full state of the jar, so it can
3440
* catch changes in a SNAPSHOT version.
3541
*/
@@ -79,7 +85,7 @@ URL[] jarUrls() {
7985

8086
/**
8187
* Returns a classloader containing only the jars in this JarState.
82-
* <p>
88+
*
8389
* The lifetime of the underlying cacheloader is controlled by {@link SpotlessCache}.
8490
*/
8591
public ClassLoader getClassLoader() {

lib/src/main/java/com/diffplug/spotless/npm/PlatformInfo.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ static OS normalizedOS() {
2929
if (osNameProperty == null) {
3030
throw new RuntimeException("No info about OS available, cannot decide which implementation of j2v8 to use");
3131
}
32-
final String normalizedOsName = osNameProperty.toLowerCase(Locale.ENGLISH);
32+
final String normalizedOsName = osNameProperty.toLowerCase(Locale.ROOT);
3333
if (normalizedOsName.contains("win")) {
3434
return OS.WINDOWS;
3535
}
@@ -51,7 +51,7 @@ static String normalizedArchName() {
5151
if (osArchProperty == null) {
5252
throw new RuntimeException("No info about ARCH available, cannot decide which implementation of j2v8 to use");
5353
}
54-
final String normalizedOsArch = osArchProperty.toLowerCase(Locale.ENGLISH);
54+
final String normalizedOsArch = osArchProperty.toLowerCase(Locale.ROOT);
5555

5656
if (normalizedOsArch.contains("64")) {
5757
return "x86_64";

lib/src/main/java/com/diffplug/spotless/npm/Reflective.java

-4
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,6 @@ private Method method(Object target, Class<?> clazz, String methodName, Object[]
9797
if (clazz.getSuperclass() != null) {
9898
return method(target, clazz.getSuperclass(), methodName, parameters);
9999
} else {
100-
// try with primitives
101-
102100
throw new ReflectiveException("Could not find method " + methodName + " with parameters " + Arrays.toString(parameters) + " on object " + target, e);
103101
}
104102
}
@@ -112,8 +110,6 @@ private Method method(Object target, Class<?> clazz, String methodName, TypedVal
112110
if (clazz.getSuperclass() != null) {
113111
return method(target, clazz.getSuperclass(), methodName, parameters);
114112
} else {
115-
// try with primitives
116-
117113
throw new ReflectiveException("Could not find method " + methodName + " with parameters " + Arrays.toString(parameters) + " on object " + target, e);
118114
}
119115
}

lib/src/main/java/com/diffplug/spotless/npm/TypedTsFmtConfigFile.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ File configFile() {
5858
}
5959

6060
String configFileEnabledOptionName() {
61-
return this.configFileType.name().toLowerCase(Locale.ENGLISH);
61+
return this.configFileType.name().toLowerCase(Locale.ROOT);
6262
}
6363

6464
String configFileOptionName() {

plugin-gradle/README.md

+8-4
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,8 @@ spotless {
348348
}
349349
```
350350

351+
Spotless uses npm to install necessary packages locally. It runs tsfmt using [J2V8](https://github.com/eclipsesource/J2V8) internally after that.
352+
351353
<a name="prettier"></a>
352354

353355
## Applying [Prettier](https://prettier.io) to javascript | flow | typeScript | css | scss | less | jsx | graphQL | yaml | etc.
@@ -379,10 +381,9 @@ spotless {
379381
format 'styling', {
380382
target '**/*.css', '**/*.scss'
381383
382-
// or provide both (config options will win over configFile options)
383384
prettier().configFile('/path-to/.prettierrc.yml')
384385
385-
// or provide both (config options will win over configFile options)
386+
// or provide both (config options take precedence over configFile options)
386387
prettier().config(['parser': 'postcss']).configFile('path-to/.prettierrc.yml')
387388
}
388389
}
@@ -411,15 +412,15 @@ Prettier can also be applied from within the [typescript config block](#typescri
411412
spotless {
412413
typescript {
413414
// no parser or filepath needed
414-
// -> will default to 'typesript' parser when used in the typescript block
415+
// -> will default to 'typescript' parser when used in the typescript block
415416
prettier()
416417
}
417418
}
418419
```
419420

420421
### Prerequisite: prettier requires a working NodeJS version
421422

422-
prettier, like tsfmt, is based on NodeJS, so to use it, a working NodeJS installation (especially npm) is required on the host running spotless.
423+
Prettier, like tsfmt, is based on NodeJS, so to use it, a working NodeJS installation (especially npm) is required on the host running spotless.
423424
Spotless will try to auto-discover an npm installation. If that is not working for you, it is possible to directly configure the npm binary to use.
424425

425426
```gradle
@@ -429,6 +430,9 @@ spotless {
429430
}
430431
}
431432
```
433+
434+
Spotless uses npm to install necessary packages locally. It runs prettier using [J2V8](https://github.com/eclipsesource/J2V8) internally after that.
435+
432436
<a name="license-header"></a>
433437

434438
## License header options

0 commit comments

Comments
 (0)