Skip to content

Commit

Permalink
Add markdownlint linter
Browse files Browse the repository at this point in the history
  • Loading branch information
totakke committed Nov 11, 2022
1 parent 5d9fc66 commit 7da0a60
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 2 deletions.
2 changes: 2 additions & 0 deletions example/config.edn
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

:kubeval {:command-options ["--strict"]}

:markdownlint {:command-options ["-c" "/path/to/markdownlint.yaml"]}

:stylelint {:command-options ["--config" "/path/to/stylelintrc.json"]}

:tflint {:command-options ["-f" "json"]}
Expand Down
21 changes: 21 additions & 0 deletions src/bosslint/linter/markdownlint.clj
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
(ns bosslint.linter.markdownlint
(:require [bosslint.linter :as linter :refer [deflinter]]
[clojure.java.shell :as shell]
[clojure.string :as string]))

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

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

(lint [files conf]
(when (linter/check-command "markdownlint")
(let [args (concat ["markdownlint"]
(:command-options conf)
(map :absolute-path files))
ret (apply shell/sh args)]
(when-not (string/blank? (:out ret))
(println (string/trim-newline (:out ret))))
(when-not (string/blank? (:err ret))
(println (string/trim-newline (:err ret))))))))
5 changes: 3 additions & 2 deletions src/bosslint/main.clj
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
(:require [bosslint.config :as config]
[bosslint.linter :as linter]
(bosslint.linter checkstyle clj-kondo cljfmt dartanalyzer eastwood
flake8 hadolint jsonlint kubeval stylelint
swiftlint tflint yamllint)
flake8 hadolint jsonlint kubeval markdownlint
stylelint swiftlint tflint yamllint)
[bosslint.util :as util]
[clj-sub-command.core :as cmd]
[clojure.java.shell :as shell]
Expand Down Expand Up @@ -52,6 +52,7 @@
#"Dockerfile(\.[-\w]+)?$" :docker
#"\.java$" :java
#"\.json$" :json
#"\.(md|markdown)$" :markdown
#"\.py$" :python
#"\.s[ac]ss$" :sass
#"\.swift$" :swift
Expand Down

0 comments on commit 7da0a60

Please sign in to comment.