Skip to content

Better handling of flutter workspace by adding new config parameters#168

Open
paulanatoleclaudot-betclic wants to merge 2 commits intoWorkiva:masterfrom
paulanatoleclaudot-betclic:add_workspace_global_parameters
Open

Better handling of flutter workspace by adding new config parameters#168
paulanatoleclaudot-betclic wants to merge 2 commits intoWorkiva:masterfrom
paulanatoleclaudot-betclic:add_workspace_global_parameters

Conversation

@paulanatoleclaudot-betclic

Motivation

This PR addresses #167 by adding support for workspace-level configuration in dart_dependency_validator.yaml files.

When working with Dart pub workspaces (monorepos), users often need to apply the same configuration across multiple packages. For example, certain packages like camera_android might need to be ignored across all workspace sub-packages, or pinned dependencies might need to be allowed workspace-wide.

Previously, there was no way to configure these settings globally from the workspace root - each sub-package required its own configuration file with duplicated settings. This PR introduces workspace-aware configuration parameters that allow for:

  1. Global package ignoring - Define packages to ignore across all sub-packages from the workspace root
  2. Selective package validation - Skip validation for specific workspace packages
  3. Configuration inheritance - Sub-packages automatically inherit ignore and allow_pins settings from the workspace root unless they have their own local configuration file

This makes it much easier to manage dependency validation in large monorepos while maintaining flexibility for packages that need custom configuration.

Changes

Configuration (lib/src/pubspec_config.dart)

  • Added workspaceGlobalIgnore field - list of packages to ignore in all workspace sub-packages
  • Added workspacePackageIgnore field - list of workspace packages to skip during validation
  • Updated generated code in pubspec_config.g.dart to serialize/deserialize new fields

Validation Logic (lib/src/dependency_validator.dart)

  • Modified checkPackage() to accept inheritedWorkspaceGlobalIgnore and inheritedAllowedPins parameters
  • Added logic to detect when a local config file exists (hasLocalFileConfig)
  • Implemented inheritance behavior:
    • Sub-packages without local config files inherit workspaceGlobalIgnore and allowPins from workspace root
    • Sub-packages with local config files use only their local configuration (local config takes precedence)
  • Added filtering to skip packages listed in workspacePackageIgnore during workspace traversal

Documentation

  • README.md: Added comprehensive "Workspace Configuration" section with examples
  • example/example.md: Updated configuration examples to include new workspace parameters
  • Documented that local package config files always take precedence over workspace configuration

Tests (test/workspace_test.dart)

  • Added test group for workspace_global_ignore functionality (3 tests)
  • Added test group for workspace_package_ignore functionality (1 test)
  • Added test group for allow_pins inheritance (2 tests)
  • Added test group for configuration precedence (2 tests)
  • All 19 workspace tests pass successfully

Testing/QA Instructions

The changes are well-covered by automated tests. The passing CI test suite suffices.

To manually verify the new functionality:

  1. Create a workspace with a root dart_dependency_validator.yaml:
workspace_global_ignore:
  - camera_android
allow_pins: true
workspace_package_ignore:
  - experimental_package
  1. Run dart run dependency_validator from the workspace root
  2. Verify that:
    • camera_android is ignored in all sub-packages
    • experimental_package validation is skipped
    • Sub-packages without their own config file inherit the allow_pins setting
    • Sub-packages with their own config file use only their local settings

@paulanatoleclaudot-betclic
Copy link
Author

Up :)

@paulanatoleclaudot-betclic paulanatoleclaudot-betclic force-pushed the add_workspace_global_parameters branch from e474d3c to 14c613f Compare February 19, 2026 13:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments