code-metrics

How many lines of code should a function/procedure/method have? [duplicate]

五迷三道 提交于 2019-12-17 15:27:08
问题 This question already has answers here : Closed 7 years ago . Possible Duplicate: When is a function too long? I've recently been given the unenviable task of reviewing poor code written by another developer and documenting the bad practices. (This is all for the purposes of getting out of paying for the developer's work rather than any altruistic reason, of course!) The reviewed code has several procedures that are many lines of code - the longest is almost 600 lines. A couple of problems

How to use IntelliJ IDEA to find all unused code?

三世轮回 提交于 2019-12-17 08:03:29
问题 When I am in a .java file the unused code is usually grayed out or has a green underline saying this code will probably (probably because of some weird JNI/Reflection corner cases) be unused. But I have this project with thousands of Java files and I want to find ALL INSTANCES of such probable-unused codes. How can I do that in IntelliJ IDEA? 回答1: Just use Analyze | Inspect Code with appropriate inspection enabled ( Unused declaration under Declaration redundancy group). Using IntelliJ 11 CE

How to use IntelliJ IDEA to find all unused code?

别来无恙 提交于 2019-12-17 08:03:17
问题 When I am in a .java file the unused code is usually grayed out or has a green underline saying this code will probably (probably because of some weird JNI/Reflection corner cases) be unused. But I have this project with thousands of Java files and I want to find ALL INSTANCES of such probable-unused codes. How can I do that in IntelliJ IDEA? 回答1: Just use Analyze | Inspect Code with appropriate inspection enabled ( Unused declaration under Declaration redundancy group). Using IntelliJ 11 CE

How do you count the lines of code in a Visual Studio solution?

故事扮演 提交于 2019-12-17 02:53:30
问题 Is it possible to find the number of lines of code in an entire solution? I've heard of MZ-Tools, but is there an open source equivalent? 回答1: Visual Studio 2010 Ultimate has this built-in. Analyze -> Calculate Code Metrics 回答2: I've found powershell useful for this. I consider LoC to be a pretty bogus metric anyway, so I don't believe anything more formal should be required. From a smallish solution's directory: PS C:\Path> (gci -include *.cs,*.xaml -recurse | select-string .).Count 8396 PS

Automatic way to obtain the floating-point operation count for some piece of code

戏子无情 提交于 2019-12-13 19:34:24
问题 I have some rather complex and highly templated code (C++, but this may not be very relevant) of which I'd like to know the number of adds, subs, muls, divs, and sqrts at execution. Is there an automatic way to get this information (the compiler could work it out easily)? I tried to count it myself in the assembler code generated, but got confused with jp , jmp , and call s. 回答1: I would suggest to override + , - , * , / operators and sqrt function for some float-like type, in which you can

nDepend integration in Visual Studio 2010

馋奶兔 提交于 2019-12-13 14:11:47
问题 This stems from a previous question I asked regarding code metrics. I have been trying out nDepend as a tool to use in running metrics on our team's code. I have to say that so far I am very impressed with the design, information given, etc. My question now is if I can somehow combine the integrated nDepend tools with the builds and notifications for said builds in Team Foundation Server 2010. Whether this be by automatically triggering the nDepend code metrics to run on a TFS build, or

Source of parsers for programming languages?

纵然是瞬间 提交于 2019-12-13 12:04:30
问题 I'm dusting off an old project of mine which calculates a number of simple metrics about large software projects. One of the metrics is the length of files/classes/methods. Currently my code "guesses" where class/method boundaries are based on a very crude algorithm (traverse the file, maintaining a "current depth" and adjusting it whenever you encounter unquoted brackets; when you return to the level a class or method began on, consider it exited). However, there are many problems with this

Visual Studio - Determining Lines No Of Lines of code in a project

半城伤御伤魂 提交于 2019-12-12 08:07:34
问题 Visual Studio - Determining Lines No Of Lines of code in a project - is this possible in VS 2008? 回答1: I find SlickEdit gadgets SLOC report to be very good and FREE! :) Breaks down comments/lines of code etc. Kindness, Dan 回答2: there is no direct way from vs2008 to do it, but you can use extended tools such as: C# and VB.NET Line Count Utility 回答3: TeamSuite will report this value as part of it's code metrics along with other, perhaps more valuable, statistics. 回答4: You can use Project Line

“The plugin java is not supported with Java 1.6.0_45” from SonarQube 4.5.4 with a specify java version 1.7

青春壹個敷衍的年華 提交于 2019-12-12 06:35:45
问题 I'm trying to configure the SonarQube 4.5.4 on my server. For that SonarQube version, it needs jdk 1.7, in case of building my Android system firmware, only jdk 1.6 can be set as the default jdk. Now jdk 1.7 is still on my Computer, not the defalut one. So in order to make SonarQube run, the jdk 1.7's absolute path is specified in /conf/wrapper.conf under the following line: wrapper.java.command=/usr/lib/jvm/java-7-oracle/jre/bin/java After this, the jdk 1.7 can be seen from Sonar's setting:

How to update this class/method to improve Code Metrics

喜夏-厌秋 提交于 2019-12-11 07:21:10
问题 This was my Initial Method public String GetAllDocuments(string url,int pager =0) { if (SessionInfo.IsAdmin) { ReportHandler dal = new ReportHandler(); var documents = dal.FetchDocumentsList(SessionInfo.ClientID, pager); string documentsDataJSON = JsonConvert.SerializeObject(documents); return documentsDataJSON; } else { return "Sorry!! You are not authorized to perform this action"; } } Visual Studio shows the following Code Metrics:- Member: GetAllDocuments(string, int) : string