-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
/
rewrite.yml
215 lines (207 loc) · 11.6 KB
/
rewrite.yml
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
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
---
type: specs.openrewrite.org/v1beta/recipe
name: org.jabref.config.rewrite.cleanup
recipeList:
# generated by extracting class names out of https://github.com/openrewrite/rewrite-static-analysis
#
# 1. git clone https://github.com/openrewrite/rewrite-static-analysis.git
# 2. cd rewrite-static-analysis/src/main/java/org/openrewrite/staticanalysis
# 3. find . -type f -name "*.java" -exec basename {} .java \; | awk '{print " - org.openrewrite.staticanalysis." $1}' | grep -v "Visitor" | grep -v "package-info"
#
# Then, following to are removed:
# Sometimes fails to produce correct results
# - org.openrewrite.staticanalysis.FinalizePrivateFields
# Creates constructor at the end of the class which violates JabRef's code style
# - org.openrewrite.staticanalysis.HideUtilityClassConstructor
# We are not relying on serialization, thus we do not want to maintain the serialVersionUID manually
# - org.openrewrite.staticanalysis.AddSerialVersionUidToSerializable
# Leads to "if (Boolean.TRUE.equals(proxyPrefs.shouldUseProxy())) {", which reads strange
# - org.openrewrite.staticanalysis.AvoidBoxedBooleanExpressions
# Leads to exception
# - org.openrewrite.staticanalysis.CombineSemanticallyEqualCatchBlocks
# Needs parameters
# - org.openrewrite.staticanalysis.DeclarationSiteTypeVariance
# Unreadable code
# .ifPresent((Path selectedDirectory) -> {
# - org.openrewrite.staticanalysis.ExplicitLambdaArgumentTypes
# Unreable code (e.g., public final class BindingsHelper)
# - org.openrewrite.staticanalysis.FinalClass
# Unreable code
# - org.openrewrite.staticanalysis.FinalizeLocalVariables
# Unreadable code
# - org.openrewrite.staticanalysis.FinalizeMethodArguments
# Not sure about the consequences (LibraryTab).
# - org.openrewrite.staticanalysis.FixStringFormatExpressions
# Leads to unreadable code (this.shouldAutoComplete.set(shouldAutoComplete1);)
# - org.openrewrite.staticanalysis.HiddenField
# Leads to unreadable code
# - org.openrewrite.staticanalysis.InlineVariable
# Leads to unreadable code
# - org.openrewrite.staticanalysis.LambdaBlockToExpression
# Works on case-senstive file systems only
# - org.openrewrite.staticanalysis.LowercasePackage
# Needs manual intervention (not fixable at existing code)
# - org.openrewrite.staticanalysis.MethodNameCasing
# Needs manual intervention (not fixable at existing code)
# - org.openrewrite.staticanalysis.MinimumSwitchCases
# Leads to unreadable code
# - org.openrewrite.staticanalysis.NoFinalizedLocalVariables
# Contradicts JabRef's checkstyle
# - org.openrewrite.staticanalysis.NoWhitespaceAfter
# We sometimes need == instead of equals
# - org.openrewrite.staticanalysis.ReferentialEqualityToObjectEquals
# AuthorListTest uses System.gc
# - org.openrewrite.staticanalysis.RemoveCallsToSystemGc
# We need that for our CLI
# - org.openrewrite.staticanalysis.RemoveSystemOutPrintln
# Removes a field - and that wrong
# - org.openrewrite.staticanalysis.RemoveUnusedPrivateMethods
# Crashes
# - org.openrewrite.staticanalysis.RenameExceptionInEmptyCatch
# Also renames private static final varialbes (e.g., LOGGER, ALL_ENTRIES_GROUP_DEFAULT_ICON, ...)
# - org.openrewrite.staticanalysis.RenamePrivateFieldsToCamelCase
# Does something else (deleting a field in TreeNode)
# - org.openrewrite.staticanalysis.ReplaceDeprecatedRuntimeExecMethods
# Leads to compile errors
# - org.openrewrite.staticanalysis.ReplaceDuplicateStringLiterals
# Not everything correctly transformed
# - org.openrewrite.staticanalysis.ReplaceLambdaWithMethodReference
# Crashes
# - org.openrewrite.staticanalysis.ReplaceStackWithDeque
# We want to keep JDK16 (and not downgrade to JDK11)
# - org.openrewrite.staticanalysis.ReplaceStreamToListWithCollect
# Changes one item only
# - org.openrewrite.staticanalysis.ReplaceStringBuilderWithString
# We like text blocks
# - org.openrewrite.staticanalysis.ReplaceTextBlockWithString
# Hangs
# - org.openrewrite.staticanalysis.ReplaceValidateNotNullHavingVarargsWithObjectsRequireNonNull
# We need that in OOBibStyleTest
# - org.openrewrite.staticanalysis.SimplifyConstantIfBranchExecution
# We log and wrap the exceptions
# - org.openrewrite.staticanalysis.UnnecessaryCatch
# Does not work
# - org.openrewrite.staticanalysis.UnnecessaryCloseInTryWithResources
# Does not work
# - org.openrewrite.staticanalysis.UnnecessaryExplicitTypeArguments
- org.openrewrite.staticanalysis.UnnecessaryParentheses
# Does not work
# - org.openrewrite.staticanalysis.UnnecessaryPrimitiveAnnotations
# Removes too much throws
# - org.openrewrite.staticanalysis.UnnecessaryThrows
# Crashes
# - org.openrewrite.staticanalysis.UseAsBuilder
# "Upgrades" too much, deletes fields
# - org.openrewrite.staticanalysis.UseCollectionInterfaces
# States that it gains performance, but the code is more unreable
# - org.openrewrite.staticanalysis.UseForEachRemoveInsteadOfSetRemoveAll
# We voted against it
# - org.openrewrite.staticanalysis.ExplicitInitialization
- org.openrewrite.java.migrate.io.ReplaceFileInOrOutputStreamFinalizeWithClose
- org.openrewrite.java.migrate.net.JavaNetAPIs
- org.openrewrite.java.migrate.net.URLConstructorsToURIRecipes
- org.openrewrite.java.migrate.util.OptionalNotEmptyToIsPresent
- org.openrewrite.java.migrate.util.OptionalNotPresentToIsEmpty
- org.openrewrite.java.migrate.util.SequencedCollection
- org.openrewrite.java.migrate.lang.StringFormatted
- org.openrewrite.java.RemoveObjectsIsNull
- org.openrewrite.java.ShortenFullyQualifiedTypeReferences
- org.openrewrite.java.testing.junit5.AssertTrueInstanceofToAssertInstanceOf
- org.openrewrite.java.testing.junit5.RemoveTryCatchFailBlocks
# needs another openrewrite dependency
# - org.openrewrite.okhttp.ReorderRequestBodyCreateArguments
- org.openrewrite.staticanalysis.AtomicPrimitiveEqualsUsesGet
- org.openrewrite.staticanalysis.BigDecimalRoundingConstantsToEnums
- org.openrewrite.staticanalysis.BooleanChecksNotInverted
- org.openrewrite.staticanalysis.CaseInsensitiveComparisonsDoNotChangeCase
- org.openrewrite.staticanalysis.CatchClauseOnlyRethrows
- org.openrewrite.staticanalysis.ChainStringBuilderAppendCalls
# Might need manual intervention, because negations are not treated properly
- org.openrewrite.staticanalysis.CompareEnumsWithEqualityOperator
- org.openrewrite.staticanalysis.ControlFlowIndentation
- org.openrewrite.staticanalysis.CovariantEquals
# Needs manual intervention
# - org.openrewrite.staticanalysis.DefaultComesLast
- org.openrewrite.staticanalysis.EmptyBlock
- org.openrewrite.staticanalysis.EqualsAvoidsNull
- org.openrewrite.staticanalysis.EqualsToContentEquals
# Needs manual intervention
# - org.openrewrite.staticanalysis.ExplicitCharsetOnStringGetBytes
- org.openrewrite.staticanalysis.ExternalizableHasNoArgsConstructor
- org.openrewrite.staticanalysis.FallThrough
# - org.openrewrite.staticanalysis.ForLoopControlVariablePostfixOperators
- org.openrewrite.staticanalysis.ForLoopIncrementInUpdate
- org.openrewrite.staticanalysis.IndexOfChecksShouldUseAStartPosition
- org.openrewrite.staticanalysis.IndexOfReplaceableByContains
# - org.openrewrite.staticanalysis.IndexOfShouldNotCompareGreaterThanZero
- org.openrewrite.staticanalysis.InstanceOfPatternMatch
- org.openrewrite.staticanalysis.IsEmptyCallOnCollections
# - org.openrewrite.staticanalysis.MissingOverrideAnnotation
# - org.openrewrite.staticanalysis.ModifierOrder
- org.openrewrite.staticanalysis.MultipleVariableDeclarations
- org.openrewrite.staticanalysis.NeedBraces
- org.openrewrite.staticanalysis.NestedEnumsAreNotStatic
- org.openrewrite.staticanalysis.NewStringBuilderBufferWithCharArgument
- org.openrewrite.staticanalysis.NoDoubleBraceInitialization
# - org.openrewrite.staticanalysis.NoEmptyCollectionWithRawType
- org.openrewrite.staticanalysis.NoEqualityInForCondition
- org.openrewrite.staticanalysis.NoFinalizer
# - org.openrewrite.staticanalysis.NoPrimitiveWrappersForToStringOrCompareTo
# - org.openrewrite.staticanalysis.NoRedundantJumpStatements
- org.openrewrite.staticanalysis.NoToStringOnStringType
- org.openrewrite.staticanalysis.NoValueOfOnStringType
# - org.openrewrite.staticanalysis.NoWhitespaceBefore
- org.openrewrite.staticanalysis.ObjectFinalizeCallsSuper
# - org.openrewrite.staticanalysis.OperatorWrap
- org.openrewrite.staticanalysis.PrimitiveWrapperClassConstructorToValueOf
- org.openrewrite.staticanalysis.RedundantFileCreation
- org.openrewrite.staticanalysis.RemoveCallsToObjectFinalize
- org.openrewrite.staticanalysis.RemoveEmptyJavaDocParameters
- org.openrewrite.staticanalysis.RemoveExtraSemicolons
- org.openrewrite.staticanalysis.RemoveJavaDocAuthorTag
- org.openrewrite.staticanalysis.RemoveHashCodeCallsFromArrayInstances
# - org.openrewrite.staticanalysis.RemoveRedundantTypeCast
- org.openrewrite.staticanalysis.RemoveToStringCallsFromArrayInstances
- org.openrewrite.staticanalysis.RemoveUnneededAssertion
- org.openrewrite.staticanalysis.RemoveUnneededBlock
# - org.openrewrite.staticanalysis.RemoveUnusedLocalVariables
# - org.openrewrite.staticanalysis.RemoveUnusedPrivateFields
# - org.openrewrite.staticanalysis.RenameLocalVariablesToCamelCase
- org.openrewrite.staticanalysis.RenameMethodsNamedHashcodeEqualOrToString
- org.openrewrite.staticanalysis.ReplaceRedundantFormatWithPrintf
- org.openrewrite.staticanalysis.ReplaceStringBuilderWithString
- org.openrewrite.staticanalysis.ReplaceWeekYearWithYear
# - org.openrewrite.staticanalysis.ShortenFullyQualifiedTypeReferences
# - org.openrewrite.staticanalysis.SimplifyConsecutiveAssignments
# - org.openrewrite.staticanalysis.SimplifyCompoundStatement
- org.openrewrite.staticanalysis.SimplifyBooleanExpression
- org.openrewrite.staticanalysis.SimplifyBooleanReturn
- org.openrewrite.staticanalysis.SimplifyDurationCreationUnits
- org.openrewrite.staticanalysis.SortedSetStreamToLinkedHashSet
- org.openrewrite.staticanalysis.StaticMethodNotFinal
- org.openrewrite.staticanalysis.StringLiteralEquality
- org.openrewrite.staticanalysis.TypecastParenPad
- org.openrewrite.staticanalysis.UnwrapRepeatableAnnotations
- org.openrewrite.staticanalysis.UpperCaseLiteralSuffixes
- org.openrewrite.staticanalysis.UseDiamondOperator
# - org.openrewrite.staticanalysis.UseJavaStyleArrayDeclarations
- org.openrewrite.staticanalysis.UseLambdaForFunctionalInterface
# - org.openrewrite.staticanalysis.UseListSort
- org.openrewrite.staticanalysis.UseObjectNotifyAll
- org.openrewrite.staticanalysis.UseStandardCharset
- org.openrewrite.staticanalysis.UseStringReplace
- org.openrewrite.staticanalysis.UseSystemLineSeparator
- org.openrewrite.staticanalysis.WhileInsteadOfFor
# - org.openrewrite.staticanalysis.WriteOctalValuesAsDecimal
# - org.openrewrite.java.testing.junit5.JUnit5BestPractices -- cannot be used directly, because one recipe is not working (see below)
- org.openrewrite.java.testing.cleanup.AssertLiteralBooleanToFailRecipe
- org.openrewrite.java.testing.cleanup.RemoveTestPrefix
# - org.openrewrite.java.testing.cleanup.TestsShouldNotBePublic -- does not work due to https://github.com/openrewrite/rewrite-testing-frameworks/issues/458
- org.openrewrite.java.testing.junit5.CleanupAssertions
- org.openrewrite.java.testing.junit5.AddParameterizedTestAnnotation
- org.openrewrite.java.testing.junit5.RemoveDuplicateTestTemplates
- org.openrewrite.java.testing.junit5.RemoveTryCatchFailBlocks
- org.openrewrite.java.testing.junit5.LifecycleNonPrivate
- org.openrewrite.java.testing.junit5.StaticImports
# Logging
- org.openrewrite.java.logging.slf4j.Slf4jBestPractices