code-analysis

Textmate to browse C++ project with a bunch of files and CUDA

夙愿已清 提交于 2019-12-11 07:52:38
问题 I am new to Textmate. I have to work on a CUDA C++ project and at the moment just would like to get the project (bunch of files and directories), start with the main C++ file and from there, selecting functions and that Textmate jumps to the definitions which usually are in other files. Is it possible with Textmate and moreover with CUDA? Do not need to compile, just efficiently browse code 回答1: You want the CTags bundle for TextMate. Here's a tutorial that explains how to do by hand what the

using object initializer generates CA 2000 warning

不羁的心 提交于 2019-12-11 06:59:08
问题 Following code generates a CA2000 warning: Myclass myclass = null; try { myclass = new Myclass { Name = "a name" }; } finally { if (myclass != null) { myclass.Dispose(); } } i found some topics with the same problem and as I understand the problem is, that the compiler generates for the constructor a temporary variable and for this variable I'm not calling Dispose(). var tmp = new MyClass(); tmp.Name = "a name"; myclass = tmp: so my question is, if there is a solution with using object

Msbuild not producing XML file with code analysis

折月煮酒 提交于 2019-12-11 05:37:53
问题 I have been digging but cannot find the answer - I THOUGHT I had found it in this question but it is not working on my system. The only difference that I can see is that I am giving msbuild a solution file and not an individual project file - must I do it at the project level to get output? The command line I entered was: msbuild Interlink.NET.sln /p:RunCodeAnalysis=true /p:CodeAnalysisLogFile=test.xml Obviously, test.xml was not created or I would not be asking this question... The solution

Exclude some lines of php code from sonarqube analysis

戏子无情 提交于 2019-12-11 05:28:11
问题 Is there a way to exclude some lines of code from sonarqube analysis without excluding the whole source code file? Maybe with an annotation or something like this? I'll give you an concrete example, where i need to exclude a certain code smell for an unused function parameter: I implemented a validation method like this: public function validateTruth(string $attribute, $value) : bool { $acceptable = [ '0', 0, 'false', false, '1', 1, 'true', true, 'no', 'yes', ]; return in_array($value,

Suppress code analysis warnings for conditional methods

我的梦境 提交于 2019-12-11 03:01:38
问题 Running code analysis (Visual Studio 2015) on code that calls Conditional methods causes warnings for unused locals (CA1804) or unused parameters (CA1801). E.g. for: using System.Diagnostics; namespace ConsoleApplication1 { class Program { [Conditional ("NEVER_DEFINED")] static void Log(string message) { System.Console.WriteLine("Demo conditional message logging: " + message); } static void Main(string[] args) { string message = "Only log this when `NEVER_DEFINE` is #defined"; Log(message);

Is there a way to make Code Analysis ignore “InternalsVisibleTo”?

情到浓时终转凉″ 提交于 2019-12-11 02:36:17
问题 We have a lot of assemblies that contain internal classes which we are unit-testing by using InternalsVisibleTo to make the internal classes visible to the Unit Test assembly. This works fine, but the problem is that as soon as you use InternalsVisibleTo , it prevents the Code Analysis CA1812 warning ( Avoid uninstantiated internal classes ). It also prevents CA1811: "Avoid uncalled private code". I've done some investigation, and I've found quite a lot of unused internal classes that we

Visual Studio 2013 Code Analysis Exception CA0055: Could not load assembly

筅森魡賤 提交于 2019-12-11 02:24:06
问题 I am trying to run the Code analysis on Web Project in VS2013 but i am getting the exception CA0055. I took a look at the log file. Here is the exception information which is getting logged. <Exception Keyword="CA0055" Kind="AssemblyLoad"> <Type>Microsoft.FxCop.Common.AssemblyLoadException</Type> <ExceptionMessage>Could not load MyProject.dll.</ExceptionMessage> <InnerType>System.NullReferenceException</InnerType> <InnerExceptionMessage>Object reference not set to an instance of an object.<

clang - symbol(variable, function, type, etc..) definition or declaration or reference

老子叫甜甜 提交于 2019-12-11 00:56:49
问题 Please do anyone know if clang has option to return symbol definition or declaration(or reference)? I mean: there is option for clang executable called -code-completion-at=path_to_file:line:coloumn the clang will look into code and returns you completion strings(ie if there is for example std::string_type_variable. ..it returns to you all the methods and attributes you can call from std::string. Now what i want is, for clang to return the file and coordinates, where the definition of the

i want to find all if statements in C# code which are not followed by brackets. Through regex

雨燕双飞 提交于 2019-12-10 23:16:55
问题 I want to find all if statements and for statements which are not followed by curly brackets ' { '. When you write a single line in an if statement you do not mostly enclose it in curly brackets, so I want to find all those if and for statements. Please help! Like I want to capture this statement if (childNode.Name == "B") return TokenType.Bold; but not these kinds if (childNode.Name == "B") { return TokenType.Bold; } I want to do it with regex. 回答1: Since the underlying mathematics disallow

Using CDT without Eclipse

为君一笑 提交于 2019-12-10 22:26:45
问题 I want to use CDT parser in a project. The project would be a command-line, stand-alone project, i.e., not an Eclipse plugin. All solutions that I've seen requires using a IWorkspace . But, I want to use the CDT parser on single files outside eclipse. Is there any way to do that? 回答1: It depends what you mean by "without Eclipse". CDT's code is built on top of the Eclipse Platform, so you're going to need to be running an application that includes the Eclipse Platform. However, there's no