ci: Remove cmake-format linter

This commit is contained in:
Nick Bolton
2024-10-15 13:15:59 +01:00
parent 28c8aae9af
commit 2b930a7b03
7 changed files with 9 additions and 131 deletions

View File

@ -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"

View File

@ -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"

View File

@ -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

View File

@ -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

View File

@ -7,7 +7,6 @@
"aqtinstall",
"Axelson",
"Breen",
"cmakelang",
"codesign",
"codesigning",
"Compat",

View File

@ -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 <http://www.gnu.org/licenses/>.
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()

View File

@ -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",