-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Checkstyle warnings on throwing Throwables in Step Definitions #1207
Comments
It is not required for a step definition to declare any exceptions. You can remove these or reduce their severity to satisfy your check style. We can't disallow step definitions from throwing This should reduce the manual labor of fixing generated code somewhat. |
Tests are allowed to fail by throwing an(y) exception. As such #318 added `throws Throwable` to the JavaSnippet. Aside from being a bad practice this results in unnecessary checkstyle warnings. As such the generated snippet should not explicitly declare `Throwable`. Reducing `Throwable` to `Exception` should be sufficient. Fixes #1207
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Summary
If a given Cucumber Java project uses CheckStyle, one of the warnings raised is the
IllegalThrowsCheck
for Step Definitions, because, by default, they throw a Throwable.Expected Behaviour
We could try to improve the default throws of step definitions to ensure that types (Like Error or Throwable) are not declared to be thrown and are not allowed.
Current Behavior
The current behaviour is that by default, we allow throwing Throwables.
Context & Motivation
Like mentioned above, if a given Cucumber Java project uses CheckStyle and depends on its validations, a common failure is the throwing of Throwables.
The text was updated successfully, but these errors were encountered: