Skip to content

Commit

Permalink
Remove jade checker and replace it with pug checker
Browse files Browse the repository at this point in the history
Jade is now deprecated and is replaced by pug. I do not feel it is
worth while to maintain a checker for both.

Closes flycheckGH-951
  • Loading branch information
robbyoconnor committed Sep 15, 2016
1 parent 7a7a358 commit 360f0fe
Show file tree
Hide file tree
Showing 8 changed files with 61 additions and 27 deletions.
2 changes: 2 additions & 0 deletions CHANGES.rst
Expand Up @@ -8,11 +8,13 @@
own ``.luacheckrc`` detection. Therefore ``flycheck-luacheckrc`` is
no longer used [GH-1057]
- ``:modes`` is now mandatory for syntax checker definitions [GH-1071]
- Remove jade checker [GH-951] [GH-1084]

- New syntax checkers:

- Elixir with ``dogma`` [GH-969]
- sass and scss with ``sass-lint`` [GH-1070]
- Pug [GH-951] [GH-1084]

- New features:

Expand Down
2 changes: 1 addition & 1 deletion Cask
Expand Up @@ -25,7 +25,6 @@
(depends-on "haml-mode")
(depends-on "handlebars-mode")
(depends-on "haskell-mode")
(depends-on "jade-mode")
(depends-on "js2-mode")
(depends-on "js3-mode")
(depends-on "json-mode")
Expand All @@ -35,6 +34,7 @@
(depends-on "mmm-mode")
(depends-on "php-mode")
(depends-on "processing-mode")
(depends-on "pug-mode")
(depends-on "puppet-mode")
(depends-on "racket-mode")
(depends-on "rhtml-mode")
Expand Down
12 changes: 6 additions & 6 deletions doc/languages.rst
Expand Up @@ -538,12 +538,6 @@ to view the docstring of the syntax checker. Likewise, you may use

.. syntax-checker-config-file:: flycheck-tidyrc

.. supported-language:: Jade

.. syntax-checker:: jade

Check syntax using the `Jade <http://jade-lang.com/>`_ compiler.

.. supported-language:: Javascript

Flycheck checks Javascript with one of `javascript-eslint`,
Expand Down Expand Up @@ -708,6 +702,12 @@ to view the docstring of the syntax checker. Likewise, you may use

Check syntax using the `Processing <https://processing.org/>`_ compiler.

.. supported-language:: Pug

.. syntax-checker:: pug

Check syntax using the `Pug <http://www.pugjs.org>`_ compiler.

.. supported-language:: Puppet

Flycheck checks Puppet with `puppet-parser` and lints with `puppet-lint`.
Expand Down
42 changes: 27 additions & 15 deletions flycheck.el
Expand Up @@ -197,7 +197,6 @@ attention to case differences."
haskell-ghc
haskell-hlint
html-tidy
jade
javascript-eslint
javascript-jshint
javascript-gjslint
Expand All @@ -214,6 +213,7 @@ attention to case differences."
php-phpmd
php-phpcs
processing
pug
puppet-parser
puppet-lint
python-flake8
Expand Down Expand Up @@ -7372,20 +7372,6 @@ See URL `https://github.com/htacg/tidy-html5'."
" - Warning: " (message) line-end))
:modes (html-mode nxhtml-mode))

(flycheck-define-checker jade
"A Jade syntax checker using the Jade compiler.

See URL `http://jade-lang.com'."
:command ("jade")
:standard-input t
:error-patterns
((error line-start
"Error: Jade:" line (zero-or-more not-newline) "\n"
(one-or-more (and (zero-or-more not-newline) "|"
(zero-or-more not-newline) "\n"))
(zero-or-more not-newline) "\n" (message) line-end))
:modes jade-mode)

(flycheck-def-config-file-var flycheck-jshintrc javascript-jshint ".jshintrc"
:safe #'stringp)

Expand Down Expand Up @@ -7777,6 +7763,32 @@ See https://github.com/processing/processing/wiki/Command-Line"
;; This syntax checker needs a file name
:predicate (lambda () (buffer-file-name)))

(flycheck-define-checker pug
"A Pug syntax checker using the pug compiler.

See URL `https://pugjs.org/'."
:command ("pug" "-p" (eval (expand-file-name (buffer-file-name))))
:standard-input t
:error-patterns
;; errors with includes/extends (e.g., missing files)
((error "Error: " (message) (zero-or-more not-newline) "\n"
(zero-or-more not-newline) "at "
(zero-or-more not-newline) " line " line)
;; syntax/runtime errors(e.g, type errors)
(error line-start
(optional "Type") "Error: " (file-name) ":" line (optional ":" column)
(zero-or-more not-newline) "\n"
(one-or-more (or (zero-or-more not-newline) "|"
(zero-or-more not-newline) "\n")
(zero-or-more "-") (zero-or-more not-newline) "|"
(zero-or-more not-newline) "\n")
(zero-or-more not-newline) "\n"
(one-or-more
(zero-or-more not-newline) "|"
(zero-or-more not-newline) "\n") (zero-or-more not-newline) "\n"
(message) line-end))
:modes pug-mode)

(flycheck-define-checker puppet-parser
"A Puppet DSL syntax checker using puppet's own parser.

Expand Down
20 changes: 16 additions & 4 deletions test/flycheck-test.el
Expand Up @@ -3282,10 +3282,6 @@ Why not:
'(8 5 warning "discarding unexpected <spam>"
:checker html-tidy)))

(flycheck-ert-def-checker-test jade jade nil
(flycheck-ert-should-syntax-check
"language/jade.jade" 'jade-mode
'(2 nil error "unexpected token \"indent\"" :checker jade)))

(defconst flycheck-test-javascript-modes '(js-mode
js2-mode
Expand Down Expand Up @@ -3548,6 +3544,22 @@ Why not:
'(4 2 error "Syntax error, maybe a missing semicolon?"
:checker processing)))

(flycheck-ert-def-checker-test pug pug syntax-error
(flycheck-ert-should-syntax-check
"language/pug/pug.pug" 'pug-mode
'(2 1 error "unexpected token \"indent\"" :checker pug)))

(flycheck-ert-def-checker-test pug pug include-extends-error
(flycheck-ert-should-syntax-check
"language/pug/pug-extends.pug" 'pug-mode
'(1 nil error
"the \"basedir\" option is required to use includes and extends with \"absolute\" paths" :checker pug)))

(flycheck-ert-def-checker-test pug pug type-error
(flycheck-ert-should-syntax-check
"language/pug/pug-runtime-error.pug" 'pug-mode
'(5 nil error "Cannot read property 'bar' of undefined" :checker pug)))

;; N.B. the puppet 4 and 3 tests are mutually exclusive
;; due to one having column and the other not
(flycheck-ert-def-checker-test puppet-parser puppet parser-error-puppet-4
Expand Down
3 changes: 3 additions & 0 deletions test/resources/language/pug/pug-extends.pug
@@ -0,0 +1,3 @@
extends /foo/bar/baz.pug
block content
h2 This is content
5 changes: 5 additions & 0 deletions test/resources/language/pug/pug-runtime-error.pug
@@ -0,0 +1,5 @@
doctype html
html
head
body
h1=foo.bar
@@ -1,6 +1,6 @@
doctype html
html
head
title Jade Examples
title Pug Examples
body
h1 Markup example

0 comments on commit 360f0fe

Please sign in to comment.