cppcheck reporting false positives - static-code-analysis

I am running cppcheck on my project and am getting reports of unused Functions that ARE definitely used (project wont compile if I remove them).
Are there any known reasons why this might happen ? or how I can stop the false reports
Thanks

In case this error is still present in the latest version of cppcheck, could you please create a minimal example that demonstrates the issue. Having such a test case, the cppcheck developers can fix the issue. I also recommend that you report such issues to cppcheck bugtracker here.

One reason is that you did not configure as expected Cppcheck, you have to specify the include paths and defines, you can also use CppDepend which integrate now cppcheck and did all the configuration staf from the projects you analyse, and also report all methods not used.

Related

Using "UNSAFE_componentWillMount" in strict mode. But I'm not sure where the issue is

I have a Next.js application that when run, gives me this issue on the browsers console.
Warning: Using UNSAFE_componentWillMount in strict mode is not recommended and may indicate bugs in your code. See https://reactjs.org/link/unsafe-component-lifecycles for details.
* Move code with side effects to componentDidMount, and set initial state in the constructor.
Please update the following components: SideEffect(NullComponent)
I am not sure what SideEffect(NullComponent) is and searching through all the text in my project returns no result. So I'm not sure where the problem is coming from in order to try and resolve it, or be able to provide some relevant code in here.
What does this error mean, and how can I locate at least what file is causing the issue?
The error that you see is most likely the be in a package that you are using
Try to search for the whole project (including node_modules folder) or look more carefully in the console error (name of the file that generates the error).
This way you will know which package uses the outdated code and decide to keep it or update it or use another similar package.
To search for the whole project including node_modules

'XrmFakedContext' does not cointain a definition for 'ExecutePluginWith'

I'm trying to upgrade a unit test project to the latest version of FakeXrmEasy 2.1.2 and I'm getting the error below:
'XrmFakedContext' does not cointain a definition for 'ExecutePluginWith' and no accessible extension method 'ExecutePluginWith' accepting a first argument of type 'XrmFakedContext' could be found
Any ideas what I'm missing?
This might happen because some methods were moved into dedicated namespaces and so some extra using statements might be necessary.
Please try adding these usings:
using FakeXrmEasy.Abstractions.Plugins;
using FakeXrmEasy.Plugins;
Also please check the documentation site with other steps that might be useful. In particular the Quick Guide to migrate in 6 steps is probably an essential resource:
https://dynamicsvalue.github.io/fake-xrm-easy-docs/quickstart/migrating-from-1x/

How to include the application's version number in a Scala.js program?

Basically, I'm curious if something like SBT including the version number in a program is possible for Scala.js. The proposed solution doesn't work in scala.js, apparently due the the absence of the getPackage method:
[error] Referring to non-existent method java.lang.Class.getPackage()java.lang.Package
Use sbt-buildinfo for that. The Usage section of the readme contains everything you need.

Can Opencover be used with TypeMock Isolator?

I'm looking for a .NET coverage tool, and had been trying out PartCover, with mixed success.
I see that OpenCover is intended to replace PartCover, but I've so far been unable to link it with TypeMock Isolator so my mocked-out tests pass while gathering coverage info.
I tried replicating my setup for Partcover, but there's no defined profilename that works with the "link" argument for Isolator. Thinking that OpenCover was based on Partcover, I tried to tell Isolator to link with Partcover, and it didn't complain (I still had Partcover installed), but the linking didn't work - Isolator thought it wasn't present.
Am I missing a step? Is there a workaround? Or must I wait for an Isolator version that is friends with OpenCover?
Note: I work at Typemock
I poked around with the configuration a little bit and managed to get OpenCover to run nicely with Isolator. Here's what you can do to make them work together, until we add official support:
Register OpenCover profiler by running runsvr32 OpenCover.Profiler.dll (you will need an Administrator's access for this).
Locate the file typemockconfig.xml, it should be under your installation directory, typically C:\Program Files (x86)\Typemock\Isolator\6.0.
Edit the file, and add the following entry towards the end of the file, above </ProfilerList>:
<Profiler Name="OpenCover" Clsid="{1542C21D-80C3-45E6-A56C-A9C1E4BEB7B8}" DirectLaunch="false">
<EnvironmentList />
</Profiler>
Save the file, you will now have a new entry in the Typemock Configuration utility, called OpenCover. Press the Link button to link them. You will now be able to run your tests using OpenCover.Console.exe and Isolator. For example, here's how to run your tests with MSTest:
OpenCover.Console.exe
-target:"C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\MSTest.exe"
-targetargs:"/testcontainer:"d:\code\myproject\mytests.dll"
-output:opencovertests.xml
There is still a minor issue running this with TMockRunner -link (that is, with late linking). I will need to look at it further at work.
Hope that helps.

Selenium-Flex API sample problem

I'm trying the sample demo of selenium flex API. After following the instructions on the main page for compiling the project with sfpi.swc and taking the generated selben.swf in bin directory and trying to run some test(assertFlexText) using Selenium IDE, I get the following error:
[error] Function getFlexText not found on the External Interface for
the flash object selben
I have tried several other flex tests and got error messages similar to the one mentioned above.
For some reason I believe that the generated selben.swf through the automatic build of project in flex builder is not the desired one, though it didn't indicate any build problem after including sfpi.swc.
Any idea?
I use SeleniumFlex Api and SeleniumIde for my projecy with excellent result BUT using my own version of each of one. Your error maybe is for not include the lib of SeleniumFlexApi in the compile time( -include-libraries "libs\SeleniumFlexAPI.swc" ).
After that u can enable capture and replay with SeleniumIde change the main source (read this post) and use the user-extensions.js (in the SeleniumFlexApi project) with the SeleniumIde user option. Its really easy.
With these change u can capture and replay in firefox (v 3.06 or minor) and after that, if u use java, u can use Flex-UI-Selenium, Flash-Selenium for ur integration test with SeleniumRC.
I hope this information be usefull. I u have any question let me know.

Resources