Page MenuHomePhabricator

Remove the "preg_quote()" lint rule and update the "__CLASS__" lint rule
ClosedPublic

Authored by epriestley on Feb 26 2020, 4:58 PM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Mar 19, 3:06 PM
Unknown Object (File)
Feb 13 2024, 2:02 PM
Unknown Object (File)
Feb 11 2024, 2:28 AM
Unknown Object (File)
Feb 3 2024, 11:47 PM
Unknown Object (File)
Dec 21 2023, 8:29 AM
Unknown Object (File)
Nov 30 2023, 2:27 AM
Unknown Object (File)
Nov 25 2023, 11:09 PM
Unknown Object (File)
Nov 16 2023, 2:27 AM
Subscribers
None

Details

Summary

Depends on D21031. Ref T11968. This clears some lint with the word "Future", but is just a minor cleanup patch not really related to the main goal in that task.

We currently warn on preg_quote() with no second parameter, but this is valid and correct:

preg_match('('.preg_quote($x).')', ...)

This is the modern recommended style for this sort of expression, so the warning is often a false positive; drop it.

The "CLASS" warning looks for hard-coded class names in strings, but currently looks for them as a word anywhere in the string.

This is often a false positive and sometimes makes error messages or exceptions untranslatable. For example, translators can't do anything with this:

Filesystem path "%s" does not exist.

...if it's written as:

%s path "%s" does not exist.

...just because it happens to appear in the class "Filesystem". Some other classes, including "Future", suffer from this.

Even when the detection is correct, it's clunky and a mistake here (failing to update the class name in an error message) is unlikely to ever do any real damage.

Test Plan

Ran unit tests and arc lint.

Diff Detail

Repository
rARC Arcanist
Lint
Lint Not Applicable
Unit
Tests Not Applicable