Closed Bug 1708462 Opened 4 years ago Closed 4 years ago

Warn on new usages of OS.File, suggest using IOUtils instead

Categories

(Developer Infrastructure :: Source Code Analysis, enhancement)

enhancement

Tracking

(firefox92 fixed)

RESOLVED FIXED
92 Branch
Tracking Status
firefox92 --- fixed

People

(Reporter: marco, Assigned: Gijs)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

We are getting rid of OS.File usage during startup (bug 986145). Over time, we might want to get rid of OS.File completely in favor of IOUtils.
We could introduce a new linter that warns about new usages of OS.File and suggests using IOUtils instead.

Summary: Warn on new usages of OS.utils, suggest using IOUtils instead → Warn on new usages of OS.File, suggest using IOUtils instead

I know a little bit about linters - is there an example of a linter that examines diffs and only complains about new instances? Or do we just write a linter and add exceptions for all the known cases or something?

Flags: needinfo?(mcastelluccio)

(In reply to :Gijs (he/him) from comment #1)

I know a little bit about linters - is there an example of a linter that examines diffs and only complains about new instances? Or do we just write a linter and add exceptions for all the known cases or something?

We don't have linters that examine diffs AFAIK, we rely on the review bot for that.

Two options:

  • write a linter and don't add exceptions for the known cases. Since the level will be "warning", developers won't be forced to fix the issues found by it. "mach lint --outgoing` will only analyze touched files anyway, so the noise will be relatively low in this case;
  • write a linter and add exceptions for the known cases.
Flags: needinfo?(mcastelluccio)

Gijs, still interested?

Flags: needinfo?(gijskruitbosch+bugs)

(In reply to Marco Castelluccio [:marco] from comment #3)

Gijs, still interested?

Yes. Unfortunately, it would appear that there are so many uses still in the codebase (over 1000) that it's probably not yet the right time to add a linter for this. Barret, what do you think?

Flags: needinfo?(gijskruitbosch+bugs) → needinfo?(brennie)

I think adding a linter set to warning could be a good idea for now. Then when we start burning down the remaining OS.File usage, we can swap it over to a hard error.

Flags: needinfo?(brennie)
Assignee: nobody → gijskruitbosch+bugs
Status: NEW → ASSIGNED
Pushed by gijskruitbosch@gmail.com: https://hg.mozilla.org/integration/autoland/rev/3d7d04fa5cc4 add warning level linter for OS.File use, r=Standard8
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → 92 Branch
Product: Firefox Build System → Developer Infrastructure
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: