From 3b2f12dc8c673264ed86152bfe07a09ec8a43b15 Mon Sep 17 00:00:00 2001 From: shenxianpeng Date: Thu, 7 Mar 2024 23:47:04 +0800 Subject: [PATCH 1/2] Update README.md --- LICENSE | 2 +- README.md | 24 +++++++++++------------- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/LICENSE b/LICENSE index 09feb1b..d3d6c40 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2022 Peter Shen +Copyright (c) 2022 Xianpeng Shen 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 3eaac3a..83d78d6 100644 --- a/README.md +++ b/README.md @@ -8,14 +8,14 @@ -Using `clang-format` and `clang-tidy` hooks with [pre-commit](https://pre-commit.com/) to lint your C/C++ code. +`cpp-linter-hooks` integrates `clang-format` and `clang-tidy` hooks with [pre-commit](https://pre-commit.com/) to lint your C/C++ code efficiently. > [!NOTE] -> Automatically downloads a specific version of `clang-format` or `clang-tidy` [binaries](https://github.com/cpp-linter/clang-tools-static-binaries) and installs it on the system. +> This hook automatically downloads a specific version of `clang-format` or `clang-tidy` [binaries](https://github.com/cpp-linter/clang-tools-static-binaries) and installs it on the system. ## Usage -Add this to your `.pre-commit-config.yaml` +Add the following configuration to your `.pre-commit-config.yaml`: ```yaml repos: @@ -28,7 +28,7 @@ repos: args: [--checks='boost-*,bugprone-*,performance-*,readability-*,portability-*,modernize-*,clang-analyzer-*,cppcoreguidelines-*'] ``` -The example of using custom config: `.clang-format` and `.clang-tidy` +To use custom configurations like `.clang-format` and `.clang-tidy`: ```yaml repos: @@ -41,7 +41,7 @@ repos: args: [--checks=.clang-tidy] # path/to/.clang-tidy ``` -The example of using any version of [clang-tools](https://github.com/cpp-linter/clang-tools-pip?tab=readme-ov-file#supported-versions). +To use specific versions of [clang-tools](https://github.com/cpp-linter/clang-tools-pip?tab=readme-ov-file#supported-versions): ```yaml repos: @@ -49,9 +49,9 @@ repos: rev: v0.3.0 hooks: - id: clang-format - args: [--style=file, --version=16] + args: [--style=file, --version=16] # Specifies version - id: clang-tidy - args: [--checks=.clang-tidy, --version=16] + args: [--checks=.clang-tidy, --version=16] # Specifies version ``` ## Output @@ -64,7 +64,7 @@ clang-format.............................................................Failed - files were modified by this hook ``` -Here is the diff between the modified file. +The diff between the modified file is as follows: ```diff --- a/testing/main.c @@ -80,9 +80,7 @@ Here is the diff between the modified file. +} ``` -Pass `--dry-run` to the `args` of `clang-format`(can also pass other arg which clang-format supports) - -Then it will just print instead of changing the format. E.g: +Use `--dry-run` in `args` of `clang-format` to print instead of changing the format, e.g.: ```bash clang-format.............................................................Failed @@ -128,8 +126,8 @@ Use -header-filter=.* to display errors from all non-system headers. Use -system ## Contributing -Any contribution is very welcome, including submitting issues, PRs, etc. +Contributions are very welcome, including submitting issues, PRs, etc. ## License -This project is licensed under the terms of the MIT license. +[MIT](LICENSE) From e337affca75a62f1b9ae797cbce358f45f1334b7 Mon Sep 17 00:00:00 2001 From: shenxianpeng Date: Thu, 7 Mar 2024 23:47:52 +0800 Subject: [PATCH 2/2] Bump version to v0.3.1 --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 83d78d6..5e59fe8 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ Add the following configuration to your `.pre-commit-config.yaml`: ```yaml repos: - repo: https://github.com/cpp-linter/cpp-linter-hooks - rev: v0.3.0 # Use the ref you want to point at + rev: v0.3.1 # Use the ref you want to point at hooks: - id: clang-format args: [--style=Google] # Other coding style: LLVM, GNU, Chromium, Microsoft, Mozilla, WebKit. @@ -33,7 +33,7 @@ To use custom configurations like `.clang-format` and `.clang-tidy`: ```yaml repos: - repo: https://github.com/cpp-linter/cpp-linter-hooks - rev: v0.3.0 + rev: v0.3.1 hooks: - id: clang-format args: [--style=file] # to load .clang-format @@ -46,7 +46,7 @@ To use specific versions of [clang-tools](https://github.com/cpp-linter/clang-to ```yaml repos: - repo: https://github.com/cpp-linter/cpp-linter-hooks - rev: v0.3.0 + rev: v0.3.1 hooks: - id: clang-format args: [--style=file, --version=16] # Specifies version