From b7ff994467d1e0fb2ca39d3ec38aa2e08be9c858 Mon Sep 17 00:00:00 2001 From: shenxianpeng Date: Tue, 27 May 2025 22:14:53 +0300 Subject: [PATCH 1/3] fix: update scripts to make it work --- .github/dependabot.yml | 10 ++++++++++ LICENSE | 3 ++- README.md | 34 +++++++++++++++++----------------- bin/help.overview | 2 +- contributing.md | 2 +- lib/utils.bash | 2 +- 6 files changed, 32 insertions(+), 21 deletions(-) create mode 100644 .github/dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..8edf928 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,10 @@ +version: 2 +updates: + - package-ecosystem: github-actions + directory: / + schedule: + interval: "weekly" + groups: + actions: + patterns: + - "*" diff --git a/LICENSE b/LICENSE index 02bc034..31821c7 100644 --- a/LICENSE +++ b/LICENSE @@ -1,7 +1,8 @@ MIT License -Copyright (c) [year] [fullname] +Copyright (c) 2025 cpp-linter team +Copyright (c) 2021 Andy Mroczkowski Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index 3ba5212..8c8bdd3 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@
-# asdf-clang-tools [![Build](https://github.com/amrox/asdf-clang-tools/actions/workflows/build.yml/badge.svg)](https://github.com/amrox/asdf-clang-tools/actions/workflows/build.yml) [![Lint](https://github.com/amrox/asdf-clang-tools/actions/workflows/lint.yml/badge.svg)](https://github.com/amrox/asdf-clang-tools/actions/workflows/lint.yml) +# asdf-clang-tools [![Build](https://github.com/cpp-linter/asdf-clang-tools/actions/workflows/build.yml/badge.svg)](https://github.com/cpp-linter/asdf-clang-tools/actions/workflows/build.yml) [![Lint](https://github.com/cpp-linter/asdf-clang-tools/actions/workflows/lint.yml/badge.svg)](https://github.com/cpp-linter/asdf-clang-tools/actions/workflows/lint.yml) -[clang-tools](https://github.com/muttleyxd/clang-tools-static-binaries) plugin for the [asdf version manager](https://asdf-vm.com). +[clang-tools](https://github.com/cpp-linter/clang-tools-static-binaries) plugin for the [asdf version manager](https://asdf-vm.com).
@@ -12,14 +12,15 @@ This is an asdf plugin for installing several clang tools: - clang-format -- clang-query - clang-tidy +- clang-query +- clang-apply-replacements -This plugin uses the pre-compiled binaries from the very handy [muttleyxd/clang-tools-static-binaries](https://github.com/muttleyxd/clang-tools-static-binaries) repo. +This plugin uses the pre-compiled binaries from the very handy [cpp-linter/clang-tools-static-binaries](https://github.com/cpp-linter/clang-tools-static-binaries) repo. ## Caveats -- Again, the source for these binaries is currently [muttleyxd/clang-tools-static-binaries](https://github.com/muttleyxd/clang-tools-static-binaries). Please make sure you trust that repository. +- Again, the source for these binaries is currently [cpp-linter/clang-tools-static-binaries](https://github.com/cpp-linter/clang-tools-static-binaries). Please make sure you trust that repository. - Only Intel (`x86_64`/`amd64`) binaries are currently provided. - These binaries do work on macOS with Apple Silicon, but they will run under Rosetta. - Signed binaries are not provided for macOS. This plugin will offer to de-quarantine the binaries for you, but please make sure you understand the consequences. @@ -31,19 +32,20 @@ This plugin uses the pre-compiled binaries from the very handy [muttleyxd/clang- # Install -This plugin supports multiple tools (similar to [asdf-hashicorp](https://github.com/asdf-community/asdf-hashicorp) and [asdf-pyapp](https://github.com/amrox/asdf-pyapp). +This plugin supports multiple tools (similar to [asdf-hashicorp](https://github.com/asdf-community/asdf-hashicorp) and [asdf-pyapp](https://github.com/cpp-linter/asdf-pyapp). | Tool | Command to add Plugin | | ------------ | ---------------------------------------------------------------------------- | -| clang-format | `asdf plugin add clang-format https://github.com/amrox/asdf-clang-tools.git` | -| clang-query | `asdf plugin add clang-query https://github.com/amrox/asdf-clang-tools.git` | -| clang-tidy | `asdf plugin add clang-tidy https://github.com/amrox/asdf-clang-tools.git` | +| clang-format | `asdf plugin add clang-format https://github.com/cpp-linter/asdf-clang-tools.git` | +| clang-query | `asdf plugin add clang-query https://github.com/cpp-linter/asdf-clang-tools.git` | +| clang-tidy | `asdf plugin add clang-tidy https://github.com/cpp-linter/asdf-clang-tools.git` | +| clang-apply-replacements | `asdf plugin add clang-apply-replacements https://github.com/cpp-linter/asdf-clang-tools.git` | Example: ```shell -asdf plugin add clang-format https://github.com/amrox/asdf-clang-tools.git +asdf plugin add clang-format https://github.com/cpp-linter/asdf-clang-tools.git ``` clang-format: @@ -55,8 +57,8 @@ asdf list-all clang-format # Install specific version asdf install clang-format latest -# Set a version globally (on your ~/.tool-versions file) -asdf global clang-format latest +# Set a version (on your ~/.tool-versions file) +asdf set clang-format latest # Now clang-tools commands are available clang-format @@ -70,18 +72,16 @@ install & manage versions. ## Environment Variables - `ASDF_CLANG_TOOLS_MACOS_DEQUARANTINE`: set to "1" to automatically de-quarantine binaries. Otherwise, it will interactively ask to do so. -- `ASDF_CLANG_TOOLS_LINUX_IGNORE_ARCH`: set to "1" to install the `amd64` binary regardless of the host architecture. The [clang-tools](https://github.com/muttleyxd/clang-tools-static-binaries) project does not currently provide `arm64`/`aarch64` Linux binaries. This assumes that you have set up [QEMU User Emulation](https://wiki.debian.org/QemuUserEmulation) (or similar) to run foreign binaries under emulation. +- `ASDF_CLANG_TOOLS_LINUX_IGNORE_ARCH`: set to "1" to install the `amd64` binary regardless of the host architecture. The [clang-tools](https://github.com/cpp-linter/clang-tools-static-binaries) project does not currently provide `arm64`/`aarch64` Linux binaries. This assumes that you have set up [QEMU User Emulation](https://wiki.debian.org/QemuUserEmulation) (or similar) to run foreign binaries under emulation. # Acknowledgements -Thank you to the authors and contributors to [muttleyxd/clang-tools-static-binaries](https://github.com/muttleyxd/clang-tools-static-binaries). +Thank you to the authors and contributors to [cpp-linter/clang-tools-static-binaries](https://github.com/cpp-linter/clang-tools-static-binaries). # Contributing Contributions of any kind welcome! See the [contributing guide](contributing.md). -[Thanks goes to these contributors](https://github.com/amrox/asdf-clang-tools/graphs/contributors)! - # License -See [LICENSE](LICENSE) © [Andy Mroczkowski](https://github.com/amrox/) +See [LICENSE](LICENSE) diff --git a/bin/help.overview b/bin/help.overview index bdf52f1..94af043 100755 --- a/bin/help.overview +++ b/bin/help.overview @@ -1,3 +1,3 @@ #!/usr/bin/env bash -echo "asdf plugin for clang tools - clang-format, clang-tidy, clang-query" +echo "asdf plugin for clang tools - clang-format, clang-tidy, clang-query, clang-apply-replacements, and more" diff --git a/contributing.md b/contributing.md index c04a636..28998e0 100644 --- a/contributing.md +++ b/contributing.md @@ -6,7 +6,7 @@ Testing Locally: asdf plugin test [--asdf-tool-version ] [--asdf-plugin-gitref ] [test-command*] # -asdf plugin test clang-tools https://github.com/amrox/asdf-clang-tools.git "clang-format" +asdf plugin test clang-tools https://github.com/cpp-linter/asdf-clang-tools.git "clang-format" ``` Tests are automatically run in GitHub Actions on push and PR. diff --git a/lib/utils.bash b/lib/utils.bash index 0de9c33..63ef335 100644 --- a/lib/utils.bash +++ b/lib/utils.bash @@ -6,7 +6,7 @@ set -euo pipefail ASDF_CLANG_TOOLS_MACOS_DEQUARANTINE=${ASDF_CLANG_TOOLS_MACOS_DEQUARANTINE:-0} ASDF_CLANG_TOOLS_LINUX_IGNORE_ARCH=${ASDF_CLANG_TOOLS_LINUX_IGNORE_ARCH:-0} -GH_REPO="muttleyxd/clang-tools-static-binaries" +GH_REPO="cpp-linter/clang-tools-static-binaries" PLUGIN_NAME="clang-tools" USE_KERNEL= USE_ARCH= From 44741ddb7fe7d9932089370720640926792b5881 Mon Sep 17 00:00:00 2001 From: shenxianpeng Date: Tue, 27 May 2025 22:49:19 +0300 Subject: [PATCH 2/3] feat: add pre-commit-config.yaml --- .github/workflows/lint.yml | 6 ++++++ .pre-commit-config.yaml | 8 ++++++++ README.md | 12 +++--------- 3 files changed, 17 insertions(+), 9 deletions(-) create mode 100644 .pre-commit-config.yaml diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 7758aab..586e7cd 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -34,3 +34,9 @@ jobs: - name: Run shfmt run: scripts/shfmt.bash + - name: Run pre-commit hooks + uses: pre-commit/action@v3.0.0 + with: + extra_args: --all-files + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..ee50e08 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,8 @@ +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v5.0.0 + hooks: + - id: trailing-whitespace + - id: end-of-file-fixer + - id: check-added-large-files + - id: check-yaml diff --git a/README.md b/README.md index 8c8bdd3..2d88529 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,7 @@ # asdf-clang-tools [![Build](https://github.com/cpp-linter/asdf-clang-tools/actions/workflows/build.yml/badge.svg)](https://github.com/cpp-linter/asdf-clang-tools/actions/workflows/build.yml) [![Lint](https://github.com/cpp-linter/asdf-clang-tools/actions/workflows/lint.yml/badge.svg)](https://github.com/cpp-linter/asdf-clang-tools/actions/workflows/lint.yml) - -[clang-tools](https://github.com/cpp-linter/clang-tools-static-binaries) plugin for the [asdf version manager](https://asdf-vm.com). +[clang-tools](https://github.com/cpp-linter/asdf-clang-tools) plugin for the [asdf version manager](https://asdf-vm.com). @@ -32,7 +31,7 @@ This plugin uses the pre-compiled binaries from the very handy [cpp-linter/clang # Install -This plugin supports multiple tools (similar to [asdf-hashicorp](https://github.com/asdf-community/asdf-hashicorp) and [asdf-pyapp](https://github.com/cpp-linter/asdf-pyapp). +Plugin: | Tool | Command to add Plugin | | ------------ | ---------------------------------------------------------------------------- | @@ -41,7 +40,6 @@ This plugin supports multiple tools (similar to [asdf-hashicorp](https://github. | clang-tidy | `asdf plugin add clang-tidy https://github.com/cpp-linter/asdf-clang-tools.git` | | clang-apply-replacements | `asdf plugin add clang-apply-replacements https://github.com/cpp-linter/asdf-clang-tools.git` | - Example: ```shell @@ -52,7 +50,7 @@ clang-format: ```shell # Show all installable versions -asdf list-all clang-format +asdf list all clang-format # Install specific version asdf install clang-format latest @@ -74,10 +72,6 @@ install & manage versions. - `ASDF_CLANG_TOOLS_MACOS_DEQUARANTINE`: set to "1" to automatically de-quarantine binaries. Otherwise, it will interactively ask to do so. - `ASDF_CLANG_TOOLS_LINUX_IGNORE_ARCH`: set to "1" to install the `amd64` binary regardless of the host architecture. The [clang-tools](https://github.com/cpp-linter/clang-tools-static-binaries) project does not currently provide `arm64`/`aarch64` Linux binaries. This assumes that you have set up [QEMU User Emulation](https://wiki.debian.org/QemuUserEmulation) (or similar) to run foreign binaries under emulation. -# Acknowledgements - -Thank you to the authors and contributors to [cpp-linter/clang-tools-static-binaries](https://github.com/cpp-linter/clang-tools-static-binaries). - # Contributing Contributions of any kind welcome! See the [contributing guide](contributing.md). From 9f150ce1cb55041347097dd41112d6f67aad8160 Mon Sep 17 00:00:00 2001 From: shenxianpeng Date: Tue, 27 May 2025 22:55:02 +0300 Subject: [PATCH 3/3] test all plugins --- .github/workflows/build.yml | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 340d688..d4e5f2f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -11,15 +11,27 @@ jobs: name: asdf plugin test strategy: matrix: - os: - - ubuntu-latest - - macos-latest + os: [ubuntu-latest, macos-latest] + plugin: + - clang-format + - clang-tidy + - clang-query + - clang-apply-replacements + include: + - plugin: clang-format + command: clang-format --version + - plugin: clang-tidy + command: clang-tidy --version + - plugin: clang-query + command: clang-query --version + - plugin: clang-apply-replacements + command: clang-apply-replacements --version runs-on: ${{ matrix.os }} steps: - - name: asdf_plugin_test + - name: Test ${{ matrix.plugin }} uses: asdf-vm/actions/plugin-test@v1 env: ASDF_CLANG_TOOLS_MACOS_DEQUARANTINE: 1 with: - plugin: clang-format - command: clang-format --version + plugin: ${{ matrix.plugin }} + command: ${{ matrix.command }}