You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As an opt-in lint, clippy could detect when identifiers (variable/function/struct) names don't spell-check. This feature would be extendable per-project with a glossary/jargonfile, so that the project could define terms for allowable identifiers.
For example, a physics simulation might define dx, fg, tau in their glossary. A process manager may instead define terms like pid, sigint, cwd. Both projects would get to benefit from a glossary that defines the terms of art in their domain, aiding newcomers in comprehension. Clippy would automatically catch not just typoes, but jargon that might be unfamiliar to some contributors to the project.
Example code
let reciever = create_receiver();// LINT: variable name is misspelledfnkill_pid(process_id:int){ ...}// LINT: function name contains jargon "pid" which is not defined in glossarylet diameter = r_ball*tau;// okay because r and tau are defined in our glossary
Notes
To be useful, PascalCase and snake_case identifiers would need to be checked per-word-part. That way new_pid does not need a separate definition from pid.
The glossary could live in Cargo.toml or in some other file - it should be encouraged to also define the terms in use.
I'm not sure where the base wordlist would come from - would it be shipped with clippy?
Single-letter variables like i, j, x, n could be in the default wordlist? Or could just be readily-available to copy-paste into your configuration.
Possible Cargo.toml syntax:
[marker.glossary.terms]
pid = "A process identifier. This is a non-negative integer used to uniquely identify a running process."cwd = "The current working directory of a process."
The text was updated successfully, but these errors were encountered:
Lint explanation
As an opt-in lint, clippy could detect when identifiers (variable/function/struct) names don't spell-check. This feature would be extendable per-project with a glossary/jargonfile, so that the project could define terms for allowable identifiers.
For example, a physics simulation might define
dx
,fg
,tau
in their glossary. A process manager may instead define terms likepid
,sigint
,cwd
. Both projects would get to benefit from a glossary that defines the terms of art in their domain, aiding newcomers in comprehension. Clippy would automatically catch not just typoes, but jargon that might be unfamiliar to some contributors to the project.Example code
Notes
new_pid
does not need a separate definition frompid
.i
,j
,x
,n
could be in the default wordlist? Or could just be readily-available to copy-paste into your configuration.Possible Cargo.toml syntax:
The text was updated successfully, but these errors were encountered: