Proposed Rule Name: AvoidReassigningCatchVariables
Proposed Category: Best Practices
Description:
The rule AvoidReassigningParameters flags a problem when code assigns a value to a method parameter. Here is the reason in documentation.
Reassigning values to incoming parameters is not recommended. Use temporary local variables instead.
This new rule AvoidReassigningCatchVariables
will flag a problem when code assigns a value to the catch variable.
I do not know why AvoidReassigningParameters
exists. I assume that AvoidReassigningCatchVariables
should exist for the same reason.
Code Sample:
... catch (Exception e) { e = new Exception("Hello World", e); // This should be flagged as a problem } ... // Fixed code ... catch (Exception e) { Exception wrap; wrap = new Exception("Hello World", e); }
Possible Properties:
This rule does not need any properties.
See also:
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4