static-code-analysis

oclint: error: no rule loaded

和自甴很熟 提交于 2019-12-11 10:16:40
问题 I am trying to get the list of warnings,errors,syntax coding convention and cyclomatic complexity from command line. I found that oclint can be used for my purpose. but then I ran into a problem What I tried to do. xcodebuild -project testing.xcodeproj -target "testing" -configuration "Debug" -destination "platform=iOS Simulator,name=iPad" -sdk "iphonesimulator7.0" -IDEBuildOperationMaxNumberOfConcurrentCompileTasks=8 clean xcodebuild -project testing.xcodeproj -target "testing"

make cppcheck skip the PACKAGE definition

僤鯓⒐⒋嵵緔 提交于 2019-12-11 06:58:03
问题 I'm using the GUI version of cppcheck 1.64 for static code analysis on C++-Builde-6 code. For DLL exports and imports, the definition of PACKAGE is necessary: /// A dialog exported from a BPL (a VCL-specific kind of DLL) class PACKAGE MySharedDialog { public: // lots of methods to-be checked private: // lots of methods to-be checked // lots of members }; Cppcheck stops when it encounters PACKAGE because it doesn't know what it means: The code 'class PACKAGE TAppInfoDialog {' is not handled.

Code analysis fails on project referencing obfuscated assembly

断了今生、忘了曾经 提交于 2019-12-10 17:44:43
问题 Visual Studio 2010 code analysis fails to run now that we've incorporated a 3rd-party assembly into our project. Project : error : CA0055 : Could not load C:\Programming\MyAssembly.dll. Project : error : CA0052 : No targets were selected. Project : error : CA0058 : The referenced assembly 'TheirAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=...' could not be found. This assembly is required for analysis and was referenced by: C:\Programming\MyAssembly.dll. When opening the 3rd

How can I perform the searches Java IDEs do for method references programmatically? [closed]

本秂侑毒 提交于 2019-12-08 16:53:50
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 5 months ago . You know the find all references feature of eclipse (Search > References > Workspace or Ctrl-Shift-G)? How can I run that programmatically? I have a large codebase that I need to audit for security violations and need to chain about a dozen conditions. Are there libraries out there that can analyze large

“CA2000: Dispose object before losing scope” building Unity container

两盒软妹~` 提交于 2019-12-08 04:36:20
问题 I am using following code where I am getting fxCop voilation CA2000: Dispose object before losing scope: private static IUnityContainer BuildContainer() { var container = new UnityContainer().LoadConfiguration(); return container; } to remove this violation I have used following code: private static IUntyContainer BuildContainer() { using(var container = new UnityContainer()) { return container.LoadConfiguration(); } } But this code start throwing exception while resolving dependencies. Can

Visual Studio 2015 Code Analysis C6386 warns of buffer overrun

会有一股神秘感。 提交于 2019-12-07 06:11:09
问题 I've read a lot about the Visual Studio Code Analysis warning C8386, but can't figure out this particular issue with my code. I've reduced it to the following small program: unsigned int nNumItems = 0; int main() { int *nWords=nullptr; unsigned int nTotal; nTotal = 3 + 2 * nNumItems; nWords = new int[nTotal]; nWords[0] = 1; nWords[1] = 2; // this is line 18, warning C6386 delete[] nWords; return 0; } Analyze->Run Code Analysis->On Solution will give the following warning: file.cpp(18):

Asynchronous code in custom ESLint rules

社会主义新天地 提交于 2019-12-06 18:17:58
问题 The Story and Motivation: We have a rather huge end-to-end Protractor test codebase. Sometimes it happens that a test waits for a specific fix to be implemented - usually as a part of a TDD approach and to demonstrate how a problem is reproduced and what is the intended behavior. What we are currently doing is using Jasmine's pending() with a Jira issue number inside. Example: pending("Missing functionality (AP-1234)", function () { // some testing is done here }); Now, we'd like to know when

“CA2000: Dispose object before losing scope” building Unity container

北城以北 提交于 2019-12-06 14:50:01
I am using following code where I am getting fxCop voilation CA2000: Dispose object before losing scope: private static IUnityContainer BuildContainer() { var container = new UnityContainer().LoadConfiguration(); return container; } to remove this violation I have used following code: private static IUntyContainer BuildContainer() { using(var container = new UnityContainer()) { return container.LoadConfiguration(); } } But this code start throwing exception while resolving dependencies. Can someone help me with this? This violation usually stems from a couple of code patterns though you should

How do I find all the unit tests that may directly or indirectly call a given method? (.net)

谁说胖子不能爱 提交于 2019-12-06 08:55:45
问题 How do I find all the unit tests that may directly or indirectly call a given method? When I change a method, I wish to know the best tests to run; there must be a tool for this! As we have lots of interfaces, I am interested in all unit tests that calls a method on an interface when there is at least one path var the implantation method on a class that implements the interface. Or in other words, I want a list of all unit tests when the tool cannot prove the result is not affected by the

Detecting typos in JavaScript code

纵然是瞬间 提交于 2019-12-05 11:51:09
In Python world, one of the most widely-used static code analysis tools, pylint has a special check , that detects typos in comments and docstrings. Is there a way to detect typos in JavaScript code using static code analysis? To make the question more specific, here is an example code I want to cause a warning: // enter credntials and log in scope.loginPage.logIn(browser.params.regularUser.login, browser.params.regularUser.password); Here credntials is misspelled. There is a eslint plugin built specifically for the task - eslint-plugin-spellcheck : eslint plugin to spell check words on