lunaryorn/flycheck — pull request #40 by lunaryorn (2013-01-01 20:12:21+00:00)
Title: Refactor config file handling

Refactor handling of config files for checkers to avoid early searches for config files. Use special symbols in the argument list.

# Rationale

Avoid early searching for config files. Do not search before argument substitution, when it's clear that this checker will be used.

# Interface

```scheme
(defvar flycheck-jshintrc ".jshintrc"
"The path to .jshintrc.

This variable denotes the configuration file for jshint to use
when checking a buffer with jshint.

If set to a file name with no slash, search this file in the
directory of the file to check, any ancestors thereof or the home
directory.

If set to a file name containing a slash (e.g. ./.jshintrc or $HOME/.jshintrc)
expand the file name with `expand-file-name' and use it directly.

Use this variable as file local variable to use a specific
configuration file for a buffer.")
(put 'flycheck-jshintrc 'safe-local-variable 'stringp)

(defconst flycheck-checker-javascript-jshint
"Check javascript with jshint.

Use .jshintrc from either `flycheck-jshintrc' or – if that
variable is nil – the buffer's directory, any ancestors thereof
or the $HOME directory.

If .jshintrc is not found run jshint with default settings."
'(:command
("jshint" (config "--config" flycheck-jshintrc) source)
:error-patterns
(("^\\(.*\\): line \\([[:digit:]]+\\), col \\([[:digit:]]+\\), \\(.+\\)$"
1 2 3 4 error))
:modes js-mode))
```