The eol_at_end_of_file lint reads file content from disk and can slow down linting #59704
Labels
analyzer-linter
Issues with the analyzer's support for the linter package
area-analyzer
Use area-analyzer for Dart analyzer issues, including the analysis server and code completion.
P3
A lower priority bug or feature request
Splitting this out of #55281 (comment) so it doesn't get lost.
This lint reads the content in a way that appears that it can hit the disk and can be quite slow when analyzing a lot of files (or a large library):
sdk/pkg/linter/lib/src/rules/eol_at_end_of_file.dart
Line 38 in 33bdacc
One simple option suggested by @bwilkerson was:
And @scheglov:
I had a quick look at this, but I am a little confused by
LinterContext.definedUnit
because it seems like there is code that passes each individual unit in for it. For example this call here happens inside a loop for all units within a library (calledcurrentUnit
):sdk/pkg/analysis_server/lib/src/services/correction/bulk_fix_processor.dart
Line 293 in 0d72db1
And then
currentUnit
is passed asdefiningUnit
:sdk/pkg/analysis_server/lib/src/services/correction/bulk_fix_processor.dart
Line 557 in 0d72db1
So I wonder whether
definingUnit
could just be rename and repurposed ascurrentUnit
or whether any lints really do need/want the defining unit?The text was updated successfully, but these errors were encountered: