Also fixes insufficiently-escaped regex examples
Details
Details
- Reviewers
epriestley - Maniphest Tasks
- T12532: `syntax.filemap` does not validate input
- Commits
- rP980d6cb70b94: Add validation for config settings of type regex
Made several changes to http://local.phacility.com/config/edit/syntax.filemap/ and observed validation failures on malformed regexes, and success on well-formed regexes.
Diff Detail
Diff Detail
- Repository
- rP Phabricator
- Lint
Lint Not Applicable - Unit
Tests Not Applicable
Event Timeline
Comment Actions
Oh, good catches:
- With very rare exceptions, classes should either be abstract or final. Earlier in the life of the project we didn't do this and a few users decided that meant that they were free to extend any class they wanted in third-party custom code and complain when we broke things. With final, they have to more clearly "break the warranty seal" by modifying the upstream code, and we haven't seen further confusion about this that I can recall since we adopted the rule.
- ArcanistRaggedClassTreeEdgeXHPASTLinterRule is supposed to enforce this in lint, but is disabled by default and not enabled by the phutil.xhpast ruleset. I'll file a task to fix this.
- validateOption() can do more complete validation by doing this check first, which makes sure users don't enter a value like "asdf". This might not be permitted by the web UI anyway, but users can write "syntax.filemap": "asdf" into the local.json config if they're ambitious:
if (!is_array($value)) { throw new Exception(...); }