To me, it seems that these methods should never be overwritten in subclasses.
Details
arc unit
Diff Detail
- Repository
- rARC Arcanist
- Branch
- linter-final_methods
- Lint
Lint Passed - Unit
Tests Passed - Build Status
Buildable 365 Build 365: [Placeholder Plan] Wait for 30 Seconds
Event Timeline
- Made some additional methods of ArcanistBaseXHPASTLinter final
- Made some additional methods of ArcanistFutureLinter final
Closed by commit rARC9b05a025b7a6 (authored by @joshuaspence, committed by @epriestley).
I think this change broke lint for fbobjc:
PHP Fatal error: Cannot override final method ArcanistFutureLinter::willLintPaths() in /Users/judyliu/Projects/fbobjc/Configurations/Arcanist/lint/linter/FacebookObjcClangFormatLinter.php on line 8
We basically do
// Path regexes to run clang-format on $whitelist = array( // '#^BLAH/.*#', ); foreach ($paths as $path) { foreach ($whitelist as $regex) { if (preg_match($regex, $path)) { $do_lint[] = $path; } } } parent::willLintPaths($do_lint);
There was some reason why we didn't do it in the engine or use other methods...
I don't mind un-final-ing it if that's easiest since this is purely a quality-of-life change, but that does look like stuff that should ideally live somewhere else. Shoot me a diff to remove the problematic final if you want to go that route?
I'm actually revamping our linters and don't think this will be an issue in the future, so let's keep it this way for now. I'll put up a diff if it later becomes an issue.
It would be nice to have a generic way the linters can override what they run on after the engine has decided to run...otherwise you are shoving a lot of logic into the engine.
Hmm, you could do something like this when building a future:
if ($this->shouldLintPath($path)) { return new RealFuture(...); } else { return new ImmediateFuture(null); }
Then in resolveFutures() just return; if the result is null. Basically, lint the path but don't actually do any linting.
The new .arclint files make it easier to flexibly configure linters, although I'm not sure if they're flexible enough for FB. Here's the docs:
https://secure.phabricator.com/book/phabricator/article/arcanist_lint/#configuring-lint
e.g., Phabricator is now configured with this file instead of an engine:
https://secure.phabricator.com/diffusion/P/browse/master/.arclint