Skip to content

lint: add --config CLI argument for custom config path#149

Merged
reidbaker merged 2 commits into
flutter:mainfrom
reidbaker:linter-custom-config-path
May 25, 2026
Merged

lint: add --config CLI argument for custom config path#149
reidbaker merged 2 commits into
flutter:mainfrom
reidbaker:linter-custom-config-path

Conversation

@reidbaker

Copy link
Copy Markdown
Contributor

Adds the -c / --config CLI argument to dart_skills_lint to support custom configuration file paths. Includes precedence logic ensuring --ignore-config overrides --config, error handling for missing/malformed configuration files, and complete unit/integration tests.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a --config (or -c) option to the dart_skills_lint CLI, allowing users to specify a custom configuration file path. It updates the configuration loading logic to handle FileSystemException and other potential errors gracefully, and adds comprehensive integration tests to verify the new option's behavior. A review comment suggests improving the error logging for FileSystemException to avoid printing (null) if the file path is not available.

Comment on lines +251 to +253
} on FileSystemException catch (e) {
_log.severe('Error: ${e.message} (${e.path})');
return null;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

If e.path is null, printing (${e.path}) will output (null). It is safer to conditionally append the path only when it is non-null to keep the error message clean.

Suggested change
} on FileSystemException catch (e) {
_log.severe('Error: ${e.message} (${e.path})');
return null;
} on FileSystemException catch (e) {
final pathSuffix = e.path != null ? ' (${e.path})' : '';
_log.severe('Error: ${e.message}$pathSuffix');
return null;

@reidbaker reidbaker merged commit fa3c563 into flutter:main May 25, 2026
13 checks passed
@reidbaker reidbaker deleted the linter-custom-config-path branch May 25, 2026 20:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant