In this example I'd like to go to brackets like powershell and I like the suggestion in #63 as well.
What is my problem here?
If you take a look at function AfterAllWarnings it is not clear where the else is related to.
See the image what I mean.
I know I can rewrite the code, or disable the Code Analyzer, or change the rule AA0005, but I think this should be fixed.
codeunit 11239107 "Test Codeunit"
{
trigger OnRun()
begin
end;
var
x: Integer;
i: Integer;
Condition: Boolean;
local procedure BeforeAllWarnings()
begin
if x = 0 then begin
if Condition then begin
i := 1;
x += 1;
end;
end else
x := 1;
end;
local procedure AfterAllWarnings()
begin
if x = 0 then
if Condition then begin
i := 1;
x += 1;
end
else // Is this the 'else' of the 'then' or the 'end'?
x := 1;
end;
}

Begin starts a block statement (compound). A nested IF statement is just another statement and not a block. Thus what you see is valid.
What was your original code in C/AL? I guess you used a begin for a single statement too. In your case the nested IF. txt2al is not a semantic aware conversion tool. Thus it would have no clue how to make transformed C/AL code pass a code analysis tool. And I am not sure had it known how it should have done that.
On the other hand we should properly support block hovering. Like if you click on a block start (begin) it should find the corresponding block end and vice versa.
@kalberes I don't understand your answer.
Forget the Txt2Al converter, if we want to program function BeforeAllWarnings in al-code we get BEGIN..END warnings.
We want to solve these warnings what result in the function AfterAllWarnings
But this code is not correct, we do not know where the else (line 30) belongs to.
BTW this is not a suggestion but a bug.
Here another example, if I folow the suggestions, I get wrong code

So I have to change the code without a else:

Ok I understand now what you were asking. Rule AA0005 seems to be buggy in case of nested IF-s.
This issue seems to have been fixed in August update.
Most helpful comment
Ok I understand now what you were asking. Rule AA0005 seems to be buggy in case of nested IF-s.