clang-tidy: Analyze file with multiple errors - clang

Is it possible to analyze a C/C++ file in clang-tidy, while ignoring its syntax/compilation errors?
I have a very big file that has several compilation errors, but I still want to analyze it with clang-tidy.
I'm getting the following error message:
20 warnings and 20 errors generated.
Error while processing <myfile.c>
error: too many errors emitted, stopping now [clang-diagnostic-error]
I saw that in a smaller file, it is possible to have some syntax errors, but still, issues like index past the end of the array are displayed.
Is there a way to still have my file to be analyzed, despite the errors (like increasing the number of possible errors)?

You may instruct clang-tidy to continue processing errors by applying -ferror-limit=0 to the compilation flags, that is, add the following to clang-tidy command line:
-extra-arg=-ferror-limit=0
The default value for -ferror-limit is indeed 20.
Alternatively, you may want to set the limit to a higher number of your choice, rather than disabling the limitation completely.
Note that if you are using the run-clang-tidy.py script, rather than clang-tidy directly, you'll need version 5.0 for -extra-arg parameter support.

Related

Sonar analysis how to get rid of "Too many duplication references" in jenkins pipeline log

A large portion of our code is based on a template, because of this sonar scanner falsely reports that code as having too many duplications.
I know it's only a warning, but it fills our Jenkins pipeline logs with warnings, we'll never fix, to the extent that real issues get overlooked.
Following https://stackoverflow.com/a/52869313/1817610 I added sonar.cpd.exclusions=**/*.w to our scanner properties, but that does not eliminate the warnings.
The fragment of the log below shows 25 lines in the log for a single source, we have more than a thousand sources like that.
00:21:14 INFO: 3970/4255 - current file: X:/cce/build/develop/git/smartlisa/appl/src/erprap/fwkal-u.w
00:21:14 WARN: Too many duplication references on file src/erprap/fwkal-u.w for block at line 523. Keep only the first 100 references.
00:21:14 WARN: Too many duplication references on file src/erprap/fwkal-u.w for block at line 525. Keep only the first 100 references.
00:21:14 WARN: Too many duplication references on file src/erprap/fwkal-u.w for block at line 523. Keep only the first 100 references.
00:21:14 WARN: Too many duplication references on file src/erprap/fwkal-u.w for block at line 527. Keep only the first 100 references.
/// trimmed 20 similar lines
...
00:21:14 WARN: Too many duplication references on file src/erprap/fwkal-u.w for block at line 523. Keep only the first 100 references.
using SonarScanner 4.7.0.2747
I found a solution using the https://plugins.jenkins.io/log-file-filter/ plugin.
I added a filter to replace
.* WARN: Too many duplication references on file .*\n
with an empty string.
You had only to google for "WARN: Too many duplication references" to find: https://community.sonarsource.com/t/supress-ignore-warning-warn-too-many-duplication-references-on-file/27946 .
This tells you that you can't control that.
And to be frank, it isn't a "false" report. I understand where you're coming from, as I used to work on a project where we generated a lot of our application code. It's really not a good strategy. You'd be better off with an architecture where common code is inherited or composed, not duplicated.

Getter/setter "is used reflectively but not in MirrorsUsed" warning after dart2js compilation

In my class, I have getters and setters which are working thanks to NoSuchMethod - that is, they're not explicitly defined. After I compile and run the js, I get the following error in the browser console:
Warning: 'closes_in=' is used reflectively but not in MirrorsUsed. This will break minified code.
In this case, closes_in= is an example of such a setter and there are some other warnings related to other getters/setters too. I do have a #MirrorsUsed with the name of the library/class included and the resulting compiled js is actually smaller than it was without using #MirrorsUsed statements.
However, if a -m flag is passed to dart2js, then when the js program runs it fails - as predicted by the warning message.
Thus, I have two questions:
1. How do I write my #MirrorsUsed statement so that the warning goes away?
2. If it's not possible, how do I suppress the warning message? (because if it's not possible to solve the problem, then my only option would be to NOT minify the file then).

Error: An error occurred while skipping data rows

