-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
ci: add clippy
results to GitHub code scans
#9318
base: main
Are you sure you want to change the base?
Conversation
7cf9a6f
to
1ebb8df
Compare
This pull request sets up GitHub code scanning for this repository. Once the scans have completed and the checks have passed, the analysis results for this pull request branch will appear on this overview. Once you merge this pull request, the 'Security' tab will show more code scanning analysis results (for example, for the default branch). Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results. For more information about GitHub code scanning, check out the documentation. |
Because we already gate PRs on clippy, I don't think this would ever catch anything? Am I missing something? I guess for new versions of clippy with new lints? But we configure crates to inherit the workspace lints, which allows all clippy rules by default, and then we only deny select ones. In general, I'd rather catch these things at the time they're authored (ie in the PR) than after the fact on the next Tuesday. But I feel like I might be missing something here... |
This code scan is configured to run on every PR and on Tuesdays. The results of code scans during a PR should be available in the PR itself (docs... IIUC). The results of code scans otherwise (on This PR is not about adding any new scan functionality, it's about integrating better with GitHub:
|
One other comment: my recollection is that we limit our clippy lints to allow or deny only because of the lack of visibility into warnings. My take is that, beyond just the "use the nice tools better" argument, if we wanted to be more picky and warn (but not deny) in more cases, this would be the way to do that. |
I share similar confusion to @fitzgen about the state as-is here in the sense that we're "guaranteed clippy clean" on all PRs because we Now better surfacing errors in CI to PRs, that sounds great! Do you have an example of what that might look like? Ideally we could surface things like normal compile errors too, but I'm not sure how it works. Or could you perhaps enable a new clippy lint on this PR and we can see what the UI looks like? (assuming enabling a new clippy lint will have lots of errors) For exploring this a bit, it looks like the links you have (e.g. Code Scanning) are unfortunately only available to maintainers. (it's a 404 for me). I think that means that the dashboard access wouldn't be accessible to contributors-at-large and instead just maintainers? I can also expand a bit more on the Clippy bits we have in that you're right that we allow-by-default all clippy lints and then selectively enable them. One of the purposes for this is that it's not always the easiest to get PRs from contributors that run So overall I'd love to get a better UI for surfacing CI errors into PRs, but I don't think that some of the other benefits you've outlined will be as applicable to us? |
On the clippy front I can also expand a bit in that it's fine to enable more clippy lints. The only caveat is that it'll want to have some motivation for why it's applicable to Wasmtime or general agreement that Clippy's suggestions are "basically alwasy right" and not accidentally reducing the quality fo the code. For example #9025 enabled a clippy lint for the whole workspace and #9209 enabled a lint for just one tree of modules. This reminds me that we should document this policy... |
Inspired by bytecodealliance#9318 I realized we haven't actually documented anything about compiler warnings or Clippy warnings in our contributor docs, so I have aspired to do so in this commit. My goal is to reflect the current state of the repository in this documentation, not add anything new.
+1 to what Alex said. If we can make clippy errors more visible and more easily parseable in CI failures, that's great. But if this makes them only visible to maintainers, that's not really gonna work. And the cron-job aspect is something we shouldn't need. |
Inspired by #9318 I realized we haven't actually documented anything about compiler warnings or Clippy warnings in our contributor docs, so I have aspired to do so in this commit. My goal is to reflect the current state of the repository in this documentation, not add anything new.
Github actions supports problem matches to parse compiler errors and show then inline in the Files tab of a PR. |
Any suggestions on a clippy lint to enable to check the GitHub PR interaction? |
I randomly selected |
In the past, we've overlooked clippy warnings that get lost in the CI build logs. This change would collect all of those warnings, put them in [SARIF] form, and list them in GitHub's code scanning view. I recently added this to `ittapi` and it looks like this: [Code Scanning]. This means warnings and errors will show up on the security tab as a notification; the UI allows one to dismiss the warnings. There might be some integration with PRs but I haven't experimented with that. I configured this to also run periodically (every Tuesday night); we can remove that if we only want commits to `main`, e.g. If we do adopt this, we should think about what to do with the `clippy` job in `main.yml`--does it stay or go? [SARIF]: https://sarifweb.azurewebsites.net [Code Scanning]: https://github.com/intel/ittapi/security/code-scanning?query=branch%3Amaster+
I think what may be going on here is that, since warnings are upgraded to errors, the clippy task will just fail. |
In the past, we've overlooked clippy warnings that get lost in the CI build logs. This change would collect all of those warnings, put them in SARIF form, and list them in GitHub's code scanning view. I recently added this to
ittapi
and it looks like this: Code Scanning. This means warnings and errors will show up on the security tab as a notification; the UI allows one to dismiss the warnings. There might be some integration with PRs but I haven't experimented with that.I configured this to also run periodically (every Tuesday night); we can remove that if we only want commits to
main
, e.g. If we do adopt this, we should think about what to do with theclippy
job inmain.yml
--does it stay or go?