code-analysis

Custom threshold for CA1502

一曲冷凌霜 提交于 2019-12-29 07:10:26
问题 Is there any way to change the thresholds for CodeAnalysis rules? In particular, we would like our Build to fail when a method has a code complexity of more than 20. Unfortunately, rule CA1502 has a threshold of 25: The rule reports a violation when the cyclomatic complexity is more than 25. Can we somehow change this? 回答1: Yes, this is possible. Unfortunately, the only way to provide custom rule settings for a configurable rule is via a .fxcop project file, which doesn't integrate terribly

JavaScript Source Code Analyzer [closed]

喜欢而已 提交于 2019-12-28 08:06:29
问题 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 3 years ago . Does anyone know of a good, extensible source code analyzer that examines JavaScript files? 回答1: In the interest of keeping this question up-to-date, there is a fork of JSLint called JSHint. An explanation of why JSHint was created can be found here, but to summarize: JSHint is a fork of JSLint, the tool written

JavaScript Source Code Analyzer [closed]

这一生的挚爱 提交于 2019-12-28 08:06:11
问题 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 3 years ago . Does anyone know of a good, extensible source code analyzer that examines JavaScript files? 回答1: In the interest of keeping this question up-to-date, there is a fork of JSLint called JSHint. An explanation of why JSHint was created can be found here, but to summarize: JSHint is a fork of JSLint, the tool written

What tools and techniques do you use to find dead code? [closed]

早过忘川 提交于 2019-12-28 02:51:10
问题 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 4 years ago . What tools and techniques do you use to find dead code in .NET? In the past, I've decorated methods with the Obsolete attribute (passing true so the compiler will issue an error, as described in MSDN). I'd be interested in seeing the suggestions of others (beyond tools like FxCop or ReSharper). I want to make

An analyzer for SPDH frame

佐手、 提交于 2019-12-25 00:34:23
问题 I must produce a parsing automat of SPDH protocol. SPDH defines the structure of request and response messages exchanged between an electronic payment terminal and the server of the bank. The specifications of this protocol are described in this document: http://www.trauco.com/docs/SPDH-specification_070212.pdf I specified the following grammar for this protocol: Frame : = header fids etx ; header : = fields ; fields : = field fields | epsilon ; field : = string | number ; fids : = fid

How to approach parsing through a javascript file?

可紊 提交于 2019-12-24 18:30:58
问题 I want to parse through a javascript and find all the variable declarations, attributions, and calls to functions from a specific library. What would be the best approach:regular expressions, lexer, use something already done that does that (does it exist?)....? What I want in fact is to be assured that an object namespace and methods are not modified, and this through a static analysis. 回答1: You can not do it with regexes and probably you also do not want to write you own implementation of

Run Code Analyzers in VSTS project build

时光总嘲笑我的痴心妄想 提交于 2019-12-24 10:58:58
问题 In VSTS (hosted TFS) I have a build definition which uses MSBuild. What I would really like is to have pull requests annotated with any rule violation detections. However I can't get the analysers to work at all. What I've done so far; Installed Microsoft.CodeAnalysis.FxCopAnalyzers in one of the projects that gets build Verified that running "Analyze Code" in Visual Studio does output rule violations All the *.ruleset files are not available on the self-hosted build agent, as it only has

Where should I put ANNOTATE_ITERATION_TASK?

做~自己de王妃 提交于 2019-12-24 09:58:49
问题 I'm using Intel Advisor to analyze my parallel application. I have this code, which is the main loop of my program and where is spent most of the time: for(size_t i=0; i<wrapperIndexes.size(); i++){ const int r = wrapperIndexes[i].r; const int c = wrapperIndexes[i].c; const float val = localWrappers[wrapperIndexes[i].i].cur.at<float>(wrapperIndexes[i].r,wrapperIndexes[i].c); if ( (val > positiveThreshold && (isMax(val, localWrappers[wrapperIndexes[i].i].cur, r, c) && isMax(val, localWrappers

Find out if CsElement is a static field? (StyleCop custom rule)

a 夏天 提交于 2019-12-24 07:05:22
问题 How do I query a CsElement object to see if the element is a static field? I'm building a pair of m_ and s_ prefix rules for member fields and static fields. 回答1: You definitely should take a look at StyleCop+. It already contains all naming rules you're trying to create. Moreover, it's open-source. So you can find there many examples of different code analysis cases (finding all static fields, member fields, etc.) 来源: https://stackoverflow.com/questions/6037695/find-out-if-cselement-is-a

What does the %#mex pragma do?

亡梦爱人 提交于 2019-12-24 03:18:31
问题 When I create a MEX file in MATLAB, I'm in the habit of also creating a .m file with the same name, a function signature identical to the MEX file, and otherwise containing nothing but help text in the form of comments, that are then displayed when one types help myfcn . When one does this, a small side-effect is that MATLAB Code Analyzer picks up on the fact that the input and output arguments specified in the function signature are unused, and flags them with an orange underline. Recently I