Skip to content

Warn if analysis options are included from a file outside the package - #4855

Open
sigurdm wants to merge 2 commits into
dart-lang:masterfrom
sigurdm:warn_analysis_options_include
Open

Warn if analysis options are included from a file outside the package#4855
sigurdm wants to merge 2 commits into
dart-lang:masterfrom
sigurdm:warn_analysis_options_include

Conversation

@sigurdm

@sigurdm sigurdm commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Fixes #4853.

Adds AnalysisOptionsValidator to warn when analysis_options.yaml (or any other analysis options file in the package) includes a configuration file outside the package directory.

@sigurdm
sigurdm requested review from jonasfj and szakarias August 6, 2026 13:04
Comment on lines +14 to +19
/// Validates that `analysis_options.yaml` (and other analysis options files)
/// do not include configuration from a local file outside the package.
///
/// Including files outside the package causes analysis errors on `pub.dev`
/// and for consumers because those external files are not included in the
/// published archive.

@jonasfj jonasfj Aug 12, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It doesn't create issues for consumers.

It is true that the package is not self contained.

It doesn't necessarily create analysis issues on pub.dev, only if the included thing disabled lints / errors. Not if it just add more lints.


This could just as well be a lint in the analyzer. which is triggered whenever:

  • pubspec.yaml contains version: and,
  • pubspec.yaml does not contain publish_to: none.

Then it would pretty much only affect people who write packages.

Granted, I doubt we could convince people to land this as a lint :D

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.

Warn on publish if analysis options are excluded from local file outside the package.

2 participants