Commit fb3f263
[linter] lines_longer_than_80_chars and document_ignores shouldn't read files
* document_ignores read each file once
* lines_longer_than_80_chars read each file for every line > 80 chars (!).
This follows the approach in
https://dart-review.googlesource.com/c/sdk/+/401424 where the same
pattern was identified as bad.
Before this CL, if a file had, say, 1000 lines > 80 chars (and having
the lint enabled), the lint would read the file - from disk - 1000
times. A somewhat saving grace is that for open files - which I guess is
where it's normally run a lot - it normally reads from an overlay file
and thus not from disk.
Except if you are editing a part in which case the open part is an
overlay, but the "parent" (which is for whatever reason also linted) is
read from file. So if you have 1000 lines > 80 chars in the "parent"
file, and is typing in a part file you're in for a really bad time.
This CL should reduce the number of reads in the lint to 0.
Change-Id: Iac6c78f50add1bc7a411c0c244a181f5ca2ea25b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/411300
Reviewed-by: Samuel Rawlins <[email protected]>
Commit-Queue: Jens Johansen <[email protected]>1 parent f66ceaf commit fb3f263
File tree
2 files changed
+11
-5
lines changed- pkg/linter/lib/src/rules
2 files changed
+11
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
9 | 12 | | |
10 | 13 | | |
11 | 14 | | |
| |||
25 | 28 | | |
26 | 29 | | |
27 | 30 | | |
28 | | - | |
| 31 | + | |
29 | 32 | | |
30 | 33 | | |
31 | 34 | | |
32 | 35 | | |
33 | 36 | | |
34 | 37 | | |
| 38 | + | |
35 | 39 | | |
36 | | - | |
| 40 | + | |
37 | 41 | | |
38 | 42 | | |
39 | 43 | | |
40 | | - | |
| 44 | + | |
| 45 | + | |
41 | 46 | | |
42 | 47 | | |
43 | 48 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
161 | 161 | | |
162 | 162 | | |
163 | 163 | | |
| 164 | + | |
| 165 | + | |
164 | 166 | | |
165 | 167 | | |
166 | 168 | | |
| |||
170 | 172 | | |
171 | 173 | | |
172 | 174 | | |
173 | | - | |
174 | 175 | | |
175 | 176 | | |
176 | 177 | | |
| |||
0 commit comments