Bug 2053531 - Add nimbus-fml lint - #7563
Conversation
Adds a lint command covering feature metadata, descriptions, naming and feature design, and a `no-lint` field to silence lints per feature or per file. `validate` no longer reports feature metadata warnings; that's the lint command's job now.
| let mut raw = Vec::new(); | ||
| metadata::check_feature(feature, &mut raw); | ||
| documentation::check_feature(feature, &mut raw); | ||
| naming::check_feature(feature, &mut raw); | ||
| design::check_feature(feature, fm, &mut raw); |
There was a problem hiding this comment.
Adding these feels like something that could get missed when adding new linting files. Could it be at all viable to instead have the methods be on a trait? Then have the trait get impl'd on structs for each lint type, and have each section iterate through the types and call the appropriate methods?
freshstrangemusic
left a comment
There was a problem hiding this comment.
I agree with charlie about using a trait for lints and then we can have a Vec<Box<&dyn Linter>> or smth and call the lints from each member.
| let mut subject: Option<(&Option<String>, &String)> = None; | ||
|
|
||
| for finding in &report.findings { | ||
| let this = (&finding.module, &finding.subject); | ||
| if subject != Some(this) { |
There was a problem hiding this comment.
We're overloading subject here to be both a (module, subject) and just a finding.subject. Consider renaming subject for clarity.
| }) | ||
| .map_err(|e| { | ||
| CliError(format!( | ||
| "{e}\nA manifest has to be valid before it can be linted; run `nimbus-fml validate` for the details" |
There was a problem hiding this comment.
| "{e}\nA manifest has to be valid before it can be linted; run `nimbus-fml validate` for the details" | |
| "{e}\nA manifest has to be valid before it can be linted; run `nimbus-fml validate` for details" |
| pub struct Finding { | ||
| pub lint: &'static str, | ||
| pub level: LintLevel, | ||
| /// Set when the finding came from an imported manifest. |
|
|
||
| - A new API has been added to get the list of enrolled experiments and rollouts without instantiating a NimbusClient: `get_active_enrollments()`. ([#7560](https://github.com/mozilla/application-services/pull/7560)) | ||
|
|
||
| ### Nimbus FML |
There was a problem hiding this comment.
These can just be grouped under nimbus.
Adds a lint command covering feature metadata, descriptions, naming and feature design, and a
no-lintfield to silence lints per feature or per file.validateno longer reports feature metadata warnings; that's the lint command's job now.Pull Request checklist
[ci full]to the PR title.