Uncrustify - only report errors without changing the file - c++

Is it possible to only list the set of rules which would have failed on input file without actually applying them? I find it too harsh to just modify the file without letting developer know that file is getting changed under the hood but I would like to get common coding standards and cause build breaks when rules are broken.
I know about --check flag but it only returns whether it succeeded or not without letting developer know which rule failed on which line. Perfectly I would like to get something like:
test.cpp - uncrustify failed on line 42, incorrect use of tabs - pos 0:6.
Also if you know other options where this could be more easily achieved please let me know.

Related

VS Code C++ Automatic Syntax Error Highlighting?

Currently VS Code will only highlight errors when the file is saved. This can get bothersome, as it isn't immediately apparent sometimes if you've mistyped something or are using something wrong etc.
Is there a way to make VS Code automatically show syntax/logical errors i.e red/green squiggles underneath code?
I am working with python but I have the same problem.
As shown here: "Linting runs automatically when you save a file."
Therefore, what I did to automatically lint, is enable Auto Save. With this configuration you can achieve linting almost in real time.
I guess that for C++ will work similar. Hope it helps.

Vim syntastic error messages always hidden

Syntastic does not seem to work properly for me. It is installed, :SyntasticInfo says everything is fine (active mode enabled, filetype cpp, checker is ycm). At first glance everything seems to be fine because it looks like this:
I have my signs on the left and the location list at the bottom. But as soon as I move the cursor, the signs as well as the loc-list disappear and it looks like that:
The only exception to this rule being entering insert mode right at startup. But of course once I leave it, everything disappears.
Now I know that there are commands like :SyntasticCheck or :Errors and they do exactly... nothing. I type them, I execute them and that's it. Like I hadn't done anything at all. Naturally saving the file doesn't yield any result either.
My .vimrc looks like this:
let g:syntastic_enable_signs = 1
let g:syntastic_auto_loc_list=1
let g:syntastic_check_on_open = 1
let g:syntastic_cpp_compiler_options = ' -std=c++11 -Wall'
If I remove these lines I don't even have the signs and loc-list on startup. So yea, I am really at a loss here.
Turns out this was more of a YouCompleteMe problem than it was Syntastic. YCM automatically sets itself as the checker for syntastic (for compatible languages) and also requires a .ycm_extra_conf.py which should contain the compile flags for the ycm compiler. Without these flags it is not capable of compiling the code or detecting any errors.

Exclude all messages in PC-Lint

I am using PC-Lint for my C++ project.
Is there a way to switch off all error and warning messages by default, so I can then reintroduce the required messages explicitly?
I have read the chapter of the PC-Lint manual entitled "Error Inhibition Options" and the best I could find was setting the wLevel to -w0 No messages (except for fatal errors)
Yes, it is possible, you can simply use -e* or -w0. However, the manual truly states (Chapter 16. Living with Lint):
DO NOT simply suppress all warnings with something
like: -e* or -w0 as this can disguise hard errors and make subsequent diagnosis very difficult.
So, yes, you can use it if your code is basically cleaned, and you want to review recent changes for a certain set of messages. But if you want to start cleaning your code, and are swamped with messages because of the default warning level -w3, I suggest to start using -w1, and resolve all issues there; most of the warnings/errors given at level one indicate problems with finding all header files, having al implicit macros set properly, and/or mimicking the compiler you use normally in a sufficiently precise way.
As always, I hesitate to advertise my own work, but if you want, take a look at my "How to wield PC Lint" PDF, where I have documented detailed instructions to handle the initial deployment of PC Lint and tackling the many warnings/errors/infos/notes you may be buried under.
When I started introducing PC-Lint to a new project I did the following:
As suggested by Johan Bezem, ran a -w1 level check over the whole thing. This doesn't actually find any new problems, but checks that your program is syntactically valid and finds any configuration issues. Nothing major, assuming your project compiles already.
Run the test again with -w2 level. This found 53,000 issues, which was a bit much to tackle in one go.
Pick a typical bad file, then suppress any errors that seem
irrelevant or non-urgent (eg. error 525: (Warning -- Negative indentation from line xxx)
adding -e525 to the command line or config file, until you find one that seems serious.
In my case this was
error 442: (Warning -- for clause irregularity: testing direction inconsistent with increment direction), i.e. a 'for' loop
that looked like it should be counting up was actually counting
down.
Reset the test level back to -w1 but added in the critical problem by number, -w1 +e442 in this case. Re-run it over the whole project then fix all the instances of that problem.
Back to stage 2 and try again.
This combination of fixing actual problems and suppressing likely false alarms soon gets your numbers under control.
So that everything gets better over time we also implement a script that does a thorough (full -w2 or -w3) check on any files that are created or modified.
I also found the tool LintProject very helpful as it can do an entire Visual Studio solution in one go, with tables with numbers of errors and worst offenders!

Ignored silent flag in a test run

I'm currently trying to use the PlUnit test suit and encounter a problem to turn off the output of my predicates during the test.
The documentation says that I should be fine with something along the lines of set_test_options([silent(true)])., however that doesn't seem to have any effect on my test runs.
I tried to put those options into my load_test_files/1 call as well, but it didn't change anything.
If anyone can provide help about this library that'll be gratefully read, as I seem to misunderstand the documentation and am getting nowhere when trying to see what fails here.

UniversalindentGUI "(STDERR):Cannot find file indentinput.cpp" Error

I wanted to know if anyone have used UniversalindentGUI.
I am trying to use and when run it get the following error.
There is no proper documentation or tutorial how to use it, if any one have used it please help me.
Indenter returned with exit code: 1
Indent console output was:
(STDOUT):
(STDERR):Cannot find file indentinput.cpp
Callstring was:
"/Users/rbang/Desktop/Tools/UniversalIndentGUI_macx/indenters/astyle"
indentinput.cpp
--options="/Users/rbang/Desktop/Tools/UniversalIndentGUI_macx/temp/.astylerc"
Open up indenters/uigui_astyle.ini in the directory where UniversalIndentGUI is installed and find the following properties:
inputFileName=indentinput
inputFileParameter=
outputFileName=indentinput
outputFileParameter=none
Change them to:
inputFileName=
inputFileParameter=stdin
outputFileName=
outputFileParameter=stdout
Voila!
I experienced the same problem, however if you switch to a different indenter in the pull down menu at the top of the ui(just below the text "Indenter Settings" and use a different indenter(i am using Uncrustify(C, C++, C#, Objective-C) it functions. I suspect it has to do with the fact that all the indenters may not be bundled with the download BUT uncrustify is. Most of the ones I tried have this issue, but the only one I care about is uncrustify.