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

Conversation

mdeweerd
Copy link
Contributor

Qual: Add pre-commit configuration & ci

Add initial pre-commit configuration also run in ci.

@mdeweerdmdeweerdforce-pushed theflow/pre-commit branch 5 times, most recently from4c1f3f3 to00b4a5bCompareApril 5, 2025 15:39
@guy-maurel
Copy link
Contributor

Well, first thanks for the PR.
I am the maintainer of uncrustify.
Avez vous une adresse en France?

These PR are too big for us to accept.
I prefer some little step.
Let us try at new!

Some of the files you have tested are
too old or never used by me before,
some have been included by error.
I/we need to remove some of them before.

Thanks, à bientôt.

@mdeweerd
Copy link
ContributorAuthor

Oui, j'ai une adresse en France.

On peut désactiver des hooks (=hook-stage manual) et activer 1 par 1 chacun avec ses résulutions.
Ou exclure des fichiers/répertoires...

Je peux écrire sur votre adresse (mél. git).

@mdeweerdmdeweerdforce-pushed theflow/pre-commit branch 5 times, most recently froma3fe160 to76d198dCompareApril 8, 2025 17:28
@mdeweerd
Copy link
ContributorAuthor

I think I understand what was meant now: this PR included some changes of the other PRs to check which changes were still recommended by the tools.

This PR is now reduced to the pre-commit configuration.

A limited list of the notices from the tools can be checked in the files tab. You need to go to the end of the contents to see some:
https://github.com/uncrustify/uncrustify/pull/4494/files

@mdeweerdmdeweerdforce-pushed theflow/pre-commit branch 2 times, most recently from8e22be0 to495ab61CompareApril 26, 2025 15:34
@mdeweerdmdeweerdforce-pushed theflow/pre-commit branch 13 times, most recently from0487f7d to42ec7f1CompareApril 27, 2025 00:21
@mdeweerd
Copy link
ContributorAuthor

I reorganized the commit to trigger anotherappveyor run. If still in error, then gcc's snprintf and MSVC's v19's snprintf are different.

I must admit that I find the ElidedText function a bit odd.
It either produces strings of length <= truncate_value and also string of lengthtruncate_value + 30.

  • Suppose "test_it" is 41 characters long, with a truncate value of 40.
    Thentest_it_length < 40 + 30 and we truncate test_it to 40 - 30 = 10 characters. And we append '... ', ending up with 40 characters and and EOS token.

  • Now suppose "test_it" is 80 characters long, with a truncate value of 40.
    Thentest_it_length > 40 + 30 and we truncate test_it to 30 characters. And we append '... ', ending up with 60 characters and and EOS token.

IMHO, in these cases the code should always take 10 characters from the source string, and append the ' ... <>' string, always limiting to 40 characters.

It is possible that that this code intended to manage another corner case: when 'truncate_value <30' in which case the string we append would not fit in the maximum line size.

@mdeweerdmdeweerdforce-pushed theflow/pre-commit branch 2 times, most recently from026ba54 to3baf613CompareApril 28, 2025 21:49
cpplint considers that the if condition does not have a code blockbecause of the empty line
The `cstdio` header is required for the `reset` method implementation.Remove virtual, already implied by override.
- Replace strcpy with snprintf for safer and more controlled string formatting
- Replace strcpy with snprintf to avoid buffer overflow- Add necessary includes for snprintf and make_pair
This change replaces the use of `strcpy` with `snprintf`
- Replace `strcpy` with `strncpy` to prevent buffer overflow
- Add cpplint hook to enforce coding standards- Update cpplint arguments to exclude specific files with hard to  suppress warnings.
- Define `MAIN_MAX_ARGS_LENGTH` constant for buffer size- Use `MAIN_MAX_ARGS_LENGTH` for buffer size and length checks- Update error message for buffer size checkFixes:src/uncrustify.cpp:704:  Do not use variable-length arrays.  Use an appropriately named ('k' followed by CamelCase) compile-time constant for the size.  [runtime/arrays] [1]src/uncrustify.cpp:834:  Do not use variable-length arrays.  Use an appropriately named ('k' followed by CamelCase) compile-time constant for the size.  [runtime/arrays] [1]src/uncrustify.cpp:1663:  If/else bodies with multiple statements require braces  [readability/braces] [4]src/uncrustify.cpp:1665:  If/else bodies with multiple statements require braces  [readability/braces] [4]
The assignment operator for the Option class has been updated to use a const reference for the input parameter. This change ensures that the operator can accept both lvalue and rvalue references, improving flexibility and performance.Fixes:src/option.h(195): performance (passedByValue): Function parameter 'val' should be passed by const reference.
- Add new constructor for flags(int_t flag)- Simplify operator overloads to use direct return statementsFixes:src/pcf_flags.h(85): error (returnDanglingLifetime): Returning object that points to local variable 'f2' that will be invalid when returning.
@mdeweerd
Copy link
ContributorAuthor

mdeweerd commentedApr 29, 2025
edited
Loading

These are the remaining notices with "Cppcheck 2.17.1"

src\log_rules.cpp(72): warning (nullPointerOutOfMemory): If memory allocation fails, then there is a possible null pointer dereference: rsrc\log_rules.cpp(99): warning (nullPointerOutOfMemory): If memory allocation fails, then there is a possible null pointer dereference: rsrc\log_rules.cpp(126): warning (nullPointerOutOfMemory): If memory allocation fails, then there is a possible null pointer dereference: rsrc\keywords.cpp(217): error (uninitvar): Uninitialized variables: &key.type, &key.lang_flags

The notice

src/pcf_flags.h(85): error (returnDanglingLifetime): Returning object that points to local variable 'f2' that will be invalid when returning.

is gone with that cppcheck version (I fixed it) and seems to be a false positive at this point in the github runner probably using a different cppcheck version.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@gmaurelgmaurelAwaiting requested review from gmaurelgmaurel will be requested when the pull request is marked ready for reviewgmaurel is a code owner

@mwoehlke-kitwaremwoehlke-kitwareAwaiting requested review from mwoehlke-kitwaremwoehlke-kitware will be requested when the pull request is marked ready for reviewmwoehlke-kitware is a code owner

@micheleCTDEAdminmicheleCTDEAdminAwaiting requested review from micheleCTDEAdminmicheleCTDEAdmin will be requested when the pull request is marked ready for reviewmicheleCTDEAdmin is a code owner

@PoeticPeteAdminPoeticPeteAdminAwaiting requested review from PoeticPeteAdminPoeticPeteAdmin will be requested when the pull request is marked ready for reviewPoeticPeteAdmin is a code owner

At least 1 approving review is required to merge this pull request.

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@mdeweerd@guy-maurel

[8]ページ先頭

©2009-2025 Movatter.jp