Closed Bug 1813186 Opened 2 years ago Closed 23 days ago

Add lint rules for newly added string resources

Categories

(Fenix :: General, task, P3)

All
Android
task

Tracking

(firefox131 fixed)

RESOLVED FIXED
131 Branch
Tracking Status
firefox131 --- fixed

People

(Reporter: boek, Assigned: gl)

References

(Blocks 1 open bug)

Details

(Whiteboard: [fxdroid])

Attachments

(4 files)

From github: https://github.com/mozilla-mobile/fenix/issues/7210.

I know very little of the current technical infrastructure, but I couldn't help noticing that sometimes strings land with the wrong apostrophe, and that's manually caught by Delphine during review.

Would it be possible to automate that kind of checks via tests?

CC @Delphine @Pike

┆Issue is synchronized with this Jira Task

Change performed by the Move to Bugzilla add-on.

Assignee: nobody → gl

Since you assigned yourself to to https://github.com/mozilla-mobile/fenix/issues/26645 I thought I would tag you here so you wouldn't lose it :)

Thanks! This is very much appreciated.

Severity: -- → S4
Priority: -- → P1
Whiteboard: [fxdroid]

I'm trying to remember why I made this a P1; I think it was because I assumed it was actively in progress.

:gl, is that accurate? Or should we move this to a lower priority? (and drop it from the "up next" column in our kanban board?)

Flags: needinfo?(gl)
Severity: S4 → N/A
Type: enhancement → task

(In reply to Joe M [:jmahon] from comment #3)

I'm trying to remember why I made this a P1; I think it was because I assumed it was actively in progress.

:gl, is that accurate? Or should we move this to a lower priority? (and drop it from the "up next" column in our kanban board?)

This should be a much lower priority. I felt like you moved this into the board simply because it was assigned, but beyond that this is not urgent.

Flags: needinfo?(gl)
Priority: P1 → P3
Status: NEW → ASSIGNED
Summary: Add tests to check for straight quotes in strings → Add lint rules for newly added string resources

This is the linter I'm currently using in android-l10n.

Checks:

  • Typography: warn when ', ", and ... (instead of ) are used.
  • Hard-coded brand names (provided in this config).

For other formats, I have checks that force a comment to include references to the variables in the string, to make sure the developer explains what replaces the variables, i.e.

  • Parse a string for placeables (%s, %1$s, etc.).
  • Check the comment for the same placeables.

All these checks require a list of exceptions, to work around actual exceptions (e.g. HTML code with straight quotes) or just legacy strings.

This ticket is about adding a linter to catch all the issues that comes up with adding new string resources.

For the monorepo migration, we will be introducing a bit of a delay before strings are exported to the android-l10n repository. Strings need to make their way to gecko-dev before they are extracted via a GitHub actions to the android-l10n repository. This means that strings need to land in autoland, make their way into central and then synced into the GitHub mirror before they are exported to the android-l10n repo.

As a result, we want to have a linter in place to catch problems earlier to reduce the number of issues that will be caught days later.

Attachment #9419191 - Attachment description: WIP: Bug 1813186 - Add lint rules for newly added string resources → WIP: Bug 1813186 - Add lint rules for string resources
Attachment #9419191 - Attachment description: WIP: Bug 1813186 - Add lint rules for string resources → Bug 1813186 - Part 1: Add lint rules for string resources
  • Add string lint ignores to exclude imported l10n paths and static string files in Fenix, Focus and Android Components.
See Also: → 1882087
Attachment #9419191 - Attachment description: Bug 1813186 - Part 1: Add lint rules for string resources → WIP: Bug 1813186 - Part 1: Add lint rules for string resources
Attachment #9419505 - Attachment description: Bug 1813186 - Part 2: Adds string lint ignores to exclude imported l10n paths and static string files → WIP: Bug 1813186 - Part 2: Adds string lint ignores to exclude imported l10n paths and static string files
Attachment #9419506 - Attachment description: Bug 1813186 - Part 3: Use the correct quotation character for existing strings → WIP: Bug 1813186 - Part 3: Use the correct quotation character for existing strings
Attachment #9419507 - Attachment description: Bug 1813186 - Part 4: Suppress string lint errors for existing strings that are part of the exception → WIP: Bug 1813186 - Part 4: Suppress string lint errors for existing strings that are part of the exception
Attachment #9419191 - Attachment description: WIP: Bug 1813186 - Part 1: Add lint rules for string resources → Bug 1813186 - Part 1: Add lint rules for string resources
Attachment #9419505 - Attachment description: WIP: Bug 1813186 - Part 2: Adds string lint ignores to exclude imported l10n paths and static string files → Bug 1813186 - Part 2: Adds string lint ignores to exclude imported l10n paths and static string files
Attachment #9419506 - Attachment description: WIP: Bug 1813186 - Part 3: Use the correct quotation character for existing strings → Bug 1813186 - Part 3: Use the correct quotation character for existing strings
Attachment #9419507 - Attachment description: WIP: Bug 1813186 - Part 4: Suppress string lint errors for existing strings that are part of the exception → Bug 1813186 - Part 4: Suppress string lint errors for existing strings that are part of the exception
Pushed by gluong@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/a87614b564f6 Part 1: Add lint rules for string resources r=android-reviewers,tthibaud https://hg.mozilla.org/integration/autoland/rev/5dffc3ff5ecb Part 2: Adds string lint ignores to exclude imported l10n paths and static string files r=android-reviewers,tthibaud https://hg.mozilla.org/integration/autoland/rev/ac6fbfd54594 Part 3: Use the correct quotation character for existing strings r=android-reviewers,tthibaud https://hg.mozilla.org/integration/autoland/rev/6b0ece9382f6 Part 4: Suppress string lint errors for existing strings that are part of the exception r=android-reviewers,tthibaud
Regressions: 1915043
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: