File tree Expand file tree Collapse file tree 2 files changed +40
-3
lines changed
lib/src/main/java/com/diffplug/spotless
plugin-gradle/src/test/java/com/diffplug/gradle/spotless Expand file tree Collapse file tree 2 files changed +40
-3
lines changed Original file line number Diff line number Diff line change
1
+ /*
2
+ * Copyright 2024 DiffPlug
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ package com .diffplug .spotless ;
17
+
18
+ import java .util .Locale ;
19
+
20
+ /** These FormatterStep are meant to be used for testing only. */
21
+ public class TestingOnly {
22
+ public static FormatterStep lowercase () {
23
+ return FormatterStep .create ("lowercase" , "lowercaseStateUnused" , unused -> TestingOnly ::lowercase );
24
+ }
25
+
26
+ private static String lowercase (String raw ) {
27
+ return raw .toLowerCase (Locale .ROOT );
28
+ }
29
+
30
+ public static FormatterStep diverge () {
31
+ return FormatterStep .create ("diverge" , "divergeStateUnused" , unused -> TestingOnly ::diverge );
32
+ }
33
+
34
+ private static String diverge (String raw ) {
35
+ return raw + " " ;
36
+ }
37
+ }
Original file line number Diff line number Diff line change 1
1
/*
2
- * Copyright 2016-2021 DiffPlug
2
+ * Copyright 2016-2024 DiffPlug
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
@@ -40,11 +40,11 @@ void before() throws IOException {
40
40
"spotless {" ,
41
41
" format 'misc', {" ,
42
42
" target 'DIRTY.md', 'CLEAN.md'" ,
43
- " custom 'lowercase', { str -> str.toLowerCase(Locale.ROOT) } " ,
43
+ " addStep com.diffplug.spotless.TestingOnly.lowercase() " ,
44
44
" }" ,
45
45
" format 'diverge', {" ,
46
46
" target 'DIVERGE.md'" ,
47
- " custom ' diverge', { str -> str + ' ' } " ,
47
+ " addStep com.diffplug.spotless.TestingOnly. diverge() " ,
48
48
" }" ,
49
49
"}" );
50
50
dirty = new File (rootFolder (), "DIRTY.md" );
You can’t perform that action at this time.
0 commit comments