diff --git a/CHANGELOG.md b/CHANGELOG.md index 9f783a70..a4b6e345 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). #### [Unreleased](https://github.com/hougesen/mdsf/compare/v0.5.0...HEAD) +- feat(cli): support codeql query format [`#677`](https://github.com/hougesen/mdsf/pull/677) - chore: set dev version to v0.5.1-dev [`#676`](https://github.com/hougesen/mdsf/pull/676) - refactor(cli): remove once_cell dependency [`#675`](https://github.com/hougesen/mdsf/pull/675) diff --git a/README.md b/README.md index 9dd665f1..eb20fb0b 100644 --- a/README.md +++ b/README.md @@ -340,7 +340,7 @@ mdsf init -`mdsf` currently supports 244 tools. Feel free to open an issue/pull-request if your favorite tool/command is missing! 😃 +`mdsf` currently supports 245 tools. Feel free to open an issue/pull-request if your favorite tool/command is missing! 😃 | Name | Description | Categories | Languages | | --------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- | --------------------- | ------------------------------------------------------------------------- | @@ -379,6 +379,7 @@ mdsf init | [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` | +| [codeql](https://docs.github.com/en/code-security/codeql-cli/codeql-cli-manual) | Format queries and libraries with CodeQL | `formatter` | `codeql` | | [codespell](https://github.com/codespell-project/codespell) | Check code for common misspellings | `autocorrection` | | | [coffeelint](https://github.com/coffeelint/coffeelint) | Lint your CoffeeScript | `linter` | `coffeescript` | | [crlfmt](https://github.com/cockroachdb/crlfmt) | Formatter for CockroachDB's additions to the Go style guide | `formatter` | `go` | @@ -445,7 +446,7 @@ mdsf init | [isort](https://github.com/timothycrosley/isort) | A Python utility to sort imports | `formatter` | `python` | | [joker](https://github.com/candid82/joker) | Small Clojure interpreter, linter and formatter | `formatter`, `linter` | `clojure` | | [js-beautify](https://github.com/beautifier/js-beautify) | A JavaScript formatter | `formatter` | `javascript` | -| [json5format](https://github.com/google/json5format) | JSON5 (a.k.a., "JSON for Humans") formatter that preserves contextual comments | `formatter` | `json5`, `json` | +| [json5format](https://github.com/google/json5format) | JSON5 (a.k.a., JSON for Humans) formatter that preserves contextual comments | `formatter` | `json5`, `json` | | [jsona](https://github.com/jsona/jsona) | JSONA linter and formatter | `formatter`, `linter` | `jsona` | | [jsonlint](https://github.com/zaach/jsonlint) | A JSON parser and validator with a CLI | `formatter`, `linter` | `json` | | [jsonnet-lint](https://jsonnet.org/learning/tools.html) | Linter for jsonnet files | `linter` | `jsonnet` | @@ -595,7 +596,7 @@ mdsf init -`mdsf` currently supports 258 commands. Feel free to open an issue/pull-request if your favorite tool/command is missing! 😃 +`mdsf` currently supports 259 commands. Feel free to open an issue/pull-request if your favorite tool/command is missing! 😃 | Name | Command | | ------------------------ | --------------------------------------------------------------------------------------- | @@ -638,6 +639,7 @@ mdsf init | `cljfmt:fix` | `cljfmt fix $PATH` | | `cljstyle` | `cljstyle fix $PATH` | | `cmake-format` | `cmake-format -i $PATH` | +| `codeql:query:format` | `codeql query format -i $PATH` | | `codespell` | `codespell $PATH --check-hidden --write-changes` | | `coffeelint` | `coffeelint -q -f $PATH` | | `crlfmt` | `crlfmt -w $PATH` | diff --git a/mdsf/src/tools/codeql_query_format.rs b/mdsf/src/tools/codeql_query_format.rs new file mode 100644 index 00000000..24b9ddcd --- /dev/null +++ b/mdsf/src/tools/codeql_query_format.rs @@ -0,0 +1,21 @@ +/// +/// 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("query"); + cmd.arg("format"); + cmd.arg("-i"); + cmd.arg(file_path); + cmd +} + +pub const COMMANDS: [CommandType; 1] = [CommandType::Direct("codeql")]; + +#[cfg(test)] +mod test_codeql_query_format {} diff --git a/mdsf/src/tools/mod.rs b/mdsf/src/tools/mod.rs index c54bc609..505b92dc 100644 --- a/mdsf/src/tools/mod.rs +++ b/mdsf/src/tools/mod.rs @@ -40,6 +40,7 @@ pub mod clang_tidy; pub mod cljfmt_fix; pub mod cljstyle; pub mod cmake_format; +pub mod codeql_query_format; pub mod codespell; pub mod coffeelint; pub mod crlfmt; @@ -420,6 +421,10 @@ pub enum Tooling { /// `cmake-format -i $PATH` CmakeFormat, + #[serde(rename = "codeql:query:format")] + /// `codeql query format -i $PATH` + CodeqlQueryFormat, + #[serde(rename = "codespell")] /// `codespell $PATH --check-hidden --write-changes` Codespell, @@ -1348,6 +1353,10 @@ impl Tooling { 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), + Self::CodeqlQueryFormat => ( + &codeql_query_format::COMMANDS, + codeql_query_format::set_args, + ), Self::Codespell => (&codespell::COMMANDS, codespell::set_args), Self::Coffeelint => (&coffeelint::COMMANDS, coffeelint::set_args), Self::Crlfmt => (&crlfmt::COMMANDS, crlfmt::set_args), @@ -1626,6 +1635,7 @@ impl AsRef for Tooling { Self::CljfmtFix => "cljfmt_fix", Self::Cljstyle => "cljstyle", Self::CmakeFormat => "cmake_format", + Self::CodeqlQueryFormat => "codeql_query_format", Self::Codespell => "codespell", Self::Coffeelint => "coffeelint", Self::Crlfmt => "crlfmt", diff --git a/schemas/v0.5.1-dev/mdsf.schema.json b/schemas/v0.5.1-dev/mdsf.schema.json index e7fb1b1d..f06aeb09 100644 --- a/schemas/v0.5.1-dev/mdsf.schema.json +++ b/schemas/v0.5.1-dev/mdsf.schema.json @@ -261,6 +261,11 @@ "type": "string", "enum": ["cmake-format"] }, + { + "description": "`codeql query format -i $PATH`", + "type": "string", + "enum": ["codeql:query:format"] + }, { "description": "`codespell $PATH --check-hidden --write-changes`", "type": "string", diff --git a/tools/codeql/plugin.json b/tools/codeql/plugin.json new file mode 100644 index 00000000..6d248be0 --- /dev/null +++ b/tools/codeql/plugin.json @@ -0,0 +1,16 @@ +{ + "$schema": "../tool.schema.json", + "binary": "codeql", + "categories": ["formatter"], + "commands": { + "query:format": { + "arguments": ["query", "format", "-i", "$PATH"], + "description": "Format queries and libraries with CodeQL", + "homepage": "https://docs.github.com/en/code-security/codeql-cli/codeql-cli-manual/query-format" + } + }, + "description": "Format queries and libraries with CodeQL", + "homepage": "https://docs.github.com/en/code-security/codeql-cli/codeql-cli-manual", + "languages": ["codeql"], + "packages": {} +} diff --git a/tools/json5format/plugin.json b/tools/json5format/plugin.json index 51b8339e..9ac06d75 100644 --- a/tools/json5format/plugin.json +++ b/tools/json5format/plugin.json @@ -7,7 +7,7 @@ "arguments": ["-r", "$PATH"] } }, - "description": "JSON5 (a.k.a., \"JSON for Humans\") formatter that preserves contextual comments", + "description": "JSON5 (a.k.a., JSON for Humans) formatter that preserves contextual comments", "homepage": "https://github.com/google/json5format", "languages": ["json", "json5"], "packages": {}