Commit b8641a2
feat: Add warning if skip_lines causes empty block (#124)
Fixes: #123
Specifically, this triggers if skip_lines causes the block's start to be
at or after the block's end. So fully-empty blocks with no skip_lines
(or no-op skip_lines, such as skip_lines=0,0) are still fine.
Modify tests in skip_lines golden test to show this behavior.
Modify how start and end are logged in cmd.go. As-is causes the slightly
confusing behavior that "end" is always logged before start because it
comes first alphabetically. Now these are logged as [start,end]=[x,y].
The warning for if start>=end shows both the original start/end and
their offsets to make it more obvious how the values are arrived at.
This helps finding the problematic lines, as otherwise you just see
where the block start and end is, not where the directives are.
---------
Co-authored-by: Jeffrey Faer <jeffrey.faer@gmail.com>1 parent 4c4bb29 commit b8641a2
File tree
5 files changed
+30
-5
lines changed- cmd
- goldens
- keepsorted
5 files changed
+30
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
237 | 237 | | |
238 | 238 | | |
239 | 239 | | |
240 | | - | |
| 240 | + | |
241 | 241 | | |
242 | 242 | | |
243 | 243 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
2 | 6 | | |
3 | 7 | | |
4 | 8 | | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
5 | 13 | | |
6 | 14 | | |
7 | 15 | | |
| |||
11 | 19 | | |
12 | 20 | | |
13 | 21 | | |
14 | | - | |
| 22 | + | |
15 | 23 | | |
16 | 24 | | |
17 | 25 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
2 | 6 | | |
3 | 7 | | |
4 | 8 | | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
5 | 13 | | |
6 | 14 | | |
7 | 15 | | |
| |||
11 | 19 | | |
12 | 20 | | |
13 | 21 | | |
14 | | - | |
| 22 | + | |
15 | 23 | | |
16 | 24 | | |
17 | 25 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
| |||
116 | 117 | | |
117 | 118 | | |
118 | 119 | | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
119 | 124 | | |
120 | 125 | | |
121 | 126 | | |
| |||
0 commit comments