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

Closed
rnveach opened this issue Nov 10, 2018 · 71 comments
Closed

Expand XPath IT Regression Testing #6207

rnveach opened this issue Nov 10, 2018 · 71 comments

Comments

@rnveach
Copy link
Contributor

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.

Inputs does not know what config will be used.
Xpath also does not care much on config.
So better to name Inputs by content that they have or violation they have. Example: InputXpathModifiedControlVariableWithForeach

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

private static final Set<String> MISSING_CHECK_NAMES = Set.of(
"ClassFanOutComplexity",
"DescendantToken",
"DesignForExtension",
"HideUtilityClassConstructor",
"RedundantModifier",
"SuperFinalize");

@mincong-h
Copy link
Contributor

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

@rnveach
Copy link
Contributor 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 added a commit to mincong-h/checkstyle that referenced this issue Aug 12, 2019

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
mincong-h added a commit to mincong-h/checkstyle that referenced this issue Aug 13, 2019
mincong-h added a commit to mincong-h/checkstyle that referenced this issue Aug 14, 2019
mincong-h added a commit to mincong-h/checkstyle that referenced this issue Aug 14, 2019
mincong-h added a commit to mincong-h/checkstyle that referenced this issue Aug 14, 2019
mincong-h added a commit to mincong-h/checkstyle that referenced this issue Aug 14, 2019
@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.

Sorry, something went wrong.

@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 😄

romani pushed a commit that referenced this issue Dec 13, 2024
@github-actions github-actions bot modified the milestones: 10.21.0, 10.21.1 Dec 13, 2024
Anmol202005 added a commit to Anmol202005/checkstyle that referenced this issue Jan 5, 2025
Anmol202005 added a commit to Anmol202005/checkstyle that referenced this issue Jan 5, 2025
romani pushed a commit that referenced this issue Jan 5, 2025
@github-actions github-actions bot modified the milestones: 10.21.1, 10.21.2 Jan 5, 2025
Mostafahassen1 added a commit to Mostafahassen1/checkstyle that referenced this issue Jan 6, 2025
…fierCheck
Anmol202005 added a commit to Anmol202005/checkstyle that referenced this issue Jan 6, 2025
romani pushed a commit that referenced this issue Jan 6, 2025
Mostafahassen1 added a commit to Mostafahassen1/checkstyle that referenced this issue Jan 19, 2025
Mostafahassen1 added a commit to Mostafahassen1/checkstyle that referenced this issue Jan 19, 2025
Mostafahassen1 added a commit to Mostafahassen1/checkstyle that referenced this issue Jan 20, 2025
Mostafahassen1 added a commit to Mostafahassen1/checkstyle that referenced this issue Jan 25, 2025
Mostafahassen1 added a commit to Mostafahassen1/checkstyle that referenced this issue Jan 25, 2025
@Nishantware
Copy link

if this issue solved then you should close the issue

@romani
Copy link
Member

romani commented Feb 1, 2025

We are waiting for last PR #16236 to be merged.

Mostafahassen1 added a commit to Mostafahassen1/checkstyle that referenced this issue Feb 1, 2025
romani pushed a commit to Mostafahassen1/checkstyle that referenced this issue Feb 4, 2025
romani pushed a commit that referenced this issue Feb 4, 2025
@github-actions github-actions bot modified the milestones: 10.21.2, 10.21.3 Feb 4, 2025
@romani
Copy link
Member

romani commented Feb 4, 2025

Final fix is merged.
Thanks a lot to all participants!!!!

We did it!! I just took us 6 years to make it ;)

@romani romani closed this as completed Feb 4, 2025
Mostafahassen1 added a commit to Mostafahassen1/checkstyle that referenced this issue Feb 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.