Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Qual: Add pre-commit configuration & ci#4494

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
mdeweerd wants to merge23 commits intouncrustify:master
base:master
Choose a base branch
Loading
frommdeweerd:flow/pre-commit
Draft
Show file tree
Hide file tree
Changes from1 commit
Commits
Show all changes
23 commits
Select commitHold shift + click to select a range
2127062
Qual: Setup pre-commit flow
mdeweerdApr 27, 2025
7ec1c60
Qual: Include-what-you-use (add missing includes only)
mdeweerdApr 27, 2025
fa5a635
Qual: remove whitespace after if condition
mdeweerdApr 27, 2025
bce7445
Qual: Include-what-you-use + *_cast<>() + const qualifiers
mdeweerdApr 27, 2025
9a16e7e
Qual: Include-what-you-use + static_cast<>()
mdeweerdApr 27, 2025
5ba5409
Qual: Include-what-you-use + static_cast<>()
mdeweerdApr 27, 2025
95e5df1
build: add missing cstdio include, remove unneeded virtual
mdeweerdApr 27, 2025
14073ed
refactor(language_names): use snprintf for string formatting
mdeweerdApr 27, 2025
6b0d31e
refactor(log_rules): use snprintf for safe string copying
mdeweerdApr 27, 2025
2c9c0bb
refactor: use snprintf instead of strcpy
mdeweerdApr 27, 2025
184250c
refactor(tokenizer): include deque, replace tabs with \t, static_cast
mdeweerdApr 27, 2025
ea80534
Qual: output.cpp - include-what-you-use
mdeweerdApr 27, 2025
06ba65f
Qual: output.cpp - static_cast<>()
mdeweerdApr 27, 2025
70c8068
Qual: output.cpp -static_cast<size_t|char>()
mdeweerdApr 27, 2025
e0d9438
refactor(uncrustify): use strncpy for buffer copying
mdeweerdApr 27, 2025
3003b2a
ci: update cpplint hook in pre-commit configuration
mdeweerdApr 27, 2025
7ab389d
Qual: output.cpp - static_cast<int>()
mdeweerdApr 27, 2025
925eaeb
Qual: Remove empty line after if for cpplint
mdeweerdApr 27, 2025
43c619a
Qual: Add includes (include-what-you-use)
mdeweerdApr 27, 2025
46c4190
Qual: include-what-you-use, const qualifiers, sizeof()
mdeweerdApr 27, 2025
a1263f3
refactor(uncrustify): improve buffer size handling in main function
mdeweerdApr 29, 2025
e36b212
refactor(option): update assignment operator to use const reference
mdeweerdApr 29, 2025
7c824d1
refactor(enum_flags): simplify flags constructor and operators
mdeweerdApr 29, 2025
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
NextNext commit
Qual: Setup pre-commit flow
  • Loading branch information
