diff --git a/example/config.edn b/example/config.edn index c0fa548..07be56b 100644 --- a/example/config.edn +++ b/example/config.edn @@ -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"]} diff --git a/src/bosslint/linter/markdownlint.clj b/src/bosslint/linter/markdownlint.clj new file mode 100644 index 0000000..5375c0f --- /dev/null +++ b/src/bosslint/linter/markdownlint.clj @@ -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)))))))) diff --git a/src/bosslint/main.clj b/src/bosslint/main.clj index ce98680..e22c39c 100644 --- a/src/bosslint/main.clj +++ b/src/bosslint/main.clj @@ -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] @@ -52,6 +52,7 @@ #"Dockerfile(\.[-\w]+)?$" :docker #"\.java$" :java #"\.json$" :json + #"\.(md|markdown)$" :markdown #"\.py$" :python #"\.s[ac]ss$" :sass #"\.swift$" :swift