Closed rvanbekkum closed 2 years ago
I would add a new warning, because an if with an exit should never be followed by an else. Case is a bit different, not sure if it works correct with this warning.
an if with an exit should never be followed by an else
I understand the reasoning for this, i.e. that the exit
means the else
can never be hit, but I still think that in some situations it looks nicer to include the redundant else
, e.g. for symmetry. So sue me ;-)
Thanks for reporting this issue. Sorry we haven’t completed it yet, but we’ve had to prioritize elsewhere. We’re planning to give the CodeCop engine and its rules an overhaul in a future major release. Thanks for your patience.
1. Describe the bug If there are statements after an
if-else
-statement where both paths result in anexit
-statement, then I would expect rule AA0136 to report a warning on any statement after theif-else
-statement.2. To Reproduce Steps to reproduce the behavior:
3. Expected behavior Get a warning from AA0136 that unreachable code was detected, similar to how Visual Studio does this for C# (rule: CS0162) for the same example, e.g.:
For the given example, I would expect a warning on the
Message
-statement.4. Actual behavior No warning from AA0136 about unreachable code.
5. Versions:
Final Checklist
Please remember to do the following:
[x] Search the issue repository to ensure you are reporting a new issue
[x] Reproduce the issue after disabling all extensions except the AL Language extension
[x] Simplify your code around the issue to better isolate the problem