Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expand XPath IT Regression Testing #6207

Open
rnveach opened this issue Nov 10, 2018 · 63 comments
Open

Expand XPath IT Regression Testing #6207

rnveach opened this issue Nov 10, 2018 · 63 comments

Comments

@rnveach
Copy link
Member

rnveach commented Nov 10, 2018

Identified at #6198 (comment) ,

We need to expand XPath IT Regression to all checks that support it.

All checks listed under Currently, filter supports the following checks must appear with regression tests in https://github.com/checkstyle/checkstyle/tree/master/src/it/java/org/checkstyle/suppressionxpathfilter to showcase suppression by XPath works for the check.
Every log statement must be tested from the Check. There should be at least 3 test methods for different structure of code.
Example: if 1 check has 2 log statements, the XPath test must have at least 3 tests, 1 for each log statement + 1 for some weird usecase like very nested violation.
If Check has 1 log statement, but target of check can be in different localtions (in class, in method, in interface, in anonymous class), Check should have at least 3 test methods to have different xpath by structure.

Tests can be copy of examples from our normal test tier at https://github.com/checkstyle/checkstyle/tree/master/src/test/java/com/puppycrawl/tools/checkstyle/checks just smaller.

Each PR must contain only 1 check. Each PR must contain a link to the check's documentation in the first post. (Ex: https://checkstyle.org/config_coding.html#ArrayTrailingComma for ArrayTrailingCommaCheck)

Input files for each test update must be named according to the convention "InputXpath{Checkname}Xxxx". The 'Checkname' will be the check for which we are doing test update and 'Xxxx' must be a proper suffix that specifies what the input file is testing.

List of remaining Checks for which we need to expand Xpath IT Regression Testing -

private static final Set<String> MISSING_CHECK_NAMES = Set.of(
"ClassDataAbstractionCoupling",
"ClassFanOutComplexity",
"ClassTypeParameterName",
"DescendantToken",
"DesignForExtension",
"HideUtilityClassConstructor",
"InterfaceTypeParameterName",
"LocalVariableName",
"ModifiedControlVariable",
"MutableException",
"RedundantModifier",
"SeparatorWrap",
"SuperFinalize",
"SuppressWarnings");

@mincong-h
Copy link
Contributor

Hi, is this issue still valid? I can contribute some of these missing tests.

@rnveach
Copy link
Member Author

rnveach commented Aug 12, 2019

It is still valid as long as we are missing these tests.
You are free to contribute.

@mincong-h
Copy link
Contributor

mincong-h commented Aug 14, 2019

Before moving further on this ticket, I just want to make an exhaustive list of checks to be tested. So that we are all aware of the test effort. They are extracted from https://checkstyle.sourceforge.io/config_filters.html#SuppressionXpathFilter_Description

Actual tracker is at issue description.

Outdated tracker:

  • AbstractClassName
  • AnonInnerLength
  • ArrayTypeStyle
  • AvoidInlineConditionals
  • AvoidNestedBlocks
  • BooleanExpressionComplexity
  • CatchParameterName
  • ClassDataAbstractionCoupling
  • ClassFanOutComplexity
  • ClassMemberImpliedModifier
  • ClassTypeParameterName
  • ConstantName
  • CovariantEquals
  • CyclomaticComplexity
  • DeclarationOrder
  • DefaultComesLast
  • DescendantToken
  • DesignForExtension
  • EmptyBlock
  • EmptyForInitializerPad
  • EmptyForIteratorPad
  • EmptyStatement
  • EqualsAvoidNull
  • EqualsHashCode
  • ExecutableStatementCount
  • ExplicitInitialization
  • FallThrough
  • FinalLocalVariable
  • FinalParameters
  • GenericWhitespace
  • HiddenField
  • HideUtilityClassConstructor
  • IllegalInstantiation
  • IllegalToken
  • IllegalTokenText
  • IllegalType
  • InnerAssignment
  • InnerTypeLast
  • InterfaceTypeParameterName
  • JavadocVariable
  • JavaNCSS
  • IllegalImport
  • IllegalThrows
  • ImportControl
  • LeftCurly
  • LocalFinalVariableName
  • LocalVariableName
  • MagicNumber
  • MemberName
  • MethodLength
  • MethodName
  • MethodParamPad
  • MethodTypeParameterName
  • ModifiedControlVariable
  • ModifierOrder
  • MultipleStringLiterals
  • MultipleVariableDeclarations
  • MutableException
  • NestedForDepth
  • NestedIfDepth
  • NestedTryDepth
  • NoWhitespaceAfter
  • NoWhitespaceBefore
  • NPathComplexity
  • OneStatementPerLine
  • OperatorWrap
  • OuterTypeNumber
  • PackageName
  • ParameterAssignment
  • ParameterName
  • ParameterNumber
  • ParenPad
  • RedundantImport
  • RedundantModifier
  • RequireThis
  • ReturnCount
  • RightCurly
  • SeparatorWrap
  • SimplifyBooleanExpression
  • SimplifyBooleanReturn
  • SingleSpaceSeparator
  • StaticVariableName
  • StringLiteralEquality
  • SuperClone
  • SuperFinalize
  • SuppressWarnings
  • ThrowsCount
  • TypecastParenPad
  • TypeName
  • UnnecessarySemicolonInEnumeration
  • UnnecessarySemicolonInTryWithResources
  • UnusedImports
  • UpperEll
  • VisibilityModifier
  • WhitespaceAfter
  • WhitespaceAround

