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 · 68 comments
Open

Expand XPath IT Regression Testing #6207

rnveach opened this issue Nov 10, 2018 · 68 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.

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

akankshat05 added a commit to akankshat05/checkstyle that referenced this issue Oct 28, 2024
akankshat05 added a commit to akankshat05/checkstyle that referenced this issue Oct 29, 2024
@github-actions github-actions bot modified the milestones: 10.19.0, 10.20.0 Oct 29, 2024
akankshat05 added a commit to akankshat05/checkstyle that referenced this issue Nov 7, 2024
akankshat05 added a commit to akankshat05/checkstyle that referenced this issue Nov 7, 2024
@github-actions github-actions bot modified the milestones: 10.20.0, 10.20.2 Nov 7, 2024
Kushagra-Sedwal added a commit to Kushagra-Sedwal/checkstyle that referenced this issue Nov 17, 2024
Kushagra-Sedwal added a commit to Kushagra-Sedwal/checkstyle that referenced this issue Nov 17, 2024
Kushagra-Sedwal added a commit to Kushagra-Sedwal/checkstyle that referenced this issue Nov 17, 2024
Kushagra-Sedwal added a commit to Kushagra-Sedwal/checkstyle that referenced this issue Nov 18, 2024
Kushagra-Sedwal added a commit to Kushagra-Sedwal/checkstyle that referenced this issue Nov 18, 2024
luvtyping added a commit to luvtyping/checkstyle that referenced this issue Dec 5, 2024
@github-actions github-actions bot modified the milestones: 10.20.2, 10.20.3 Dec 5, 2024
ahmedyoussefg added a commit to ahmedyoussefg/checkstyle that referenced this issue Dec 13, 2024
ahmedyoussefg added a commit to ahmedyoussefg/checkstyle that referenced this issue Dec 13, 2024
@github-actions github-actions bot modified the milestones: 10.21.0, 10.21.1 Dec 13, 2024
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