Open Bug 2001134 Opened 2 months ago Updated 1 month ago

Rename variable "file" in Perfherder metrics to avoid shadowing Python built-in

Categories

(Testing :: mozperftest, enhancement)

enhancement

Tracking

(Not tracked)

People

(Reporter: myeongjun.ko, Unassigned)

References

Details

(Keywords: good-first-bug, Whiteboard: [fxp])

The Perfherder metrics defines a variable named file[0] when writing the perfherder JSON artifact. Since file is a built-in function in Python, overriding it is discouraged and can lead to confusion or subtle bugs.
This variable should be renamed to something more appropriate.

[0]
https://searchfox.org/firefox-main/rev/f8f007a94eb7b4c6f7168cefeb2555a3bdba04c1/python/mozperftest/mozperftest/metrics/perfherder.py#158

Flags: needinfo?(myeongjun.ko)

Thanks for the comment!
Yes, the old file() built-in is gone in Python 3.
Even today, though, file is still a commonly used identifier in Python code, so using it here can be a bit confusing or easy to misread. Renaming it to something more descriptive would simply improve readability.
Thanks again for taking a look.

Flags: needinfo?(myeongjun.ko)
Whiteboard: [fxp]
You need to log in before you can comment on or make changes to this bug.