Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(tools): add support for clj-kondo #734

Merged
merged 1 commit into from
Feb 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ mdsf init

<!-- START_SECTION:supported-tools -->

`mdsf` currently supports 261 tools. Feel free to open an issue/pull-request if your favorite tool/command is missing! 😃
`mdsf` currently supports 262 tools. Feel free to open an issue/pull-request if your favorite tool/command is missing! 😃

| Name | Description | Categories | Languages |
| --------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- | --------------------- | ------------------------------------------------------------------------- |
Expand Down Expand Up @@ -381,6 +381,7 @@ mdsf init
| [checkmake](https://github.com/mrtazz/checkmake) | Experimental linter/analyzer for Makefiles | `linter` | `makefile` |
| [clang-format](https://clang.llvm.org/docs/ClangFormat.html) | A tool to format C/C++/Java/JavaScript/JSON/Objective-C/Protobuf/C# code | `formatter` | `c#`, `c++`, `c`, `java`, `javascript`, `json`, `objective-c`, `protobuf` |
| [clang-tidy](https://clang.llvm.org/extra/clang-tidy/) | clang-tidy is a clang-based C++ “linter” tool | `linter` | `c++` |
| [clj-kondo](https://github.com/clj-kondo/clj-kondo) | Static analyzer and linter for Clojure code that sparks joy | `linter` | `clojure`, `clojurescript` |
| [cljfmt](https://github.com/weavejester/cljfmt) | A tool for formatting Clojure code | `formatter` | `clojure` |
| [cljstyle](https://github.com/greglook/cljstyle) | A tool for formatting Clojure code | `formatter` | `clojure` |
| [cmake-format](https://cmake-format.readthedocs.io/en/latest/cmake-format.html) | cmake-format can format your listfiles nicely so that they don't look like crap | `formatter` | `cmake` |
Expand Down Expand Up @@ -612,7 +613,7 @@ mdsf init

<!-- START_SECTION:supported-commands -->

`mdsf` currently supports 281 commands. Feel free to open an issue/pull-request if your favorite tool/command is missing! 😃
`mdsf` currently supports 282 commands. Feel free to open an issue/pull-request if your favorite tool/command is missing! 😃

| Name | Command |
| ------------------------ | --------------------------------------------------------------------------------------- |
Expand Down Expand Up @@ -658,6 +659,7 @@ mdsf init
| `checkmake` | `checkmake $PATH` |
| `clang-format` | `clang-format -i $PATH` |
| `clang-tidy` | `clang-tidy --fix $PATH` |
| `clj-kondo` | `clj-kondo --lint $PATH` |
| `cljfmt:fix` | `cljfmt fix $PATH` |
| `cljstyle` | `cljstyle fix $PATH` |
| `cmake-format` | `cmake-format -i $PATH` |
Expand Down
19 changes: 19 additions & 0 deletions mdsf/src/tools/clj_kondo.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
///
/// THIS FILE IS GENERATED USING CODE - DO NOT EDIT MANUALLY
///
use crate::runners::CommandType;

#[inline]
pub fn set_args(
mut cmd: std::process::Command,
file_path: &std::path::Path,
) -> std::process::Command {
cmd.arg("--lint");
cmd.arg(file_path);
cmd
}

pub const COMMANDS: [CommandType; 1] = [CommandType::Direct("clj-kondo")];

#[cfg(test)]
mod test_clj_kondo {}
11 changes: 11 additions & 0 deletions mdsf/src/tools/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ pub mod cfn_lint;
pub mod checkmake;
pub mod clang_format;
pub mod clang_tidy;
pub mod clj_kondo;
pub mod cljfmt_fix;
pub mod cljstyle;
pub mod cmake_format;
Expand Down Expand Up @@ -623,6 +624,14 @@ pub enum Tooling {
/// `clang-tidy --fix $PATH`
ClangTidy,

#[serde(rename = "clj-kondo")]
/// Static analyzer and linter for Clojure code that sparks joy
///
/// [https://github.com/clj-kondo/clj-kondo](https://github.com/clj-kondo/clj-kondo)
///
/// `clj-kondo --lint $PATH`
CljKondo,

#[serde(rename = "cljfmt:fix")]
/// A tool for formatting Clojure code
///
Expand Down Expand Up @@ -2590,6 +2599,7 @@ impl Tooling {
Self::Checkmake => (&checkmake::COMMANDS, checkmake::set_args),
Self::ClangFormat => (&clang_format::COMMANDS, clang_format::set_args),
Self::ClangTidy => (&clang_tidy::COMMANDS, clang_tidy::set_args),
Self::CljKondo => (&clj_kondo::COMMANDS, clj_kondo::set_args),
Self::CljfmtFix => (&cljfmt_fix::COMMANDS, cljfmt_fix::set_args),
Self::Cljstyle => (&cljstyle::COMMANDS, cljstyle::set_args),
Self::CmakeFormat => (&cmake_format::COMMANDS, cmake_format::set_args),
Expand Down Expand Up @@ -2894,6 +2904,7 @@ impl AsRef<str> for Tooling {
Self::Checkmake => "checkmake",
Self::ClangFormat => "clang_format",
Self::ClangTidy => "clang_tidy",
Self::CljKondo => "clj_kondo",
Self::CljfmtFix => "cljfmt_fix",
Self::Cljstyle => "cljstyle",
Self::CmakeFormat => "cmake_format",
Expand Down
5 changes: 5 additions & 0 deletions schemas/v0.5.3-dev/mdsf.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,11 @@
"type": "string",
"enum": ["clang-tidy"]
},
{
"description": "Static analyzer and linter for Clojure code that sparks joy\n\n[https://github.com/clj-kondo/clj-kondo](https://github.com/clj-kondo/clj-kondo)\n\n`clj-kondo --lint $PATH`",
"type": "string",
"enum": ["clj-kondo"]
},
{
"description": "A tool for formatting Clojure code\n\n[https://github.com/weavejester/cljfmt](https://github.com/weavejester/cljfmt)\n\n`cljfmt fix $PATH`",
"type": "string",
Expand Down
14 changes: 14 additions & 0 deletions tools/clj-kondo/plugin.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"$schema": "../tool.schema.json",
"binary": "clj-kondo",
"categories": ["linter"],
"commands": {
"": {
"arguments": ["--lint", "$PATH"]
}
},
"description": "Static analyzer and linter for Clojure code that sparks joy",
"homepage": "https://github.com/clj-kondo/clj-kondo",
"languages": ["clojure", "clojurescript"],
"packages": {}
}
Loading