You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/docs/analyzers/FormattingCop/FC0007.md
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,7 +10,7 @@ linkTitle = 'FC0007'
10
10
ignoreObsolete = true
11
11
+++
12
12
13
-
Multi-line control-flow blocks (`if`, `case`, `repeat`, `while`, `for`, `foreach`) and scope-leaving statements (`exit`, built-in `Error(...)`) read more clearly when they are visually separated from surrounding code by a blank line. The rule reports the exact spot where a separator is missing so it can be inserted with a single keystroke, without touching the logic.
13
+
Multi-line control-flow blocks (`if`, `case`, `repeat`, `while`, `for`, `foreach`) and scope-leaving statements (`exit`, built-in `Error(...)` and `FieldError(...)`) read more clearly when they are visually separated from surrounding code by a blank line. The rule reports the exact spot where a separator is missing so it can be inserted with a single keystroke, without touching the logic.
14
14
15
15
FC0007 is **disabled by default** and fully configurable. Enable it in your project's `.ruleset.json` (or via `AL: Configure ruleset`) and, optionally, tune the individual checks in `alcops.json`.
16
16
@@ -70,7 +70,7 @@ The rule runs four independent checks. Each check can be toggled or narrowed via
70
70
|---|---|---|
71
71
| Blank line **before** a control-flow block | A multi-line `if`, `case`, `repeat`, `while`, `for`, or `foreach` immediately follows another statement in the same block. |`ControlFlowBefore`|
72
72
| Blank line **after** a control-flow block | A non-control-flow statement immediately follows the closing `end` (or `until`) of a multi-line control-flow block. |`ControlFlowAfter`|
73
-
| Blank line before a **scope-leaving** statement |`exit`, built-in `Error(...)`, or both follow a sibling statement in the same statement list without a whitespace-only line between them. |`ScopeLeavingMode`|
73
+
| Blank line before a **scope-leaving** statement |`exit`, a built-in `Error(...)` / `FieldError(...)` call, or both follow a sibling statement in the same statement list without a whitespace-only line between them. |`ScopeLeavingMode`|
74
74
| Blank line before **`else`** in an `if ... end else` construct | The closing `end` and the `else` keyword sit on adjacent lines instead of being separated by a blank line. Opt-in. |`ElseChainBeforeMode`|
75
75
76
76
Single-line control-flow statements (e.g. `if Flag then Message('x');` on one line) are excluded from the *before* / *after* checks by default. Include them with `OneLinerMode`.
@@ -97,7 +97,7 @@ exit; // OK: the empty line above still counts as a separa
97
97
98
98
- The symbol is obsolete
99
99
- Adjacent case branches inside a `case` statement (the check operates on the surrounding block, not on branches)
100
-
- An `exit`or `Error(...)` used directly as a `then` / `else` branch (the containing `if` is governed by the control-flow settings)
100
+
- An `exit`, `Error(...)`or `FieldError(...)` used directly as a `then` / `else` branch (the containing `if` is governed by the control-flow settings)
101
101
- Any statement immediately after `begin` or immediately before `end` (the block braces already act as separators)
102
102
103
103
### Configuration
@@ -120,7 +120,7 @@ All settings live under a single `StatementBlockSpacing` object in `alcops.json`
120
120
|---|---|---|---|---|
121
121
|`ControlFlowBefore`| boolean |`true`|`true` / `false`| Require a blank line before a multi-line control-flow block when it follows another statement in the same block. |
122
122
|`ControlFlowAfter`| boolean |`true`|`true` / `false`| Require a blank line after a multi-line control-flow block when a non-control-flow statement follows it directly. |
123
-
|`ScopeLeavingMode`| string |`"ExitAndError"`|`"Off"`, `"ExitOnly"`, `"ErrorOnly"`, `"ExitAndError"`| Which scope-leaving statements require a preceding blank line. |
123
+
|`ScopeLeavingMode`| string |`"ExitAndError"`|`"Off"`, `"ExitOnly"`, `"ErrorOnly"`, `"ExitAndError"`| Which scope-leaving statements require a preceding blank line. `ErrorOnly` and `ExitAndError` cover the built-in `Error(...)` as well as `Record.FieldError(...)` / `FieldRef.FieldError(...)`. |
124
124
|`ElseChainBeforeMode`| string |`"Off"`|`"Off"`, `"RequireBlank"`| Whether the `else` keyword of an `if ... end else` construct must sit on its own after a blank line. |
125
125
|`OneLinerMode`| string |`"None"`|`"None"`, `"All"`| Whether single-line control-flow statements participate in the `ControlFlowBefore` / `ControlFlowAfter` checks. |
126
126
@@ -142,7 +142,7 @@ Turn every check off and re-enable individual ones:
142
142
}
143
143
```
144
144
145
-
With this configuration the rule flags only the space before a multi-line block and the space before an `Error(...)` call; `exit` statements, trailing blanks and one-liners are ignored.
145
+
With this configuration the rule flags only the space before a multi-line block and the space before an `Error(...)`or `FieldError(...)`call; `exit` statements, trailing blanks and one-liners are ignored.
Copy file name to clipboardExpand all lines: content/docs/analyzers/LinterCop/LC0089.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -48,6 +48,8 @@ begin
48
48
end;
49
49
{{< /highlight >}}
50
50
51
+
A guard clause is an `if` whose only statement leaves the current flow: `exit`, `break`, `continue`, `CurrReport.Skip()` / `CurrReport.Break()` / `CurrReport.Quit()` (and the `CurrXMLport` equivalents), or a call to a built-in method that never returns — `Error(...)`, `Record.FieldError(...)` or `FieldRef.FieldError(...)`. A user-defined procedure that happens to be named `Error` or `FieldError` is a normal call and keeps its increment.
52
+
51
53
For the full scoring model — how nesting penalties, logical operators, recursion, and compensating usages like `else if` are calculated — see [LC0090](../lc0090/).
0 commit comments