-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Reject @BeforeMethod without singleThreaded=true #15756
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -91,6 +91,10 @@ | |
| <property name="format" value="^[ \t]*import static org\.testng\.AssertJUnit\." /> | ||
| <property name="message" value="Use org.testng.Assert instead of org.testng.AssertJUnit" /> | ||
| </module> | ||
| <module name="RegexpMultiline"> | ||
| <property name="format" value="(?<!@Test\(singleThreaded[ ]?=[ ]?true\))\npublic class \w+\n\{\n(.*\n){0,200}\s+@BeforeMethod\n" /> | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you use a simpler regex that is less likely to fail if the How reliable is this regex going to be? Seems like several places could have whitespace that aren't accounted for in the regex. I know our style checks forbid a lot of them, but I just want to check in and find out what you tested?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Good idea, I'll try that.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Yes, white spaces are checked by other style checks.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
This can't be a simple regex. if
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we can match on the acceptable method can we negate it with something like My regex skills are not that strong. Seems like negating a regex is generally possible.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks like it is as complicated as negative lookbehind. And ".*" at the end consumes everything of a file, for a big file, the regex engine could raise a stack overflow exception. |
||
| <property name="message" value="@BeforeMethod cannot be used in a class that is not @Test(singleThreaded=true)" /> | ||
| </module> | ||
|
|
||
| <module name="SuppressWarningsFilter" /> | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.