Skip to content

add checkstyle supressions #389

@Pankraz76

Description

@Pankraz76

What problem are you trying to solve?

https://docs.openrewrite.org/running-recipes/popular-recipe-guides/automatically-fix-checkstyle-violations#with-checkstyle-plugin

Currently it seems not to work using the mentioned auto discovery of the config.

Never the less when setting the config file manually, im wondering how to pass the suppressions as well, as i dont want to duplicate the config using the exclude tag, but simply rely on the checkstyle feature to parse the suppressions.xml.

setCheckstyleConfigFile(file("config/checkstyleMain.xml"))
setCheckstyleSuppressionFile(file("config/suppressions.xml"))
rewrite {
//	activeRecipe("org.openrewrite.java.RemoveUnusedImports")
//	activeRecipe("org.openrewrite.java.testing.cleanup.AssertTrueNullToAssertNull")
	activeRecipe("org.openrewrite.staticanalysis.EqualsAvoidsNull")
	activeRecipe("org.openrewrite.staticanalysis.CodeCleanup")
//	activeRecipe("org.openrewrite.staticanalysis.MissingOverrideAnnotation")
//	activeRecipe("org.openrewrite.staticanalysis.ModifierOrder")
//	activeRecipe("org.openrewrite.staticanalysis.RedundantFileCreation")
//	activeRecipe("org.openrewrite.staticanalysis.RemoveUnusedPrivateMethods")
	activeRecipe("org.openrewrite.text.EndOfLineAtEndOfFile")
	configFile = file("config/rewrite.yml")
	setCheckstyleConfigFile(file("config/checkstyleMain.xml"))
	setCheckstyleSuppressionFile(file("config/checkstyleMain.xml"))
	failOnDryRunResults = true
//	activeRecipe("org.junit.openrewrite.recipe.AddLicenseHeader")
//	activeRecipe("org.junit.openrewrite.recipe.Java21ForTests")
//	activeRecipe("org.openrewrite.java.format.AutoFormat")
//	activeRecipe("org.openrewrite.java.format.BlankLines")
//	activeRecipe("org.openrewrite.java.format.NormalizeFormat")
//	activeRecipe("org.openrewrite.java.format.NormalizeLineBreaks")
//	activeRecipe("org.openrewrite.java.format.RemoveTrailingWhitespace")
//	activeRecipe("org.openrewrite.java.format.Spaces")
//	activeRecipe("org.openrewrite.java.format.TabsAndIndents")
//	activeRecipe("org.openrewrite.java.format.WrappingAndBraces")
//	activeRecipe("org.openrewrite.java.migrate.UpgradeToJava21")
//	activeRecipe("org.openrewrite.java.testing.assertj.Assertj")
//	activeRecipe("org.openrewrite.java.testing.cleanup.TestsShouldNotBePublic")
//	activeRecipe("org.openrewrite.java.testing.junit5.JUnit5BestPractices")
//	activeRecipe("org.openrewrite.staticanalysis.CodeCleanup")
//	activeRecipe("org.openrewrite.staticanalysis.CommonStaticAnalysis")
//	activeRecipe("org.openrewrite.staticanalysis.FinalizeLocalVariables")
//	activeRecipe("org.openrewrite.staticanalysis.RemoveUnusedLocalVariables")
//	activeRecipe("org.openrewrite.staticanalysis.RemoveUnusedPrivateFields")
//	activeRecipe("org.openrewrite.staticanalysis.StringLiteralEquality")
}

example:

Describe the solution you'd like

Have you considered any alternatives or workarounds?

Additional context

Are you interested in contributing this feature to OpenRewrite?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions