Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TypeSpecValidation] Enable per-rule suppressions #31862

Open
mikeharder opened this issue Dec 12, 2024 · 1 comment
Open

[TypeSpecValidation] Enable per-rule suppressions #31862

mikeharder opened this issue Dec 12, 2024 · 1 comment
Assignees

Comments

@mikeharder
Copy link
Member

mikeharder commented Dec 12, 2024

We want to enable per-rule suppressions. This raises a number of complex issues:

  1. What is the scope of a suppression? A "rule", or perhaps a "sub-rule" since existing rules like FolderStructure are actually many individual checks (with different error messages)? If the scope is limited to a "rule", then any rule that wants to be suppressable must be scoped to a single check.
  2. Should all rules be suppressable? Or should it be opt-in? If opt-in, should it be an explicit flag on the rule, or just part of the rule implementation?
  3. Currently, rules run in order, cannot be suppressed, and fail-fast. This allows later rules to assume the spec is valid per earlier rules, and prevents users from getting confusing error messages if their spec is totally invalid. If earlier rules are be suppressed, later rules may fail with confusing error messages or exceptions.
@mikeharder mikeharder self-assigned this Dec 12, 2024
@mikeharder mikeharder moved this from 🤔 Triage to 🐝 Dev in Azure SDK EngSys 🚢🎉 Dec 12, 2024
@mikeharder mikeharder changed the title [TypeSpecValidation] Replace mock tests with in-proc end-to-end tests [TypeSpecValidation] Refactor to prepare for per-rule suppressions Dec 13, 2024
@mikeharder mikeharder changed the title [TypeSpecValidation] Refactor to prepare for per-rule suppressions [TypeSpecValidation] Enable per-rule suppressions Dec 13, 2024
@mikeharder
Copy link
Member Author

mikeharder commented Dec 16, 2024

Potential Option: Migrate tool to use ESLint as a backend, to "analyze file tspconfig.yaml", which can do arbitrary things like run "tsp compile" in response to elements in config like "typespec-autorest". The tsv frontend would just be responsible for finding the tspconfig.yaml file(s) to "lint", and checking the very basics like using tspconfig.yml instead of tspconfig.yaml.

The tsv tool currently has some code to handle running directly against a .Shared folder without a tspconfig.yaml, however:

  1. It doesn't work in practice (fails on contoso)
  2. Get-TypeSpec-Folders.ps1 only returns folders containing tspconfig.yaml (plus possible typos), so it's unlike a user would ever run tsv directly on a shared folder.

So, it should be sufficient for the eslint-based TSV to use tspconfig.yaml as it's entry point to all other checks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

No branches or pull requests

1 participant