-
Notifications
You must be signed in to change notification settings - Fork 67
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
oclint multiple execution and inability to see the output #45
Comments
Thanks for reporting this bug. Can you provide an Minimum Reproducible Example, including the .pre-commit-config.yaml? |
Hi! sorry for the late reply. Things to note:
without the main.h file was added this was the output that I got: git commit
oclint...................................................................Failed
- hook id: oclint
- exit code: 5
oclint: error: violations exceed threshold
P1=0[0] P2=0[10] P3=2[0] After the introduction of the main.h file the output changed to this: oclint...................................................................Failed
- hook id: oclint
- exit code: 5
oclint: error: violations exceed threshold
P1=0[0] P2=0[10] P3=2[0]
oclint: error: violations exceed threshold
P1=0[0] P2=0[10] P3=1[0] The commit that was tested was f574e03 so... all the file added to the initial commit. Does it helps you? |
So the reason that it goes over every file is that you have After running
Compare that to pre-commit-hooks, which shows no error output.
I should have more time to address this on Sunday. |
Hi! Thank you for looking into this.
What I mean anyhow is that:
Also if it is failing, it does not produce any output / report. Therefore
you need to run Oclint by itself in order to understand why it is failing.
If Oclint is failing, owever, in my opinion would be useful to have the
reason of the failing as output. You can then use the clicks to show the
lines of code that causes the warnings.
Another thing :
Oclint has the ability to produce a single report of all the files are
passed to Oclint.
It could be controversial running Oclint on a single file or on multiple
files. The 1,2,3 limits are on run level, not per file. Therefore what is
executed correctly on a single file, could fail on the multiple file level.
Il sab 16 apr 2022, 08:43 Ross Jacobs ***@***.***> ha scritto:
… So the reason that it goes over every file is that you have fail_fast:
false in your .pre-commit-config.yaml.
After running cmake . on your repo, I see this output:
$ oclint *.c *.h Test/*.c -enable-global-analysis -enable-clang-static-analyzer -max-priority-3 0
Clang Static Analyzer Results:
/home/rj/code/oclind_demo_multiple_run/test.c:4:3: Assigned value is garbage or undefined [core.uninitialized.Assign]
/home/rj/code/oclind_demo_multiple_run/test.c:4:7: Value stored to 'a' during its initialization is never read [deadcode.DeadStores]
OCLint Report
Summary: TotalFiles=5 FilesWithViolations=5 P1=0 P2=0 P3=7
/home/rj/code/oclind_demo_multiple_run/main.c:2:10: unused method parameter [unused|P3] The parameter 'argc' is unused.
/home/rj/code/oclind_demo_multiple_run/main.c:2:20: unused method parameter [unused|P3] The parameter 'argv' is unused.
/home/rj/code/oclind_demo_multiple_run/test.c:4:3: short variable name [naming|P3] Length of variable name `a` is 1, which is shorter than the threshold of 3
/home/rj/code/oclind_demo_multiple_run/test2.c:3:11: short variable name [naming|P3] Length of variable name `i` is 1, which is shorter than the threshold of 3
/home/rj/code/oclind_demo_multiple_run/main.h:4:11: short variable name [naming|P3] Length of variable name `i` is 1, which is shorter than the threshold of 3
/home/rj/code/oclind_demo_multiple_run/Test/test_main.c:1:10: unused method parameter [unused|P3] The parameter 'argc' is unused.
/home/rj/code/oclind_demo_multiple_run/Test/test_main.c:1:20: unused method parameter [unused|P3] The parameter 'argv' is unused.
[OCLint (https://oclint.org) v21.05]
oclint: error: violations exceed threshold
P1=0[0] P2=0[10] P3=7[0]
Compare that to pre-commit-hooks, which shows no error output.
$ pre-commit run -a
oclint...................................................................Failed
- hook id: oclint
- exit code: 5
oclint: error: violations exceed threshold
P1=0[0] P2=0[10] P3=2[0]
I should have more time to address this on Sunday.
—
Reply to this email directly, view it on GitHub
<#45 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABNUWWXERK2DQBNXSQ27AZLVFJOSJANCNFSM5TOBJJUQ>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Hi!
I am trying to configure the pre-commit hook with oclint.
What I am noticing is that while executing the commit the program is executed but...
as an example this is the output that I get from a test application:
oclint...................................................................Failed - hook id: oclint - exit code: 5 oclint: error: violations exceed threshold P1=0[0] P2=0[0] P3=3[0] oclint: error: violations exceed threshold P1=0[0] P2=0[0] P3=2[0] oclint: error: violations exceed threshold P1=0[0] P2=1[0] P3=1[0] oclint: error: violations exceed threshold P1=0[0] P2=0[0] P3=3[0] oclint: error: violations exceed threshold P1=0[0] P2=0[0] P3=4[0] oclint: error: violations exceed threshold P1=0[0] P2=0[0] P3=1[0] oclint: error: violations exceed threshold P1=0[0] P2=2[0] P3=3[0] oclint: error: violations exceed threshold P1=0[0] P2=0[0] P3=1[0]
If I try to attach the html output in the configuration yaml, then the file is always rewritten with the last run. If I execute oclint from command line, then, I have an html file that groups all the outputs from every file.
The text was updated successfully, but these errors were encountered: