Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f9165c43e8
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if !def_id.is_local() { | ||
| return; | ||
| } |
There was a problem hiding this comment.
Lint cross-crate calls instead of skipping non-local defs
Returning early on !def_id.is_local() means the lint never inspects calls to functions/methods defined in other crates, so when just argument-comment-lint runs per package it will miss argument-comment violations at crate boundaries (for example, a codex-cli call into codex-core). That significantly weakens enforcement of the new convention across the workspace and can let mismatched or missing /*param=*/ comments slip through in normal usage.
Useful? React with 👍 / 👎.
ce9a5a6 to
4e594bc
Compare
2a3f2fc to
b0b343c
Compare
etraut-openai
left a comment
There was a problem hiding this comment.
Thanks for adding this!
Why
Call sites like
foo(false)andbar(None)are often a sign that the API is not carrying enough meaning on its own. Contributors should prefer self-documenting designs such as enums, named methods, and newtypes when that is practical.This PR adds a repo-local lint as a fallback for the places where a larger API refactor would be too heavy. The team also preferred a lighter comment shape than
clang-tidy'sbugprone-argument-comment, so the convention here is exact/*param*/comments rather than/*param=*/.What changed
tools/argument-comment-lintargument_comment_mismatch, which validates that an existing/*param*/comment matches the resolved parameter nameuncommented_anonymous_literal_argument, which targets opaque positional literals such asNone, booleans, and numeric literals/*param*/formtools/argument-comment-lint/run.sh, ajust argument-comment-lintentrypoint, and defaultCARGO_INCREMENTAL=0in the wrapper to avoid the current nightly Dylint incremental-compilation ICE in local runsAGENTS.mdguidance that pushes contributors toward better API design first and treats argument comments as the fallback when a smaller compatibility-preserving change is more appropriateExamples
Preferred when a positional literal still needs help at the callsite:
Rejected when the comment name is wrong:
Still intentionally allowed without comments for self-descriptive literals:
Verification
cargo testintools/argument-comment-lintbash -n tools/argument-comment-lint/run.shStack created with Sapling. Best reviewed with ReviewStack.