@mdeweerd
mdeweerd committedApr 29, 2025
commit2127062b83575c0c89ea6413946c93821c33823d
46 changes: 46 additions & 0 deletions.github/workflows/pre-commit.yml
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
---
name: pre-commit
on:
pull_request:
push:
jobs:
pre-commit:
runs-on: ubuntu-latest
env:
RAW_LOG: pre-commit.log
CS_XML: pre-commit.xml
steps:
- run: sudo apt-get update && sudo apt-get install cppcheck uncrustify
- uses: actions/checkout@v4
- run: python -m pip install pre-commit
- uses: actions/cache/restore@v4
with:
path: ~/.cache/pre-commit/
key: pre-commit-4|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }}
- name: Run pre-commit hooks
env:
SKIP: no-commit-to-branch
run: |
set -o pipefail
pre-commit gc
pre-commit run --show-diff-on-failure --color=always --all-files | tee ${RAW_LOG}
- name: Convert Raw Log to Checkstyle format (launch action)
uses: mdeweerd/logToCheckStyle@v2025.1.1
if: ${{ failure() }}
with:
in: ${{ env.RAW_LOG }}
# out: ${{ env.CS_XML }}
- uses: actions/cache/save@v4
if: ${{ ! cancelled() }}
with:
path: ~/.cache/pre-commit/
key: pre-commit-4|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }}
- name: Provide log as artifact
uses: actions/upload-artifact@v4
if: ${{ ! cancelled() }}
with:
name: precommit-logs
path: |
${{ env.RAW_LOG }}
${{ env.CS_XML }}
retention-days: 2
104 changes: 104 additions & 0 deletions.pre-commit-config.yaml
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
---
exclude:
(?x)^(
__NONE__)$
repos:
- repo: https://github.com/executablebooks/mdformat
# Do this before other tools "fixing" the line endings
rev: 0.7.22
hooks:
- id: mdformat
name: Format Markdown
stages: [manual]
entry: mdformat # Executable to run, with fixed options
language: python
types: [markdown]
args: [--wrap, '75', --number]
additional_dependencies:
- mdformat-toc
- mdformat-gfm
- mdformat-beautysh
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
# - id: no-commit-to-branch
# args: [--branch, main]
- id: debug-statements
- id: end-of-file-fixer
exclude: ^(tests/.*)$
- id: trailing-whitespace
exclude: ^(tests/.*|.*\.md)$
- id: check-json
- id: mixed-line-ending
exclude: ^(tests/.*)$
- id: check-builtin-literals
args: [--ignore=dict]
- id: check-ast
- id: check-merge-conflict
- id: check-executables-have-shebangs
- id: check-shebang-scripts-are-executable
exclude: ^(test/.*)$
- id: check-docstring-first
- id: fix-byte-order-marker
exclude: ^(tests/.*)$
- id: check-case-conflict
- id: check-toml
- repo: https://github.com/lovesegfault/beautysh.git
rev: v6.2.1
hooks:
- id: beautysh
args: [--indent-size=2]
exclude: (?x)^(test/test\..*|config/missing|configure|autogen\.sh)$
additional_dependencies:
- setuptools
- repo: https://github.com/codespell-project/codespell
rev: v2.4.1
hooks:
- id: codespell
# scripts/updateCodespellIgnoreFile.sh updates the ignore file.
exclude: (?x)^(emscripten/build\.sh)$
args:
- --builtin=clear,informal,names
- -xscripts/codespell-lines-ignore.txt
# - --toml
# - pyproject.toml
additional_dependencies:
- tomli
- repo: https://github.com/pocc/pre-commit-hooks
rev: v1.3.5
# Install dependencies on windows:
# choco install llvm uncrustify cppcheck
hooks:
- id: uncrustify
exclude: ^(tests/.*|documentation/.*)$
args: [--replace, --no-backup, -c, forUncrustifySources.cfg, -l, CPP]
- id: cppcheck
exclude: ^(tests/.*|documentation/.*)$
args:
- --force
- --language=c++
- -Isrc
- '--template={file}({line}): {severity} ({id}): {message}'
- --inline-suppr
- --check-level=exhaustive
- --suppress=constParameterPointer
- --suppress=constVariablePointer
- --suppress=missingInclude:*.h
- --suppress=missingIncludeSystem
- --suppress=noCopyConstructor
- --suppress=noExplicitConstructor
- --suppress=noOperatorEq
- --suppress=unmatchedSuppression
- --suppress=unusedFunction
- --suppress=variableScope
- id: cpplint
exclude: ^(tests/.*|documentation/.*)$
args: ["--filter=-build/header_guard,-legal/copyright,-whitespace/indent,-whitespace/newline,-whitespace/braces,-whitespace/comments,-whitespace/line_length,-whitespace/parens,-build/include_order,-readability/todo,-readability/fn_size,-build/include_subdir,-runtime/int,-readability/multiline_comment,-build/namespaces,-runtime/references,-runtime/explicit,-runtime/threadsafe_fn"]
additional_dependencies:
- cpplint>=1.6.1
- repo: https://github.com/shellcheck-py/shellcheck-py
rev: v0.10.0.1
hooks:
- id: shellcheck
# exclude: (?x)^(__NONE__)$
# args: [-x,-e1007,-e1009,-e1072,-e1073]
66 changes: 66 additions & 0 deletionsscripts/codespell-lines-ignore.txt
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@

