(defun our-django--get-project-root-directory ()
"Djangoのprojectのrootディレクトリを取得する"
(locate-dominating-file (or buffer-file-name default-directory)
"manage.py"))
(defun our-django--get-project-root-directory-for-flyceck (checker)
"Djangoのprojectのrootディレクトリを取得する"
(our-django--get-project-root-directory))
(defun our-flycheck-parse-with-patterns (output checker buffer)
(with-current-buffer (get-buffer-create "*SYMDON-FLYCHECK*")
(erase-buffer)
(insert output))
(flycheck-parse-with-patterns output checker buffer))
(flycheck-define-checker symdon-django-test-checker
"By Symdon"
:command ("python" "manage.py" "test" "--verbosity" "3" "--keepdb" "invoy.api")
:modes python-mode
:working-directory our-django--get-project-root-directory-for-flyceck
:predicate flycheck-buffer-saved-p
:error-parser our-flycheck-parse-with-patterns
:error-patterns
((error line-start (file-name) ":" line ":" column ": error: " (message)
line-end)
(warning line-start (file-name) ":" line ":" column ": warning: " (message)
line-end)
(info line-start (file-name) ":" line ":" column ": info: " (message)
line-end)
))
(flycheck-define-checker symdon-django-test-checker
"By Symdon"
:command ("python" "manage.py" "test" "--verbosity" "3")
:modes python-mode
:working-directory our-django--get-project-root-directory-for-flyceck
:error-patterns
((error line-start (file-name) ":" line ":" column ": error: " (message)
line-end)
(warning line-start (file-name) ":" line ":" column ": warning: " (message)
line-end)
(info line-start (file-name) ":" line ":" column ": info: " (message)
line-end)
))
(require 'flycheck)
(flycheck-define-checker python-doctest
"Run python doctest"
:command ("python"
"-c"
(eval (format "import doctest; doctest.testfile('%s.py')"
(file-name-base buffer-file-name))))
:error-patterns
((error line-start
"File \"" (file-name) "\", line " line ", in " (submatch (* nonl)) line-end)
)
:modes python-mode)