(require 'flycheck)
(defgroup flycheck-snort nil
"snortism intergrate with flycheck"
:prefix "flycheck-snortism"
:group 'flycheck
(flycheck-define-checker snortism
"A linter for Snort rules."
;; Addition checker options include snort, pyse, visruleparser
:command ("rulecritic" source-inplace) ;; source from temp file in working dir
:error-patterns
((error line-start
"Error: "
(message)
line-end))
;; " line: "
;; line
;; line-end))
:modes snort-mode
:predicate (lambda () (message "Snortism looaded %s" buffer-file-name))
:verify)
(defun flycheck-snort-unsetup ()
"Utility function, used for testing only."
(interactive)
(setq flycheck-checkers (remove 'snortism flycheck-checkers)))
;;;###autoload
(defun flycheck-snort-setup ()
"Setup flycheck-snort"
(interactive)
(add-to-list 'flycheck-checkers 'snortism))
(provide 'flycheck-snort)
;; flycheck-snort.el ends here
-*- mode: compilation; default-directory: "~/tmp/flysnorttest/" -*-
Compilation started at Mon Jun 24 17:44:00
rulecritic /home/nmavis/tmp/flysnorttest/local.rules
Error: invalid rule direction
line 1: alert tcp $blah -> $blah (msg:"TEST"; content:"THIS"; metadata: servi
^
Compilation finished at Mon Jun 24 17:44:00
Syntax checkers for buffer local.rules in snort-mode:
First checker to run:
snortism
- may enable: yes
- predicate: t
- executable: Found at /home/nmavis/bin/rulecritic
Flycheck Mode is enabled. Use SPC u C-c ! x to enable disabled checkers.
--------------------
Flycheck version: 32snapshot (package: 20190619.1410)
Emacs version: 26.2
System: x86_64-pc-linux-gnu
Window system: x