Repository navigation
Expand file tree
/
Copy pathrewrite.yml
More file actions
192 lines (192 loc) · 7.46 KB
/
Copy pathrewrite.yml
File metadata and controls
192 lines (192 loc) · 7.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
---
# First stage of the checkstyle auto-fix, run on demand by the rewrite-maven-plugin
# execution `checkstyle-autofix-openrewrite` in the root pom (bound to no phase), just before
# checkstyle-autofix.groovy (which then fixes what is left, text-level, driven by
# Checkstyle's own reports).
#
# Everything OpenRewrite has a recipe for lives here; the Groovy stage keeps only the rules
# with no recipe (see storm-checkstyle/README.md for the split). The formatting recipes need
# a style, which is declared below (org.apache.storm.checkstyle.Style) and mirrors
# storm_checkstyle.xml instead of being derived from it: the derived styles conflict with the
# ruleset (RightCurly 'alone' would push catch/else onto their own line).
#
# Deliberately NOT here:
# - org.openrewrite.java.format.AutoFormat: bundles formatters that do not follow the ruleset
# and introduces star imports (AvoidStarImport).
# - org.openrewrite.staticanalysis.TypecastParenPad: turns `(T) x` into `(T)x`, which
# violates WhitespaceAfter (the Spaces recipe below covers ParenPad on its own).
type: specs.openrewrite.org/v1beta/recipe
name: org.apache.storm.checkstyle.AutoFix
displayName: Fix storm_checkstyle.xml violations that need a parsed AST
description: >
NeedBraces, MultipleVariableDeclarations, ModifierOrder, UpperEll, ArrayTypeStyle,
FileTabCharacter, OperatorWrap, WhitespaceAround/After, NoWhitespaceBefore, ParenPad,
MethodParamPad, GenericWhitespace, Indentation, EmptyLineSeparator, CustomImportOrder,
AvoidStarImport and MissingSwitchDefault (only a misplaced default).
recipeList:
- org.openrewrite.staticanalysis.NeedBraces
- org.openrewrite.staticanalysis.MultipleVariableDeclarations
- org.openrewrite.staticanalysis.ModifierOrder
- org.openrewrite.staticanalysis.UpperCaseLiteralSuffixes
- org.openrewrite.staticanalysis.UseJavaStyleArrayDeclarations
# OperatorWrap (option NL in the ruleset)
- org.openrewrite.staticanalysis.OperatorWrap:
wrapOption: NL
# FileTabCharacter
- org.openrewrite.java.format.NormalizeTabsOrSpaces
# WhitespaceAround, WhitespaceAfter, NoWhitespaceBefore, ParenPad, MethodParamPad, GenericWhitespace
- org.openrewrite.java.format.Spaces
# LeftCurly, RightCurly, NoLineWrap, AnnotationLocation (partial: see storm-checkstyle/README.md)
- org.openrewrite.java.format.WrappingAndBraces
# Indentation, CommentsIndentation
- org.openrewrite.java.format.TabsAndIndents
# EmptyLineSeparator
- org.openrewrite.java.format.BlankLines
# AvoidStarImport: unfolds star imports to the types actually used (needs type attribution)
- org.openrewrite.java.RemoveUnusedImports
# MissingSwitchDefault: only moves an existing `default` last
- org.openrewrite.staticanalysis.DefaultComesLast
# CustomImportOrder (STATIC###THIRD_PARTY_PACKAGE, sorted, one blank line between the groups)
- org.openrewrite.java.OrderImports:
removeUnused: false
---
type: specs.openrewrite.org/v1beta/style
name: org.apache.storm.checkstyle.Style
displayName: Style mirroring storm_checkstyle.xml
styleConfigs:
- org.openrewrite.java.style.TabsAndIndentsStyle:
useTabCharacter: false
tabSize: 4
indentSize: 4
continuationIndent: 8
indentsRelativeToExpressionStart: false
- org.openrewrite.java.style.BlankLinesStyle:
keepMaximum:
inDeclarations: 1
inCode: 1
beforeEndOfBlock: 1
betweenHeaderAndPackage: 1
minimum:
beforePackage: 0
afterPackage: 1
beforeImports: 1
afterImports: 1
aroundClass: 1
afterClassHeader: 0
beforeClassEnd: 0
afterAnonymousClassHeader: 0
aroundFieldInInterface: 0
aroundField: 0
aroundMethodInInterface: 1
aroundMethod: 1
beforeMethodBody: 0
aroundInitializer: 1
- org.openrewrite.java.style.ImportLayoutStyle:
# static imports first, then everything else; never fold into a star import
classCountToUseStarImport: 2147483647
nameCountToUseStarImport: 2147483647
layout:
- import static all other imports
- <blank line>
- import all other imports
- org.openrewrite.java.style.WrappingAndBracesStyle:
# RightCurly 'same' for else/catch/finally; annotations of types and methods on their own line
ifStatement:
elseOnNewLine: false
specialElseIfTreatment: true
tryStatement:
catchOnNewLine: false
finallyOnNewLine: false
classAnnotations:
wrap: WrapAlways
methodAnnotations:
wrap: WrapAlways
- org.openrewrite.java.style.SpacesStyle:
beforeParentheses:
methodDeclaration: false
methodCall: false
ifParentheses: true
forParentheses: true
whileParentheses: true
switchParentheses: true
tryParentheses: true
catchParentheses: true
synchronizedParentheses: true
annotationParameters: false
aroundOperators:
assignment: true
logical: true
equality: true
relational: true
bitwise: true
additive: true
multiplicative: true
shift: true
unary: false
lambdaArrow: true
methodReferenceDoubleColon: false
beforeLeftBrace:
classLeftBrace: true
methodLeftBrace: true
ifLeftBrace: true
elseLeftBrace: true
forLeftBrace: true
whileLeftBrace: true
doLeftBrace: true
switchLeftBrace: true
tryLeftBrace: true
catchLeftBrace: true
finallyLeftBrace: true
synchronizedLeftBrace: true
arrayInitializerLeftBrace: true
annotationArrayInitializerLeftBrace: false
within:
codeBraces: true
brackets: false
arrayInitializerBraces: false
emptyArrayInitializerBraces: false
groupingParentheses: false
methodDeclarationParentheses: false
emptyMethodDeclarationParentheses: false
methodCallParentheses: false
emptyMethodCallParentheses: false
ifParentheses: false
forParentheses: false
whileParentheses: false
switchParentheses: false
tryParentheses: false
catchParentheses: false
synchronizedParentheses: false
typeCastParentheses: false
annotationParentheses: false
angleBrackets: false
recordHeader: false
other:
beforeComma: false
afterComma: true
beforeForSemicolon: false
afterForSemicolon: true
afterTypeCast: true
beforeColonInForEach: true
insideOneLineEnumBraces: false
aroundEqualInAnnotationValuePair: true
typeArguments:
afterComma: true
beforeOpeningAngleBracket: false
afterClosingAngleBracket: false