I am getting these errors in flat file connection manager.
Error: [SSIS.Pipeline] Error: SSIS Error Code DTS_E_PRIMEOUTPUTFAILED. The PrimeOutput method on Flat File Source returned error code 0xC0202091. The component returned a failure code when the pipeline engine called PrimeOutput(). The meaning of the failure code is defined by the component, but the error is fatal and the pipeline stopped executing. There may be error messages posted before this with more information about the failure.
I am reletively new to ssis and I am finding it quite hard to figure out the issue. Please let me know your views.
On your flat file connection properties - Look for the property "AlwaysCheckForRowDelimeters" - SET it to FALSE.
Hope that helps.
"An error occurred while skipping data rows" - I had this error in a package and found the problem was reading files inside a for loop. More files matched the criteria than intended, so a file with an invalid schema was also matched.
More generally I think this is related to either the file not matching the connection definition, I have also seen people online saying it is related to the flat file using a text qualifier (i.e. " in a csv) but having no closing quote.
I had this error today, and my package was looking for more files than existed based on the conditions of the for each loop. The text qualifier wasn't the issue causing this particular error.
near the Start button press drop-down menu arrow
choose package_name Debug Properties
than under Configuration Properties open Debugging
than under Debug Options choose Run64BitRuntime and turn it to False

Cobol error but cannot find it like I normally would find errors?

I am working on a COBOL project and normally can find compile errors very easily within my program by looking through the error messages in the compile listing. But I just found one that I cannot seem to find all that easily.
This is how I select the job to see the locations of the errors:
O Job#( ) Jobname MaxRC
S J40195 myFile 000008
J30902 SSabdd33 000000
J50339 SSrrrr09 000000
J50325 SSeeeee0 000004
CC * CONDITION CODES DISPLAY *
LOG JESMSGLG JES2
JCL JESJCL JES2
MSG JESYSMSG JES2
101 SYSPRINT TEST0001 ICEGENER
104 SYSPRINT TEST0001 XPDTR
105 PRTSORT TEST0001 XPDTR
107 SYSPRINT TEST0001 LKED
108 CWPERRM TEST0001 XPDTR --> I would select this option to see the errors
Error Statements Here:
PCSIO 054-S INVALID ENTRY lENGTH.
PCSIO 324-S TOTAL DUPLICATE VERSIONS OF THIS PROGRAM MAY EXCEED SHARED DIRECTORY BUFFER LIMIT
PCSIO 006-S OUTPUT FILE CWPDDIO OPENMEM ERROR, RETURN CODE=48-410.
I am not sure what these error statements mean.
Not Off-topic, so you can have an answer.
If attempting to use Compuware's Expediter IBM Mainframe debugger product and you want to understand any of the messages, you need to find the Xpediter Messages and Codes manual at your installation and any local installation-specific documentation on how the product should be used at your site.
You should be able to register on www.compuware.com, for free, and have access to downloadable manuals, for free, but you will need to locate the license information at your site and check that there are not already internal procedures for obtaining the documentation.
When receiving error messages, consult the messages manual first. If this does not give a resolution, consult colleagues, the appropriate local support group, Compuware support (your site is paying for that, but ensure you follow local procedures for doing so, there may be a central contact point at your site for support requests to software suppliers), search the web.
Sometimes you will be able to circumvent that by searching the web early, or asking questions somewhere, but many times simply looking in the manual will be enough, and other times they will be site-specific issues, so better to go through everything in the approximate order above.
If you are not intending to use Xpediter for a program and you get the messages, it means that the "wrong" JCL is being used, which usually means that the wrong compile method has been selected from an ISPF panel. You need to find out, at your site, colleagues being the easiest way, how to compile a program without using Xpediter. This will be/can be entirely site-specific, so you have to find out how it is done at your site and you can get nothing but generalised answers here which will sometimes confuse, send you down a wrong route and waste your time, or otherwise not be other than tangentially helpful to you.

F# Suppress Warnings

Sometimes I get annoying pattern matching and indent warnings when compiling F#. Is there a way to disable warnings? I'm pretty OCD over warnings.
In case you forget, you can type
let rec x = lazy(x.Value)
and get the warning
This and other recursive references to
the object(s) being defined will be
checked for initialization-soundness
at runtime through the use of a
delayed reference. This is because you
are defining one or more recursive
objects, rather than recursive
functions. This warning may be
suppressed by using '#nowarn "40"' or
'--nowarn:40'.
which shows that you can use either the compiler flag --nowarn on the command-line, or use the hash-directive #nowarn in your code. The warning number for each warning will be part of the build output (the Visual Studio error list does not display the numbers, so if in VS, build and then inspect the build output). Also, if inside VS, you can go to the project properties page, "Build" tab, and use the "warning level" selector and "suppress warnings" field (a semicolon-delimited list of numbers) to control which warnings are diplayed via the VS UI.
(BTW, I believe #nowarn only turns off the warning in the current file, whereas --nowarn turns it off for the entire project being compiled.)
See: Compiler Options (F#)
--nowarn:<int-list>:
Disable specific warnings listed by
number. Separate each warning number
by a comma. You can discover the
warning number for any warning from
the compilation output.
This compiler option is equivalent to
the C# compiler option of the same
name. For more information, see
/nowarn (C# Compiler Options).

Resources