Open Bug 1587477 Opened 5 years ago Updated 2 years ago

Add a linter to identify identifier misspellings

Categories

(Developer Infrastructure :: Lint and Formatting, task, P4)

Tracking

(Not tracked)

People

(Reporter: ehsan.akhgari, Unassigned)

References

Details

Examples of where this could have been useful: bug 1585058 and bug 1578304.

Priority: -- → P2
Assignee: nobody → bpostelnicu

What linters covers for this type of facility, As far as I know codespell comes close to this but It works only for English errors. I will like to work on this.

Requesting information from :sylvestre as :ahal is PTO till march.

Flags: needinfo?(sledru)

for coverity, andi is the expert :)

Flags: needinfo?(sledru) → needinfo?(bpostelnicu)
Assignee: bpostelnicu → nobody
Flags: needinfo?(bpostelnicu)
Priority: P2 → P4

Another example where this could have been useful: https://bugzilla.mozilla.org/show_bug.cgi?id=1714177.

And also: https://phabricator.services.mozilla.com/D114998.

We don't have to rely on Coverity for this, we could use something like https://github.com/aotaduy/eslint-plugin-spellcheck, or even write a custom analyzer which builds a DB of all identifiers, and checks if the new added one is likely a misspelling of an already existing identifier.

Or we could use codespell or typos.

Summary: Enable the coverity 'identifier_typo' checker as a lint on JS/Python on Phabricator/CI → Add a linter to identify identifier misspellings
See Also: → 1548485

Yeah was just about to say we have codespell already:
https://searchfox.org/mozilla-central/source/tools/lint/codespell.yml

But it only runs on a set of explicitly included directories which is why it didn't catch the error in bug 1714177. Transitioning it to an exclude list might be a good first step.

Bug 1548485 talks about enabling it for source files, but that appears to already be done. It's just enabling it across a wider set of directories that remains.

Dunno if it is worth the effort.
codespell can fix most of the issues but when there are ambiguities, we need a human.

Example:
aborte can be aborted, abort or aborts

but it could be good first bugs to learn workflows

(In reply to Sylvestre Ledru [:Sylvestre] from comment #7)

Dunno if it is worth the effort.
codespell can fix most of the issues but when there are ambiguities, we need a human.

Example:
aborte can be aborted, abort or aborts

but it could be good first bugs to learn workflows

Maybe not super useful for docs and comments, but for identifiers it could be (we already have at least three bugs linked here that would have been prevented, two of which even required uplift to Beta).

Product: Firefox Build System → Developer Infrastructure
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.