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): add support for cpplint #694

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.1...HEAD)

- feat(cli): add support for cpplint [`#694`](https://github.com/hougesen/mdsf/pull/694)
- chore(cli): add homepages to more commands [`#693`](https://github.com/hougesen/mdsf/pull/693)
- fix(vscode): downgrade @types/vscode to v1.96.0 [`#692`](https://github.com/hougesen/mdsf/pull/692)
- chore: bump version to v0.5.2-dev [`#691`](https://github.com/hougesen/mdsf/pull/691)

Expand Down
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 246 tools. Feel free to open an issue/pull-request if your favorite tool/command is missing! 😃
`mdsf` currently supports 247 tools. Feel free to open an issue/pull-request if your favorite tool/command is missing! 😃

| Name | Description | Categories | Languages |
| --------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- | --------------------- | ------------------------------------------------------------------------- |
Expand Down Expand Up @@ -383,6 +383,7 @@ mdsf init
| [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` |
| [cpplint](https://github.com/cpplint/cpplint) | Static code checker for C++ | `linter` | `c++` |
| [crlfmt](https://github.com/cockroachdb/crlfmt) | Formatter for CockroachDB's additions to the Go style guide | `formatter` | `go` |
| [crystal](https://crystal-lang.org/) | Tools for the Crystal programming language | `formatter` | `crystal` |
| [csharpier](https://csharpier.com/) | An Opinionated Code Formatter for C# | `formatter` | `c#` |
Expand Down Expand Up @@ -597,7 +598,7 @@ mdsf init

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

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

| Name | Command |
| ------------------------ | --------------------------------------------------------------------------------------- |
Expand Down Expand Up @@ -644,6 +645,7 @@ mdsf init
| `codeql:query:format` | `codeql query format -i $PATH` |
| `codespell` | `codespell $PATH --check-hidden --write-changes` |
| `coffeelint` | `coffeelint -q -f $PATH` |
| `cpplint` | `cpplint --quiet $PATH` |
| `crlfmt` | `crlfmt -w $PATH` |
| `crystal:format` | `crystal tool format $PATH` |
| `csharpier` | `dotnet csharpier $PATH` |
Expand Down
19 changes: 19 additions & 0 deletions mdsf/src/tools/cpplint.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("--quiet");
cmd.arg(file_path);
cmd
}

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

#[cfg(test)]
mod test_cpplint {}
11 changes: 11 additions & 0 deletions mdsf/src/tools/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ pub mod cmake_format;
pub mod codeql_query_format;
pub mod codespell;
pub mod coffeelint;
pub mod cpplint;
pub mod crlfmt;
pub mod crystal_format;
pub mod csharpier;
Expand Down Expand Up @@ -612,6 +613,14 @@ pub enum Tooling {
/// `coffeelint -q -f $PATH`
Coffeelint,

#[serde(rename = "cpplint")]
/// Static code checker for C++
///
/// [https://github.com/cpplint/cpplint](https://github.com/cpplint/cpplint)
///
/// `cpplint --quiet $PATH`
Cpplint,

#[serde(rename = "crlfmt")]
/// Formatter for CockroachDB's additions to the Go style guide
///
Expand Down Expand Up @@ -2423,6 +2432,7 @@ impl Tooling {
),
Self::Codespell => (&codespell::COMMANDS, codespell::set_args),
Self::Coffeelint => (&coffeelint::COMMANDS, coffeelint::set_args),
Self::Cpplint => (&cpplint::COMMANDS, cpplint::set_args),
Self::Crlfmt => (&crlfmt::COMMANDS, crlfmt::set_args),
Self::CrystalFormat => (&crystal_format::COMMANDS, crystal_format::set_args),
Self::Csharpier => (&csharpier::COMMANDS, csharpier::set_args),
Expand Down Expand Up @@ -2705,6 +2715,7 @@ impl AsRef<str> for Tooling {
Self::CodeqlQueryFormat => "codeql_query_format",
Self::Codespell => "codespell",
Self::Coffeelint => "coffeelint",
Self::Cpplint => "cpplint",
Self::Crlfmt => "crlfmt",
Self::CrystalFormat => "crystal_format",
Self::Csharpier => "csharpier",
Expand Down
5 changes: 5 additions & 0 deletions schemas/v0.5.2-dev/mdsf.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,11 @@
"type": "string",
"enum": ["coffeelint"]
},
{
"description": "Static code checker for C++\n\n[https://github.com/cpplint/cpplint](https://github.com/cpplint/cpplint)\n\n`cpplint --quiet $PATH`",
"type": "string",
"enum": ["cpplint"]
},
{
"description": "Formatter for CockroachDB's additions to the Go style guide\n\n[https://github.com/cockroachdb/crlfmt](https://github.com/cockroachdb/crlfmt)\n\n`crlfmt -w $PATH`",
"type": "string",
Expand Down
16 changes: 16 additions & 0 deletions tools/cpplint/plugin.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"$schema": "../tool.schema.json",
"binary": "cpplint",
"categories": ["linter"],
"commands": {
"": {
"arguments": ["--quiet", "$PATH"]
}
},
"description": "Static code checker for C++",
"homepage": "https://github.com/cpplint/cpplint",
"languages": ["c++"],
"packages": {
"apt": "cpplint"
}
}
Loading