diff --git a/.github/actions/lint-clang/action.yml b/.github/actions/lint-clang/action.yml index 9bf9f4554..f3a61584b 100644 --- a/.github/actions/lint-clang/action.yml +++ b/.github/actions/lint-clang/action.yml @@ -1,5 +1,5 @@ name: "Lint clang" -description: "Clang Ling Sources" +description: "Lint with Clang formatter" runs: using: "composite" @@ -14,8 +14,8 @@ runs: source .venv/bin/activate pip install pyyaml clang_format - - name: Linting with CMake formatter + - name: Linting with Clang formatter uses: ./.github/actions/lint-error with: format-command: ./scripts/lint_clang.py -f - format-tool: "cmake-format" + format-tool: "clang-format" diff --git a/.github/actions/lint-cmake/action.yml b/.github/actions/lint-cmake/action.yml deleted file mode 100644 index 08a55d9a3..000000000 --- a/.github/actions/lint-cmake/action.yml +++ /dev/null @@ -1,21 +0,0 @@ -name: "Lint cmake" -description: "Lints cmake file" - -runs: - using: "composite" - - steps: - - name: Setup Python venv - uses: ./.github/actions/init-python - - - name: Install dependencies - shell: bash - run: | - source .venv/bin/activate - pip install pyyaml cmake_format - - - name: Linting with CMake formatter - uses: ./.github/actions/lint-error - with: - format-command: ./scripts/lint_cmake.py -f - format-tool: "cmake-format" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9a5b1010a..cc1bf54d7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -31,7 +31,7 @@ env: jobs: pr-comment-flags: runs-on: ubuntu-latest - needs: [lint-cmake, lint-clang] + needs: lint-clang if: ${{ github.event_name == 'pull_request' }} outputs: @@ -79,17 +79,6 @@ jobs: - name: Test summary uses: ./.github/actions/test-summary - lint-cmake: - runs-on: ubuntu-latest - timeout-minutes: 5 - - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Lint Cmake - uses: ./.github/actions/lint-cmake - lint-clang: runs-on: ubuntu-latest timeout-minutes: 5 @@ -102,7 +91,7 @@ jobs: uses: ./.github/actions/lint-clang analyse-valgrind: - needs: [lint-cmake, lint-clang] + needs: lint-clang if: ${{ github.event_name == 'pull_request' }} uses: ./.github/workflows/valgrind-analysis.yml @@ -114,7 +103,7 @@ jobs: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} windows: - needs: [lint-cmake, lint-clang] + needs: lint-clang name: ${{ matrix.target.name }} runs-on: ${{ matrix.target.runs-on }} container: ${{ matrix.target.container }} @@ -202,7 +191,7 @@ jobs: path: ${{ env.PACKAGE_PATH }} macos: - needs: [lint-cmake, lint-clang] + needs: lint-clang name: ${{ matrix.target.name }} runs-on: ${{ matrix.target.os }} timeout-minutes: ${{ matrix.target.timeout }} @@ -283,7 +272,7 @@ jobs: path: ${{ env.PACKAGE_PATH }} linux-matrix: - needs: [lint-cmake, lint-clang] + needs: lint-clang runs-on: ubuntu-latest outputs: @@ -361,7 +350,7 @@ jobs: # Technically, "unix" is a misnomer, but we use it here to mean "Unix-like BSD-derived". unix: - needs: [lint-cmake, lint-clang] + needs: lint-clang name: unix-${{ matrix.distro.name }} runs-on: ${{ vars.CI_UNIX_RUNNER || 'ubuntu-24.04' }} timeout-minutes: 20 diff --git a/cmake-format.yaml b/cmake-format.yaml deleted file mode 100644 index 55be7e342..000000000 --- a/cmake-format.yaml +++ /dev/null @@ -1,10 +0,0 @@ -format: - # Solves line ending issues on Windows. - line_ending: "auto" - - # Any more than 4 args, and function calls become hard to read. - max_pargs_hwrap: 4 - -markup: - # Disable formatting of comments entirely, as this is annoying. - enable_markup: false diff --git a/cspell.json b/cspell.json index 5ba583724..da81bfedc 100644 --- a/cspell.json +++ b/cspell.json @@ -7,7 +7,6 @@ "aqtinstall", "Axelson", "Breen", - "cmakelang", "codesign", "codesigning", "Compat", diff --git a/scripts/lint_cmake.py b/scripts/lint_cmake.py deleted file mode 100755 index cdba81eef..000000000 --- a/scripts/lint_cmake.py +++ /dev/null @@ -1,78 +0,0 @@ -#!/usr/bin/env python3 - -# Deskflow -- mouse and keyboard sharing utility -# Copyright (C) 2024 Symless Ltd. -# -# This package is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# found in the file LICENSE that should have accompanied this file. -# -# This package is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -import lib.env as env - -env.ensure_in_venv(__file__) - -import sys, argparse -import lib.fs as fs -from cmakelang.format.__main__ import main as cmake_format_main # type: ignore - -INCLUDE_FILES = [ - "*.cmake", - "CMakeLists.txt", -] - -EXCLUDE_DIRS = [ - "build", - ".venv", - "deps", - "subprojects", -] - - -def main(): - """ - Cross-platform equivalent of using find and xargs with cmake-format. - Lints by performing a dry run (--check) which fails when formatting is needed. - """ - parser = argparse.ArgumentParser() - parser.add_argument( - "-f", - "--format", - action="store_true", - help="In-place format all files", - ) - args = parser.parse_args() - - cmd_args = ["--in-place"] if args.format else ["--check"] - files_recursive = fs.find_files(".", INCLUDE_FILES, EXCLUDE_DIRS) - - if args.format: - print("Formatting files with CMake formatter:") - else: - print("Checking files with CMake formatter:") - - for file in files_recursive: - print(file) - - if files_recursive: - sys.argv = [""] + cmd_args + files_recursive - - result = cmake_format_main() - if result == 0: - print("CMake lint passed") - - sys.exit(result) - else: - print("No CMake files found to process.", file=sys.stderr) - sys.exit(0) - - -if __name__ == "__main__": - main() diff --git a/scripts/pyproject.toml b/scripts/pyproject.toml index 4fb0d669a..3de1f1ceb 100644 --- a/scripts/pyproject.toml +++ b/scripts/pyproject.toml @@ -4,7 +4,6 @@ version = "0.0.1" description = "Scripts to assist with development of Deskflow" requires-python = ">=3.9" dependencies = [ - "cmake_format", "clang-format", "python-dotenv", "pyyaml",