-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Labels
L-performanceLint: performanceLint: performanceT-engineType: related with engine (or internal)Type: related with engine (or internal)good first issueGood for newcomersGood for newcomers
Description
Description
Currently, tlin's linting process handles .gno files by converting them into temporary .go files (see, prepareFile function) and parsing them one by one. This file-by-file approach has several drawbacks:
- Reduced Accuracy:
- Parsing files in isolation can miss important cross-file references and package-level contexts.
- Performance Overhead:
- Repeatedly creating temporary
.gofiles and parsing each file separately is inefficient. - Analyzing multiple
.gnofiles within the same package context would reduce parsing overhead and improve overall speed.
- Repeatedly creating temporary
Proposed Solution
-
Create a Temporary Directory Structure
- Instead of generating a single
.gotemp file per.gnofile, copy or convert all.gnofiles in a package into a temporary directory, renaming them with a .go extension. - Preserve the directory/package structure so golangci-lint can parse them as it would standard go files.
- Instead of generating a single
-
Parse Using Package-Level APIs
- Switch from
go/parser.ParseFile(file-centric) togo/parser.ParseDiror similar package-level APIs to load all files in a directory at once. - This allows cross-file symbol resolution and more accurate AST analysis.
- Switch from
-
Maintain
nolintand Ignore Logic- Ensure that
nolintcomments and path ignores still apply correctly across multiple files within the package.
- Ensure that
Note
Before proceeding with the task, benchmarks related to current file processing and parsing should be added first. Then the results should be compared after the modifications.
Metadata
Metadata
Assignees
Labels
L-performanceLint: performanceLint: performanceT-engineType: related with engine (or internal)Type: related with engine (or internal)good first issueGood for newcomersGood for newcomers