SoftwareQuality/jabref/rewrite.yml
2025-01-11 12:30:11 +01:00

209 lines
11 KiB
YAML

---
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.lang.StringFormatted
- org.openrewrite.java.migrate.util.SequencedCollection
- 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