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(cli): support the R formatter air #679

Merged
merged 1 commit into from
Feb 13, 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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).

#### [Unreleased](https://github.com/hougesen/mdsf/compare/v0.5.0...HEAD)

- feat(cli): support the R formatter air [`#679`](https://github.com/hougesen/mdsf/pull/679)
- build(deps-dev): bump esbuild in /mdsf-vscode in the npm_and_yarn group [`#678`](https://github.com/hougesen/mdsf/pull/678)
- 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)
Expand Down
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -340,11 +340,12 @@ mdsf init

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

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

| Name | Description | Categories | Languages |
| --------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- | --------------------- | ------------------------------------------------------------------------- |
| [actionlint](https://github.com/rhysd/actionlint) | Static checker for GitHub Actions workflow files | `linter` | `yaml` |
| [air](https://github.com/posit-dev/air) | R formatter and language server | `formatter`, `lsp` | `r` |
| [alejandra](https://github.com/kamadorueda/alejandra) | The Uncompromising Nix Code Formatter | `formatter` | `nix` |
| [ameba](https://github.com/crystal-ameba/ameba) | A static code analysis tool for Crystal | `linter` | `crystal` |
| [ansible-lint](https://github.com/ansible/ansible-lint) | ansible-lint checks playbooks for practices and behavior that could potentially be improved and can fix some of the most common ones for you | `linter` | `ansible` |
Expand Down Expand Up @@ -596,11 +597,12 @@ mdsf init

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

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

| Name | Command |
| ------------------------ | --------------------------------------------------------------------------------------- |
| `actionlint` | `actionlint $PATH` |
| `air:format` | `air format $PATH` |
| `alejandra` | `alejandra --quiet $PATH` |
| `ameba` | `ameba --fix $PATH` |
| `ansible-lint` | `ansible-lint $PATH` |
Expand Down
19 changes: 19 additions & 0 deletions mdsf/src/tools/air_format.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("format");
cmd.arg(file_path);
cmd
}

pub const COMMANDS: [CommandType; 1] = [CommandType::Direct("air")];

#[cfg(test)]
mod test_air_format {}
7 changes: 7 additions & 0 deletions mdsf/src/tools/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
/// THIS FILE IS GENERATED USING CODE - DO NOT EDIT MANUALLY
///
pub mod actionlint;
pub mod air_format;
pub mod alejandra;
pub mod ameba;
pub mod ansible_lint;
Expand Down Expand Up @@ -269,6 +270,10 @@ pub enum Tooling {
/// `actionlint $PATH`
Actionlint,

#[serde(rename = "air:format")]
/// `air format $PATH`
AirFormat,

#[serde(rename = "alejandra")]
/// `alejandra --quiet $PATH`
Alejandra,
Expand Down Expand Up @@ -1315,6 +1320,7 @@ impl Tooling {
fn(std::process::Command, &std::path::Path) -> std::process::Command,
) = match self {
Self::Actionlint => (&actionlint::COMMANDS, actionlint::set_args),
Self::AirFormat => (&air_format::COMMANDS, air_format::set_args),
Self::Alejandra => (&alejandra::COMMANDS, alejandra::set_args),
Self::Ameba => (&ameba::COMMANDS, ameba::set_args),
Self::AnsibleLint => (&ansible_lint::COMMANDS, ansible_lint::set_args),
Expand Down Expand Up @@ -1597,6 +1603,7 @@ impl AsRef<str> for Tooling {
fn as_ref(&self) -> &str {
match self {
Self::Actionlint => "actionlint",
Self::AirFormat => "air_format",
Self::Alejandra => "alejandra",
Self::Ameba => "ameba",
Self::AnsibleLint => "ansible_lint",
Expand Down
5 changes: 5 additions & 0 deletions schemas/v0.5.1-dev/mdsf.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@
"type": "string",
"enum": ["actionlint"]
},
{
"description": "`air format $PATH`",
"type": "string",
"enum": ["air:format"]
},
{
"description": "`alejandra --quiet $PATH`",
"type": "string",
Expand Down
16 changes: 16 additions & 0 deletions tools/air/plugin.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"$schema": "../tool.schema.json",
"binary": "air",
"categories": ["formatter", "lsp"],
"commands": {
"format": {
"arguments": ["format", "$PATH"],
"description": "A code formatter for R",
"homepage": "https://posit-dev.github.io/air/formatter.html"
}
},
"description": "R formatter and language server",
"homepage": "https://github.com/posit-dev/air",
"languages": ["r"],
"packages": {}
}
Loading