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
{{ message }}
This repository was archived by the owner on Mar 24, 2026. It is now read-only.
When running custom_lint in CI/CD pipelines on pull requests, the tool currently analyzes entire packages even when only a few files have changed. This results in unnecessary analysis time and resource usage.
Example scenario:
A PR changes 28 files across 2 packages
Each package contains 125+ files
custom_lint analyzes all 250+ files instead of just the 28 changed files
Analysis takes ~2 minutes when it could potentially take 20-30 seconds
Proposed Solution
Add CLI support for analyzing specific files, similar to how dart analyze works:
# Analyze specific files only
dart run custom_lint lib/file1.dart lib/file2.dart test/file3.dart
# Or via stdin for large file listsecho"lib/file1.dart\nlib/file2.dart"| dart run custom_lint --stdin-files
Use Case
This feature is particularly valuable for:
CI/CD PR checks - Only lint changed files in pull requests
Pre-commit hooks - Only lint staged files
IDE integrations - Faster feedback on file save
Incremental analysis - Large monorepos with frequent small changes
Current Workaround Limitations
The existing LintRule.filesToAnalyze property filters which files to analyze within a package, but:
❌ Cannot limit analysis to specific file paths
❌ Only supports glob patterns for file matching
❌ Still requires analyzing the entire package structure
❌ No way to pass explicit file list via CLI
Using dart analyze as a fallback:
❌ Doesn't run custom lint rules
❌ Loses the value of custom_lint entirely
Proposed API
CLI Option
dart run custom_lint --files lib/a.dart,lib/b.dart,test/c.dart
stdin Support (for large file lists)
dart run custom_lint --stdin-files < changed_files.txt
Environment Variable (current melos pattern)
CUSTOM_LINT_FILES="lib/a.dart,lib/b.dart" dart run custom_lint
Implementation Notes
This would likely require:
Extending the CLI argument parser to accept file paths
Modifying CustomLintWorkspace.fromPaths() to support explicit file filtering
Ensuring analysis context still loads necessary package dependencies
Maintaining compatibility with existing glob-based filtering
Benefits
⚡ Faster CI/CD - 60-90% reduction in analysis time for small PRs
💰 Cost savings - Reduced compute time in cloud CI runners
✅ Better DX - Faster feedback loops for developers
🎯 Targeted analysis - Only analyze what changed
Related Issues
This would complement the existing --watch mode for hot-reload
Similar to how dart analyze and ESLint support file-specific analysis
Aligns with incremental analysis patterns in other linters
Environment
Tested on custom_lint version: 0.8.0
Flutter monorepo with Melos
Current workaround: Package-based filtering (sub-optimal) -- better than nothing
Problem Statement
When running
custom_lintin CI/CD pipelines on pull requests, the tool currently analyzes entire packages even when only a few files have changed. This results in unnecessary analysis time and resource usage.Example scenario:
custom_lintanalyzes all 250+ files instead of just the 28 changed filesProposed Solution
Add CLI support for analyzing specific files, similar to how
dart analyzeworks:Use Case
This feature is particularly valuable for:
Current Workaround Limitations
The existing
LintRule.filesToAnalyzeproperty filters which files to analyze within a package, but:Using
dart analyzeas a fallback:Proposed API
CLI Option
stdin Support (for large file lists)
dart run custom_lint --stdin-files < changed_files.txtEnvironment Variable (current melos pattern)
CUSTOM_LINT_FILES="lib/a.dart,lib/b.dart" dart run custom_lintImplementation Notes
This would likely require:
CustomLintWorkspace.fromPaths()to support explicit file filteringBenefits
Related Issues
--watchmode for hot-reloaddart analyzeand ESLint support file-specific analysisEnvironment
custom_lintversion: 0.8.0