Are we still good about it? Personally I'm happy to contribute, it's a good opportunity to learn different rules.

@romani
Copy link
Member

romani commented Aug 15, 2019

Thank you very much !!
We appreciate your help.

it would be awesome is you create UT with list like - https://github.com/checkstyle/checkstyle/pull/6969/files#diff-67a0806621fe751520ab842060ba14fcL106 , see whole change of #6969 it show how @pbludov improve step by step , but it is very enforced validation on each change, new Checks already come in better form in first commit.
so list of what is not done will be self controlled by UTs and nobody will forget to add such tests during new Check is created. We recently missed such tests creation ... .
We can sync manually progress in your comment, as additional option.

@mincong-h
Copy link
Contributor

Thank you very much !!
We appreciate your help.

You are welcome. I'm very glad to be here, because Checkstyle helps me a lot in my daily job.

it would be awesome is you create UT with list like - https://github.com/checkstyle/checkstyle/pull/6969/files#diff-67a0806621fe751520ab842060ba14fcL106 , see whole change of #6969 it show how @pbludov improve step by step , but it is very enforced validation on each change, new Checks already come in better form in first commit.
so list of what is not done will be self controlled by UTs and nobody will forget to add such tests during new Check is created. We recently missed such tests creation ... .

Thanks for the hint. I will create it.

We can sync manually progress in your comment, as additional option.

Automation is better 😄

CubeTures added a commit to CubeTures/checkstyle that referenced this issue Mar 3, 2024
Co-authored-by: Nick Mancuso <31252532+nrmancuso@users.noreply.github.com>
MANISH-K-07 added a commit to MANISH-K-07/checkstyle that referenced this issue Mar 4, 2024
MANISH-K-07 added a commit to MANISH-K-07/checkstyle that referenced this issue Mar 4, 2024
MANISH-K-07 added a commit to MANISH-K-07/checkstyle that referenced this issue Mar 4, 2024
MANISH-K-07 added a commit to MANISH-K-07/checkstyle that referenced this issue Mar 4, 2024
MANISH-K-07 added a commit to MANISH-K-07/checkstyle that referenced this issue Mar 4, 2024
CubeTures added a commit to CubeTures/checkstyle that referenced this issue Mar 5, 2024
CubeTures added a commit to CubeTures/checkstyle that referenced this issue Mar 5, 2024
@Lmh-java
Copy link
Contributor

Lmh-java commented Mar 8, 2024

I am on VisibilityModifier :)

@Lmh-java
Copy link
Contributor

I am on LocalFinalVariableName :)

@Kexin2000
Copy link
Contributor

I am on MethodTypeParameterName

@MANISH-K-07
Copy link
Contributor

@romani / @rnveach , can we update issue description here to specify new naming convention ?
Previously updated tests in PRs contain old naming would confuse new contributors

@romani
Copy link
Member

romani commented Mar 28, 2024

please share wording.

@MANISH-K-07
Copy link
Contributor

MANISH-K-07 commented Mar 28, 2024

please share wording.

--------------------------------------------------------------------------------------------------------------

Input files for each test update must be named according to the convention "InputXpath{Checkname}Xxxx". The 'Checkname' will be the check for which we are doing test update and 'Xxxx' must be a proper suffix that specifies what the input file is testing.

List of remaining Checks for which we need to expand Xpath IT Regression Testing -

private static final Set<String> MISSING_CHECK_NAMES = Set.of(
"ClassDataAbstractionCoupling",
"ClassFanOutComplexity",
"ClassTypeParameterName",
"DescendantToken",
"DesignForExtension",
"HideUtilityClassConstructor",
"InterfaceTypeParameterName",
"LocalVariableName",
"ModifiedControlVariable",
"MutableException",
"RedundantModifier",
"SeparatorWrap",
"SuperFinalize",
"SuppressWarnings");

--------------------------------------------------------------------------------------------------------------

@romani , consider above wording. Also, the checkboxes are outdated and can be replaced with the above file pointer.


here is backup:

List of Checks for which we need to expand Xpath IT Regression Testing -

  • BooleanExpressionComplexity
  • CatchParameterName
  • ClassDataAbstractionCoupling
  • ClassFanOutComplexity
  • ClassTypeParameterName
  • DescendantToken
  • DesignForExtension
  • EqualsHashCode
  • ExecutableStatementCount
  • FinalLocalVariable
  • FinalParameters
  • HideUtilityClassConstructor
  • IllegalInstantiation
  • IllegalTokenText
  • InnerTypeLast
  • InterfaceTypeParameterName
  • JavaNCSS
  • LocalFinalVariableName
  • LocalVariableName
  • MagicNumber
  • MethodLength
  • MethodTypeParameterName
  • ModifiedControlVariable
  • MultipleStringLiterals
  • MutableException
  • PackageName
  • ParameterAssignment
  • ParameterNumber
  • RedundantModifier
  • SeparatorWrap
  • SimplifyBooleanExpression
  • StaticVariableName
  • SuperClone
  • SuperFinalize
  • SuppressWarnings
  • VisibilityModifier

@romani
Copy link
Member

romani commented Apr 1, 2024

done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests