This document is intended for CleanThat developers and users (e.g. through Spotless).
We adhere to the keepachangelog format
UseUnderscoresInNumericLiteralshas now homogeneous behavior between both floating number legs, following PMD expectation. #896ModifierOrdermay corrupt code by lack of whitespaces due to JavaParser bug. #897JavaParseris updated to3.27.0to fix #899
UnnecessaryModifieris reworked for simplification. It includes further management ofrecord. (#848)MutatorsScannernow relies on a hard-coded list of classNames to enable GraalVM compability (#895)
UnnecessaryModifierhandles properly abstract nested-classes (#842)
UnnecessaryModifierhandles annotations and enums (#843)
UseTextBlockshave stricter rules to elect texts as multi-line.javaparserto updated to3.26.1to fix #817
- Update
JavaParserto3.25.10to fix #807
ModifierOrdershall not prevent further modifiers mutators to operate correctly.
RemoveExplicitCallToSupernow removessuper();in constructor only if it is not the only statement.RemoveExplicitCallToSuperdoes not removethis()anymore.
ModifierOrdershall not prevent further modifiers mutators to operate correctly.
- Spotless licenseHeader default YearMode has been updated to
UPDATE_TO_TODAY, as CleanThat generally behave as ifratchetFromis the base branch UnnecessaryBoxingis not draft anymoreAvoidMultipleUnaryOperatorsis not draft anymore
UnnecessaryFullyQualifiedNamenow handle FullyQualifiedName on anonymous/nested classes when the nesting class is imported.ModifierOrdershould not crash on use ofsealedkeyword (JDK17, #713).
- Change notified by PR from @blacelle to @solven-eu/cleanthat-notify
ArithmethicAssignmentshould not assume String concatenation is symmetric.
- [
UnnecessaryImport] removes star import from same package](#553)
ArithmeticOverFloatsis introducedCastMathOperandsBeforeAssignementis introducedArithmethicAssignmentis introducedUseOptionalOfNullableis introducedSimplifyOptionalVariablesWithMapis introducedOptionalWrappedIfToFilteris introducedOptionalWrappedVariableToMapis introducedForEachIfBreakToStreamFindFirstis introducedForEachIfBreakElseToStreamTakeWhileis introducedUsePredefinedStandardCharsetis introducedStringFromStringis introducedOptionalMapIdentityis introducedStreamMapIdentityis introducedStreamForEachNestingForLoopToFlatMapis introducedStreamFlatMapStreamToFlatMapis introduced
SimplifyBooleanInitializationwill not produce invalid/corrupted initializer in case of negated initialization.PrimitiveWrapperInstantiationwill not confuse class named like a boxed type with a boxed type.EnhancedForLoopToStreamAnyMatchwill not accept a condition holding anAssignExpr
- Each
IMutatorsee its simple class name configured as default identifier. FileSystemCodeProviderwill log but not throw when loading a file with an incompatible charset.StringReplaceAllWithQuotableInputcovers more cases of quotable regexes.
SimplifyBooleanExpressionis introducedStringReplaceAllWithQuotableInputis introducedEnhancedForLoopToForEachis introducedLoopIntRangeToIntStreamForEachis introducedFileSystemCodeProvidernow accepts a custom charset (default remainsUTF-8)SimplifyStreamVariablesWithMapis introduced
PrimitiveWrapperInstantiationwill not treat nested class as a boxed type anymore (e.g.java.awt.geom.Rectangle2D.Double)SimplifyStartsWithis renamed fromStringStartsWithChargiven the existing PMD rule
@SuppressCleanthatenables skipping Cleanthat for specific pieces of codeRemoveDoubleNegationis introducedRemoveAllToClearCollectionis introducedSpotBugsMutatorsis introducedCollectionIndexOfToContainsis introducedStringIndexOfToContainsis introduced
- In many cases, the presence of comment will prevent a mutator, as comments would be lost in many cases
EnhancedForLoopToStreamAnyMatchwill not produce invalid code in case ofreturnover theforEachvariable
UseUnderscoresInNumericLiteralsnow applies only over 5+ digits (like PMD default configuration)
EnhancedForLoopToStreamCollectis introduced@CaseNotYetImplementedenables preparing unitTests for future features or limitations
S1602is renamedRSPEC-1602S1612is renamedRSPEC-1612LambdaReturnsSingleStatementnow properly handles multiple argumentsLambdaReturnsSingleStatementmay lose comments
UseStringIsEmptyis extracted fromUseCollectionIsEmpty
UnnecessaryLambdaEnclosingParametersis introduced but it is not functionalErrorProneMutatorsis introducedGuavaInlineStringsRepeatis introduced, and added inErrorProneMutatorsObjectEqualsForPrimitivesis introducedObjectsHashCodePrimitiveis introducedEnhancedForLoopToStreamAnyMatchis introducedRedundantLogicalComplementsInStreamis introducedSimplifyBooleanInitializationis introducedSafeButControversialis introduced
AvoidUncheckedExceptionsInSignaturesmay encounterUnsolvedSymbolExceptionsAvoidInlineConditionalswill not produce invalidvardeclarations.
StringStartsWithCharis added inSafeButNotConsensual$.repository.meta.full_clean_on_configuration_changeis a new option to enable full repository cleaning on a configuration change. It is defaulted tofalsewhile previous behavior was as if it was alwaystrue.EclipseStylesheetGeneratorhas a new option to discard ambiguous options (tryOptionsKeepingExistingFormat)
StringStartsWithCharis an additional mutatormvn cleanthat:applyis a new Mojo enabling one-shotting a rules over current directory README.MD
ArraysDotStreamrequires the argument to be an Array to convert useArrays.stream(). It may also rely onStream.offor other casesArraysDotStreamwill apply only if the scope isArraysEmptyControlStatementwill not break empty method definitions.LiteralsFirstInComparisonsbetter handles unresolved symbols.LambdaIsMethodReferencewill not rely onT.class::castif T is a Type bound (e.g. in<T> void method(...)).LocalVariableTypeInferencecrashes lesss often on unresolved types
UseTextBlocksis temporarily dropped fromSafeButNotConsensualas its results are too poor (javaparser/javaparser#3936).LambdaReturnsSingleStatementis temporarily dropped fromSafeButNotConsensualas its results are too poor (javaparser/javaparser#3938).BoxedPrimitiveConstructoris renamedPrimitiveWrapperInstantiation, as it is the relevant PMD rule.
LocalVariableTypeInferencecrashes lesss often on unresolved typesUnnecessaryModifierwill not removestaticfrom interface methods
LineEndingmanagement is dropped fromILintFixerandILintFixerWithPathModifierOrderis promoted inSafeAndConsensualStringToStringis promoted inSafeAndConsensualUnnecessaryModifierdoes not strip anymore thestatickeyword ofMethodDeclaration
IMutatoris generated into MUTATORS.generated.MD byRunGenerateDocumentationUseUnderscoresInNumericLiteralsis an additional PMD mutatorUseTextBlocksis an additional mutatorUnnecessaryImportis an additional mutatorBoxedPrimitiveConstructoris an additional mutatorLambdaIsMethodReferenceis an additional mutatorAvoidUncheckedExceptionsInSignaturesis an additional mutatorPrimitiveBoxedForStringis renamed intoUnnecessaryBoxingSafeButNotAndConsensualis an additional composite mutator
- Add empty constructor in
CompositeWalkableMutator CompositeMutator.getIds()do not return underlying identifiers anymore
- Invalid reports of any IMutators as not being idempotent
CreateTempFilesUsingNioCasesnow handle a null directoryLocalVariableTypeInferencedoes not replace assignments with different types (e.g.ArrayListassigned to aListvariable)- Introduces
IJavaparserMutator, paving the way for other mutators (from Eclipse Cleanup, OpenRewrite, etc)
AllIncludingDraftCompositeMutatorswas misbehaving givenMutatorsScanner
CreateTempFilesUsingNioCasesnow handle a null directory
- Additional mutator:
EmptyControlStatementturns{}into `` - Additional mutator:
UnnecessaryModifierturnspublic static finalinto `` in interfaces - Implemented generic
trimTrailingWhitespace,endWithNewlineandindexfrom Spotless - Composite Mutators can now be referenced by one of their identifier
OptionalNotEmptyis promoted inSafeAndConsensualUnnecessaryModifieris promoted inSafeAndConsensualUnnecessaryFullyQualifiedNameis promoted inSafeAndConsensualMarkdownFormatterFactoryincludes pattern is now defaulted to*.MDand*.mdJsonFormatterFactoryincludes pattern is now defaulted to*.json- BREAKING CHANGE
isProductionReadyhas been removed, and replaced by a fully-functionalincludeDraft - BREAKING CHANGE A draft-mutator explicitly listed is applied even if
includeDraftis false
- Fixes ImportOrderStep when the ordersFile parameters is used.
- Additional mutator:
LocalVariableTypeInferenceturnsint i = 10;intovar i = 10; - Additional composite mutators:
OptionalNotEmpty,PMDMutators,CheckStyleMutatorsandSonarMutators
- CleanThat Robot will open a single Review-Request per protected-branch (instead of opening one for each dirty event, with a random). The naming convention is
cleanthat/headfor-XXX-yyyy-MM-ddwhereXXXis the protected branch name andyyyy-MM-ddis current day. - Handle any source JDK version (with the help of JavaVersion)
- Mutators can be included by their fully-qualified class name
- Fix issue related to dynamic IMutators detection
- Spotless oriented release
- Added Spotless as an Engine
- Additional mutator for PMD.ComparisonWithNaN
- Additional mutator for JDK8 Streams: StreamAnyMatch
- The concept of language has been replaced by engine. Instead of implementing language-specific formatters, CleanThat now targets wiring linter-engines (like Spotless).
- POTENTIALLY BREAKING Most CleanThat linters has been dropped
- Initial release!