Page MenuHomePhabricator

Ensure that `ArcanistTextLinter` respects `.editorconfig` settings
Open, NormalPublic

Description

The ArcanistTextLinter is great, except that it is biased in that it cannot be (easily) configured to selectively apply rules to files. It would be a more powerful tool if it read (and understood) .editorconfig files.

This would involve a couple of parts:

  1. Providing a function for converting glob patterns into regular expressions. Whilst PHP has support for checking glob patterns against a path (namely the fnmatch function), I expect that there are subtle differences in how PHP handles globs compared with the EditorConfig format.
  2. Providing an EditorConfig parser, probably in libphutil. This would essentially be a light wrapper around parse_ini_file with some validation.
  3. Modifying the ArcanistTextLinter to take .editorconfig files into account.

Event Timeline

joshuaspence claimed this task.
joshuaspence raised the priority of this task from to Low.
joshuaspence updated the task description. (Show Details)
joshuaspence added a project: Arcanist.
joshuaspence added a subscriber: joshuaspence.
joshuaspence raised the priority of this task from Low to Normal.Jun 19 2014, 4:14 PM
joshuaspence renamed this task from Ensure that `ArcanistTextLinter` respects `.editorconfig` settings. to Ensure that `ArcanistTextLinter` respects `.editorconfig` settings.Jul 9 2014, 7:11 PM

Will the linter config (.arcconfig) somehow point to .editorconfig? Or will you *just have to know* that the text linter uses not only its linter config, but also .editorconfig files?

The best would probably be to use the text linter config to enable/disable respecting and analysing according to .editorconfig.

Better yet, the text linter could be configured to either one of:

  • Do not check .editorconfig files
  • Perform checks according only to the root .editorconfig file (project root, same folder as .arcconfig)
  • Recursively check for .editorconfig files and perform checks accordingly (as per editorconfig.org, which I guess is the definition of its format?)

Maybe we should rename/replace ArcanistTextLinter to ArcanistEditorConfigLinter if we're doing this? I'm assuming supporting "all" of EditorConfig is a long-term goal here.