Support and prefer configuration from .arclint over Configuration Manager
Details
- Reviewers
joshuaspence epriestley - Group Reviewers
Blessed Reviewers - Commits
- rARCc00899ad60ff: Modernize Script-and-Regex linter for ConfigurationDriven
arc lint with several combinations of values in .arcconfig and .arclint.
Diff Detail
- Repository
- rARC Arcanist
- Branch
- arcpatch-D10704
- Lint
Lint Passed - Unit
Tests Passed - Build Status
Buildable 3825 Build 3837: [Placeholder Plan] Wait for 30 Seconds
Event Timeline
src/lint/linter/ArcanistScriptAndRegexLinter.php | ||
---|---|---|
387–392 | ok. | |
388 | if (strlen($x)) is the convention used, to assure $x is actually a string (@epriestley said so). Or at least it was. | |
417–418 | $key is used in the error message below. |
Just noticed a couple of things whilst working on D11773.
src/lint/linter/ArcanistScriptAndRegexLinter.php | ||
---|---|---|
11 | We should update this. | |
14 | We should update this. | |
295 | Change this to script-and-regex.script. | |
299 | Change this to script-and-regex.reged. | |
310 | As above. | |
313 | As above. | |
388 | See line 413. | |
394 | See line 420. | |
413 | I still think that we should just use if ($this->regex) { here... | |
420 | ...or change this to be if (!strlen($config)) { | |
431–432 | I'm thinking that we should just remove the second part of this message, since it encourages the use of deprecated configuration. |
I wrote a long text here describing what I think the logic of strlen is, but it turns out that php.
I'll just remove the strlen for now, unless @epriestley want to chime in.
src/lint/linter/ArcanistScriptAndRegexLinter.php | ||
---|---|---|
296 | Yeah, that's the plan, but I'd like to avoid breaking this so abruptly; Give it some time as "deprecated". |
The use of strlen() to test whether strings are set is generally correct, because strings like "0" and "0.0" fail if ($setting) but pass if (strlen($setting)). These cases rarely matter, but occasionally they do things like prevent you from writing rules that affect files literally named "0", making users with the username "0" behave awkwardly, preventing you from making a wiki page titled "0", etc.
Ok, that makes more sense.
In the case of this diff, it can only make scripts named "0" not work, which is probably not so bad?
LGTM otherwise.
src/lint/linter/ArcanistScriptAndRegexLinter.php | ||
---|---|---|
311 | Maybe you should do Filesystem::assertExists to ensure that the script actually exists... or maybe this already happens somewhere else? | |
388–392 | For consistency, maybe this if ($this->script) { | |
395 | Maybe maybe this translatable with pht() | |
421 | Make this translatable with this pht() | |
430–432 | Prefer to write this as pht("%s: Regex '%s' does not compile.", __CLASS__, $regex) |
I'll fix that pht() stuff in the pull.
src/lint/linter/ArcanistScriptAndRegexLinter.php | ||
---|---|---|
311 | This might be grep or some shell alias or something so I think it's OK to not check. |
src/lint/linter/ArcanistScriptAndRegexLinter.php | ||
---|---|---|
311 | Ah, good point. |