Summary
--
I included fix safety in my draft of default rule criteria, but there's no
existing way to retrieve the safety of a fix. This PR is a quick draft of adding
this information to the `violation_metadata` attribute macro and then enforcing
its accuracy in our `test_contents` linter tests. The tests are failing here
because I wanted to gauge interest in adding this feature before adding all of
the proper attributes on the affected rules.
A couple of things I think we can do with this information:
- include it in the `ruff rule --output-format=json` (this would help my default
rules work)
- display it in our docs along with the fix availability
- enforce the presence of a `## Fix safety` section for rules with unsafe or
display-only fixes
It's a bit annoying to add all these attributes again, but at least this one has
a sensible default (`Applicability::Safe`), which will work for safe rules and
rules without fixes.
I went with a string attribute again to avoid requiring `Applicability` imports
everywhere, but it would also be nice to make the attribute more like:
```rust
#[violation_metadata(safety = Applicability::Safe)]
```
instead of the current:
```rust
#[violation_metadata(safety = "safe")]
```
Test Plan
--
Updated `test_contents` to fail if a diagnostic's attached fix is less safe than
its documented safety