const UINT aNumber,
// ment is confusing without them. Remember that other people may confuse
: CSuperFoo(something, positionRect, aNumber,
Token* peek( inout Token ct )
ontext.cend()));
__func__, __LINE__, ontext.c_str(), pc.GetOrigLine());
__func__, __LINE__, pc->GetOrigLine(), pc->GetOrigCol(), nam->Text(), get_token_name(nam->GetType()));
idx += static_cast<int>(ontext.size());
nam->SetType(CT_FUNC_TYPE);
nam->SetType(CT_FUNC_VAR);
nam->SetType(CT_PTR_TYPE);
const auto &ontext = options::enable_processing_cmt();
found_enable_pattern = (pc.GetStr().find(ontext.c_str()) >= 0);
idx = text.find(ontext.c_str(),
if (nam->IsString("^"))
mark_function_return_type(nam, tpo->GetPrevNcNnlNi(), pt); // Issue #2279
std::wregex criteria(std::wstring(ontext.cbegin(),
// ment is confusing without them. Remember that other people may confuse
Serial.print ( F ( "-- Erreur dans le fonction Centrer_Nombre_Int_dans_Zone : la valeur calculée de X est négative ou nulle, elle vaut :" ) );
float val_num_prec; // La valeur précédente pour la comparaison
int opApply (int delegate(inout char[]) dg)
int opApply (int delegate(inout char[], inout Object) dg)
* If this is a block literal instead of a block type, 'nam'
"somemore",
Chunk *nam = tpc->GetPrevNcNnlNi(); // name (if any) or '^' Issue #2279
NOO = 1
if ( ontext != UNCRUSTIFY_ON_TEXT
if (nam->IsBraceClose())
Spelling fix: preceeded -> preceded
Token *peek(inout Token ct)
Token* peek(inout Token ct) {
float temp_num_prec; // La valeur précédente pour la comparaison
float val_num_prec; // La valeur précédente pour la comparaison
int humidite_prec; // La valeur précédente pour la comparaison
int opApply(int delegate(inout Type [, ...]) dg);
int opApply(int delegate(inout char[]) dg)
int opApply(int delegate(inout char[], inout Object) dg)
const auto &ontext = options::enable_processing_cmt();
enum hoo { NOO = 1 };
if ( !ontext.empty()
if (!ontext.empty())
{ "inout", CT_QUALIFIER, e_LANG_D },
"${COMMENT# initialy increase memory for big input files }" \
* "afile" => "afile"
"4".Clamp(2, 10).ShouldBe(5);
# GNU format (sorta)
(-5).Clamp(2, 10).ShouldBe(5);
5.Clamp("a", 10).ShouldBe(5);
5.Clamp(-5, 10).ShouldBe(5);
5.Clamp(2, 10).ShouldBe(5);
Author: Tim Hütz <tim@huetz.biz>
CFoo::CFoo(const DWORD something, const RECT& positionRect, const UINT aNumber, bool thisIsReadOnly, const CString& windowTitle, CInfo *pStructInfo, int widthOfSomething) : CSuperFoo(something, positionRect, aNumber,
Tim Hütz
UTFT myGLCD ( SSD1963_800 = 1, 38, 39, 40, 41 ); // (byte model, int RS, int WR, int CS, int RST, int SER)
[Donot Add Nl Before Cpp Comment]
[Donot Indent Func Def Close Paren]
enum class option_type_e // <OT>
float _Temp_Ext_Precedente = -99.9; // La valeur précédente pour la comparaison
fonction ( ( &zeze ), ( ss ) );
fonction ();
int fonction ( ( int *zeze ), ( ss ) ) { ksjbshjdbshjdb = 1;}
int opApply(int delegate(inout Type[, ...]) dg);
jodi.the.tigger@gmail.com
namespace BA
namespace Namepsace
11 changes: 11 additions & 0 deletionsscripts/updateCodespellIgnoreFile.sh
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
#!/bin/bash
# This script updates the codespell ignore file.
# Run it from within the root directory
codespell_ignore_file=$(dirname "$0")/codespell-lines-ignore.txt
echo > "${codespell_ignore_file}"
# When '--git-only' will be available in codespell, use it instead of 'git ls-files'
# shellcheck disable=2046
codespell --builtin "clear,informal,names" $(git ls-files) \
| sed -n -E 's@^([^:]+):[[:digit:]]+:[[:space:]](\S+)[[:space:]].*@git grep -hP '\''\\b\2\\b'\'' -- "\1" >> '"${codespell_ignore_file}"'@p' \
| while read -r line ; do eval "$line" ; done
sort -u "${codespell_ignore_file}" > _tmp.txt ; mv _tmp.txt "${codespell_ignore_file}"

[8]ページ先頭

©2009-2025 Movatter.jp