Closed Bug 1596896 Opened 6 years ago Closed 4 years ago

Should have a linter that errors on short fluent identifiers

Categories

(Developer Infrastructure :: Lint and Formatting, task)

task
Not set
normal

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 1691763

People

(Reporter: Gijs, Unassigned)

Details

Attachments

(1 file)

Per the fluent guidelines, fluent identifiers should be reasonably unique. Because this can be a bit of a judgment call, and to help detect this automatically, it would be useful to have lint rules that automatically flag overly short identifiers.

As a strawman, I suggest we flag an identifier if either of these are true:

  • no dashes (-) in the name
  • 10 characters or shorter.

I haven't checked how many current identifiers satisfy these criteria, and doing so may produce a more useful limit - especially the number 10 is kind of arbitrary. For the dashes, given that in English (unlike Dutch and various other languages) you can't just slap nouns one after the other and make up words, it seems unlikely that you could have a sufficiently unique name involving only one word.

Basically, I'd like to automate more of the fluent-reviewer checks, both to help with education of people writing fluent, and to help reduce the reliance on manual review by humans which is liable to missing things.

Technical details:

If we can integrate this into the l10n linter that'd be best. This ends up in https://searchfox.org/mozilla-central/source/third_party/python/compare-locales/compare_locales/lint/linter.py, which doesn't have any hooks for this as of now.

I have a handful ideas of how to implement this, and I like none of them so far.

Something something lint_full_entity, probably, but that's twice as many unknowns than knowns.

There are about 90 strings in Firefox with identifiers shorter than 10 characters. The main offender is about:networking, and there's a bug on file to fix that.

Would it be reasonable to expand this to check that only lowercase characters are used? Unfortunately that would require exceptions (I think per file would be enough). The only legitimate case is policies-descriptions.ftl, but we have a bunch of those in other files (30, main offender about:dialog with 14).

(In reply to Francesco Lodolo [:flod] from comment #2)

Would it be reasonable to expand this to check that only lowercase characters are used? Unfortunately that would require exceptions (I think per file would be enough).

I think so, though also I wouldn't want the perfect to be the enemy of the good etc. Anything is better than nothing (which is where we are right now). :-)

Attached file Full list
Flags: needinfo?(zbraniecki)
Status: NEW → RESOLVED
Closed: 4 years ago
Flags: needinfo?(zbraniecki)
Resolution: --- → DUPLICATE
Product: Firefox Build System → Developer Infrastructure
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: