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

Documentation for Exceptions RuleSet #640

Merged
merged 4 commits into from
Dec 24, 2017

Conversation

Mauin
Copy link
Collaborator

@Mauin Mauin commented Dec 24, 2017

Adds documentation for all rules in the exceptions RuleSet.

Relates to #496

Copy link
Member

@schalkms schalkms left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Y)

TODO: Specify description
This rule reports `catch` blocks for exceptions that have a type that is too generic.
It should be preferred to catch specific exceptions to the case that is currently handled. If the scope of the caught
Exception is too broad it can lead to unintended exceptions being caught.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exception - lower case

This rule allows to define functions which should never throw an exception. If a function exists that does throw
an exception it will be reported. By default this rule is checking for `toString`, `hashCode, `equals` and
`finalize`. This rule is configurable via the `methodNames` configuration to change the list of functions which
should not throw.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should not be thrown

@@ -194,7 +206,10 @@ fun foo() {

### ThrowingExceptionsWithoutMessageOrCause

TODO: Specify description
This rule reports all exceptions which are thrown without arguments or further description.
Exceptions should always call one of the constructor overloads to provide a message or a cause exception.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or a cause.

This rule reports all exceptions which are thrown without arguments or further description.
Exceptions should always call one of the constructor overloads to provide a message or a cause exception.
Exceptions should be meaningful and contain as much detail about the error case as possible. This will help track
down an underlying issue in a better way.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to track down

@arturbosch arturbosch merged commit 975b896 into detekt:master Dec 24, 2017
@arturbosch arturbosch added this to the RC6-1 milestone Jan 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants