Skip to content

Commit

Permalink
Add dartanalyzer linter
Browse files Browse the repository at this point in the history
  • Loading branch information
totakke committed Mar 16, 2020
1 parent c306fe1 commit 6e8f2d5
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ Look at the [configuration example](example/config.edn).
- [clj-kondo](https://github.com/borkdude/clj-kondo)
- [checkstyle](https://checkstyle.org/)
- [cljfmt](https://github.com/weavejester/cljfmt)
- [dartanalyzer](https://dart.dev/tools/dartanalyzer)
- [eastwood](https://github.com/jonase/eastwood)
- [flake8](https://flake8.pycqa.org/)
- [hadolint](https://github.com/hadolint/hadolint)
Expand Down
2 changes: 2 additions & 0 deletions example/config.edn
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

:eastwood {:version "0.3.7"}

:dartanalyzer {:command-options ["--no-hints"]}

:flake8 {:command-options ["--count"
"--ignore=F401,E501"]}

Expand Down
18 changes: 18 additions & 0 deletions src/bosslint/linter/dartanalyzer.clj
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
(ns bosslint.linter.dartanalyzer
(:require [bosslint.linter :as linter :refer [deflinter]]
[clojure.java.shell :as shell]
[clojure.string :as string]))

(deflinter :linter/dartanalyzer
(name [] "dartanalyzer")

(files [file-group]
(linter/select-files file-group [:dart]))

(lint [files conf]
(when (linter/check-command "dartanalyzer")
(let [args (concat ["dartanalyzer"]
(:command-options conf)
(map :absolute-path files))
ret (apply shell/sh args)]
(println (string/trim-newline (:out ret)))))))
5 changes: 3 additions & 2 deletions src/bosslint/main.clj
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
(ns bosslint.main
(:require [bosslint.config :as config]
[bosslint.linter :as linter]
(bosslint.linter checkstyle clj-kondo cljfmt eastwood flake8
hadolint stylelint swiftlint)
(bosslint.linter checkstyle clj-kondo cljfmt dartanalyzer eastwood
flake8 hadolint stylelint swiftlint)
[bosslint.util :as util]
[clj-sub-command.core :as cmd]
[clojure.java.shell :as shell]
Expand Down Expand Up @@ -40,6 +40,7 @@
#"\.clj$" :clj
#"\.cljc$" :cljc
#"\.cljs$" :cljs
#"\.dart$" :dart
#"Dockerfile(\.[-\w]+)?$" :docker
#"\.java$" :java
#"\.py$" :python
Expand Down

0 comments on commit 6e8f2d5

Please sign in to comment.