code-analysis

Visual studio code analysis for generated files

孤街浪徒 提交于 2019-12-10 20:25:08
问题 Can somebody tell me why code analysis shows issues from generated files? I do check option as here: http://msdn.microsoft.com/en-us/library/dd742298.aspx I think it has to do with the fact that I use TT tempate with my Entity framework models. But those files have tags on them.. 回答1: Can you have your TT templates output the following into the header? //<autogenerated/> Or to be more specific to certain items in file: [GeneratedCode("MyTool", "1.0")] public partial class GeneratedModel { ...

How can I compare similar codebases?

久未见 提交于 2019-12-10 19:55:18
问题 We have several C++ projects that were built from the same codebase. There's a lot of similarities and common code between them but they were developed independently; source was not shared in any way. Classes and files will have been renamed even if the underlying code hasn't changed and individual lines will have been tweaked, changed and replaced. I'd like to be able to compare the different codebases and find out how much of the code is still the same. It can be fairly high level - % of

How can I fix CA2100 Review SQL queries for security vulnerabilities issue

坚强是说给别人听的谎言 提交于 2019-12-10 19:48:45
问题 I am analyzing my code and got this security issue: CA2100 Review SQL queries for security vulnerabilities The query string passed to 'SqlDataAdapter.SqlDataAdapter(string, SqlConnection)' in 'Add_item.loadgrid()' could contain the following variables 'Login.dbName'. If any of these variables could come from user input, consider using a stored procedure or a parameterized SQL query instead of building the query with string concatenations. Login Add_item.cs 64 This is the highlighted code:

Can a CodeAnalysis return a false positive of CA2202? or is really something wrong with my code?

风格不统一 提交于 2019-12-10 19:22:43
问题 I'm suffering the same issue explained here but iterating a EnvDTE.Processes . In the question that I linked the user @ Plutonix affirms it is a false warning, and I think him reffers to the obj.Getenumerator() mention so I assume my problem will be considered a false warning too, however, if this is a false warning I would like to know more than an affirmation, the arguments to say it is a false warning. This is the warning: CA2202 Do not dispose objects multiple times Object 'procs

Code Analysis for CSS, HTML and javascript

↘锁芯ラ 提交于 2019-12-10 18:35:19
问题 Can anybody point me in the direction of software similar to StyleCop for C# which can analyse CSS, HTML and javascript against sets of predefined rules / custom rules. For Example, css - to ensure camel case is used for class names html - to ensure inline sytles are not used javascript - not sure yet :P Ideally, tools which can be run as-part of msbuild would be benefical so they can be included as part of a quality build. Tools runnable by developers would also be desirable. 回答1: For

Enforcing side effects in python

放肆的年华 提交于 2019-12-10 14:59:00
问题 Is there a tool that enables you to annotate functions/methods as "pure" and then analyzes the code to test if said functions/methods are side effect free ? 回答1: In the Python world, the question doesn't make much sense since objects have so much say in what happens in a function call. For example, how could you tell if the following function is pure? def f(x): return x + 1 The answer depends on what x is: >>> class A(int): def __add__(self, other): global s s += 1 return int.__add__(self,

Is there a tool to list global variables used and output by a C function?

女生的网名这么多〃 提交于 2019-12-10 13:22:36
问题 I want to make a list of global variables/macros consumed by a function and output by the function. For example, for: void myfn(void) { out1 = in + 1; out2 = 2; } ..the tool would list the inputs as 'in' and the outputs as 'out1' and 'out2'. Does anyone know of such a tool? 回答1: Understand for C/C++ (http://www.scitools.com/products/understand/) 回答2: Our DMS Software Reengineering Toolkit is a customizable program analysis tool with a production quality C Front End. It parses C, builds ASTs

how to parse kotlin code?

旧巷老猫 提交于 2019-12-10 13:03:03
问题 I need to analyse kotlin files code, to detect the keyword "data" and "?". The issue is I don't find any libs like JavaParser. I don't need powerfull tools, just something who return me the number of the lines. Any idea? 回答1: I use antlr4 to do it. And I create an open source lib: https://github.com/sarahBuisson/kotlin-parser <dependency <groupId>com.github.sarahbuisson</groupId> <artifactId>kotlin-parser</artifactId> </dependency> 回答2: You would need to either find a Kotlin parser, or write

Simple dynamic call graphs in Java [closed]

南楼画角 提交于 2019-12-10 10:39:44
问题 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 6 years ago . I am looking for a simple dynamic call graph logger for Java that you can add in a few lines of code. I know there is an Aspect J solution. Also, I helped Zola develop Glow for C/C++ so I could rewrite a similar tool but I don't want to dig into JVM internals. Any open source solution out there right now that is

Applying multiple changes to a solution in roslyn

倖福魔咒の 提交于 2019-12-10 09:11:15
问题 I want to apply changes to several documents of a solution but only the first change is reflected and rest of them are rejected.This link shows how only once can changes be applied to a solution. What would be a work around for this. I would appreciate a link directing to a solution or a code snippet. Here is my function : public static async Task<bool> AddMethod(string solutionPath) { var workspace = MSBuildWorkspace.Create(); var solution = await workspace.OpenSolutionAsync(solutionPath);