@@ -86,31 +86,43 @@ we pass the directory to solium via the `--config' option."
8686
8787(when solidity-flycheck-solium-checker-active
8888 ; ; define solium flycheck syntax checker
89+ ; ; expanded the flycheck-define-checker macro in order to eval certain args, as per advice given in gitter
90+ ; ; https://gitter.im/flycheck/flycheck?at=5a43b3a8232e79134d98872b
8991 ; ; first try to add solium to the checker's list since if we got solc
9092 ; ; it must come after it in the list due to it being chained after solc
91- (if (funcall flycheck-executable-find solidity-solium-path)
92- (progn
93- (flycheck-define-checker solium-checker
94- " A Solidity linter using solium"
95- :command (" solium"
96- (option " --config=" flycheck-solidity-solium-soliumrcfile concat)
97- " -f"
98- source-inplace)
99- :error-patterns ((error line-start (zero-or-more " " ) line " :" column (zero-or-more " " ) " error" (message ))
100- (error line-start (zero-or-more not-newline) " [Fatal error]" (message ))
101- (warning line-start (zero-or-more " " ) line " :" column (zero-or-more " " ) " warning" (message )))
102- :error-filter
103- ; ; Add fake line numbers if they are missing in the lint output
104- (lambda (errors )
105- (dolist (err errors)
106- (unless (flycheck-error-line err)
107- (setf (flycheck-error-line err) 1 )))
108- errors)
109- :modes solidity-mode
110- :predicate (lambda () (eq major-mode 'solidity-mode )))
111- (add-to-list 'flycheck-checkers 'solium-checker )
112- (setq flycheck-solium-checker-executable solidity-solium-path))
113- (error (format " Solidity Mode Configuration error. Requested solium flycheck integration but can't find solium at: %s " solidity-solium-path))))
93+ (flycheck-def-executable-var solium-checker " solium" )
94+ (let ((solium-full-path (funcall flycheck-executable-find solidity-solium-path)))
95+ (if solium-full-path
96+ (let ((solium-has-reporter (string-match-p " --reporter" (shell-command-to-string (concat solium-full-path " --help" )))))
97+ (flycheck-define-command-checker 'solium-checker
98+ " A Solidity linter using solium"
99+ :command `(" solium"
100+ ,(if solium-has-reporter " --reporter=gcc" " " )
101+ (option " --config=" flycheck-solidity-solium-soliumrcfile concat)
102+ " -f"
103+ source-inplace)
104+ :error-patterns `((error line-start (zero-or-more not-newline) " [Fatal error]" (message ))
105+ ,(if solium-has-reporter
106+ '(error line-start (file-name) " :" line " :" column " : error: " (message ))
107+ '(error line-start (zero-or-more " " ) line " :" column (zero-or-more " " ) " error" (message )))
108+ ,(if solium-has-reporter
109+ '(warning line-start (file-name) " :" line " :" column " : warning: " (message ))
110+ '(warning line-start (zero-or-more " " ) line " :" column (zero-or-more " " ) " warning" (message ))))
111+ :error-filter
112+ ; ; Add fake line numbers if they are missing in the lint output
113+ #' (lambda (errors )
114+ (dolist (err errors)
115+ (unless (flycheck-error-line err)
116+ (setf (flycheck-error-line err) 1 )))
117+ errors)
118+ :modes 'solidity-mode
119+ :predicate #' (lambda nil (eq major-mode 'solidity-mode ))
120+ :next-checkers 'nil
121+ :standard-input 'nil
122+ :working-directory 'nil )
123+ (add-to-list 'flycheck-checkers 'solium-checker )
124+ (setq flycheck-solium-checker-executable solidity-solium-path))
125+ (error (format " Solidity Mode Configuration error. Requested solium flycheck integration but can't find solium at: %s " solidity-solium-path)))))
114126
115127(when solidity-flycheck-solc-checker-active
116128 ; ; add a solidity mode callback to set the executable of solc for flycheck
0 commit comments