<p>Are there any tools available that will calculate code metrics (for example number of code lines, cyclomatic complexity, coupling, cohesion) for your project and over time produce a graph showing the trends?  </p>

[{'answer_id': 60395, 'author': 'Iain Holder', 'author_id': 1122, 'author_profile': 'https://Stackoverflow.com/users/1122', 'pm_score': 3, 'selected': False, 'text': '<p><a href="http://www.ndepend.com/" rel="noreferrer">NDepend</a> for .net</p>\n'}, {'answer_id': 60400, 'author': 'aku', 'author_id': 1196, 'author_profile': 'https://Stackoverflow.com/users/1196', 'pm_score': 7, 'selected': True, 'text': '<p>On my latest project I used <a href="http://www.campwoodsw.com/sourcemonitor.html" rel="noreferrer">SourceMonitor</a>. It\'s a nice free tool for code metrics analysis.<br>\nHere is an excerpt from SourceMonitor official site:</p>\n\n<blockquote>\n  <ul>\n  <li>Collects metrics in a fast, single\n  pass through source files.</li>\n  <li>Measures metrics for source code\n  written in C++, C, C#, VB.NET, Java,\n  Delphi, Visual Basic (VB6) or HTML.</li>\n  <li>Includes method and function level\n  metrics for C++, C, C#, VB.NET,\n  Java, and Delphi.</li>\n  <li><strong>Saves metrics in checkpoints for\n  comparison during software\n  development projects.</strong></li>\n  <li>Displays and prints metrics in\n  tables and charts.</li>\n  <li>Operates within a standard Windows\n  GUI or inside your scripts using XML\n  command files.</li>\n  <li>Exports metrics to XML or CSV\n  (comma-separated-value) files for\n  further processing with other tools.</li>\n  </ul>\n</blockquote>\n\n<p>For .NET beside <a href="http://www.ndepend.com" rel="noreferrer">NDepend</a> which is simply the best tool, I can recommend <a href="http://www.1bot.com/index.html" rel="noreferrer">vil</a>.</p>\n\n<p>Following tools can perform trend analysis:</p>\n\n<ul>\n<li><a href="http://www.castsoftware.com/Product/Application-Intelligence-Platform.aspx" rel="noreferrer">CAST</a></li>\n<li><a href="http://www.klocwork.com/products/insight.asp" rel="noreferrer">Klocwork Insight</a></li>\n</ul>\n'}, {'answer_id': 60402, 'author': 'moobaa', 'author_id': 3569, 'author_profile': 'https://Stackoverflow.com/users/3569', 'pm_score': 2, 'selected': False, 'text': '<p>If you\'re in the .NET space, Developer Express\' <a href="http://devexpress.com/Products/Visual_Studio_Add-in/Coding_Assistance/" rel="nofollow noreferrer">CodeRush</a> provides LOC, Cyclomatic Complexity and the (rather excellent, IMHO) <a href="http://74.125.95.104/search?q=cache:www.doitwith.net/2005/03/02/Here%27sYourNewMetric.aspx" rel="nofollow noreferrer">Maintenance Complexity</a> analysis of code in real-time.</p>\n\n<p>(Sorry about the Maintenance Complexity link; it\'s going to Google\'s cache. The original seems to be offline ATM).</p>\n'}, {'answer_id': 60410, 'author': 'sven', 'author_id': 46, 'author_profile': 'https://Stackoverflow.com/users/46', 'pm_score': 3, 'selected': False, 'text': '<p>I was also looking for a code metrics tool/plugin for my IDE but as far as I know there are none (for eclipse that is) that also show a graph of the complexity over a specified time period.\nHowever, I did find the <a href="http://eclipse-metrics.sourceforge.net/" rel="noreferrer">eclipse metrics plugin</a>, it can handle:</p>\n\n<ul>\n<li>McCabe\'s Cyclomatic Complexity</li>\n<li>Efferent Couplings</li>\n<li>Lack of Cohesion in Methods</li>\n<li>Lines Of Code in Method</li>\n<li>Number Of Fields</li>\n<li>Number Of Levels</li>\n<li>Number Of Locals In Scope</li>\n<li>Number Of Parameters</li>\n<li>Number Of Statements</li>\n<li>Weighted Methods Per Class</li>\n</ul>\n\n<p>And while using it, I didn\'t miss the graphing option you are seeking as well.<br>\nI think that, if you don\'t find any plugins/tools that can handle the graphing over time, you should look at the tool that suits you most and offers you all the information you need; even if the given information is only for the current build of your project.</p>\n\n<p>As a side note, the <em>eclipse metrics plugin</em> allows you to <a href="http://eclipse-metrics.sourceforge.net/example/index.html" rel="noreferrer">export the data to an external file</a> (link goes to an example), so if you use a source control tool, and you should!, you can always export the data for the specific build and store the file along with the source code, that way you still have a (basic) way to go back in time and check the differences.</p>\n'}, {'answer_id': 60412, 'author': 'readonly', 'author_id': 4883, 'author_profile': 'https://Stackoverflow.com/users/4883', 'pm_score': 1, 'selected': False, 'text': '<p>For Python, <a href="http://www.logilab.org/857" rel="nofollow noreferrer">pylint</a> can provide some code quality metrics.</p>\n'}, {'answer_id': 60429, 'author': 'Till', 'author_id': 2859, 'author_profile': 'https://Stackoverflow.com/users/2859', 'pm_score': 0, 'selected': False, 'text': '<p>On the PHP front, I believe for example <a href="http://phpundercontrol.org" rel="nofollow noreferrer">phpUnderControl</a> includes metrics through <a href="http://www.phpunit.de/" rel="nofollow noreferrer">phpUnit</a> (if I am not mistaken).</p>\n\n<p>Keep in mind that metrics are often flawed. For example, a coder who\'s working on trivial problems will produce more code and there for look better on your graphs, than a coder who\'s cracking the complex issues.</p>\n'}, {'answer_id': 60450, 'author': 'Tobi', 'author_id': 5422, 'author_profile': 'https://Stackoverflow.com/users/5422', 'pm_score': 1, 'selected': False, 'text': '<p>There\'s also a <a href="http://www.codeplex.com/reflectoraddins/Wiki/View.aspx?title=CodeMetrics&amp;referringTitle=Home" rel="nofollow noreferrer">code metrics plugin</a> for <a href="http://www.red-gate.com/products/reflector/" rel="nofollow noreferrer">reflector</a>, in case you are using .NET.</p>\n'}, {'answer_id': 60467, 'author': 'Rob Wells', 'author_id': 2974, 'author_profile': 'https://Stackoverflow.com/users/2974', 'pm_score': 0, 'selected': False, 'text': '<p>If you\'re after some trend analysis, does it really mean anything to measure beyond SLOC?</p>\n\n<p>Even if you just doing a grep for trailing semi-colons and counting the number of lines returned, what you are after is consistency in the SLOC measurement technique. In this way today\'s measurement can be compared with last month\'s measurement in a meaningful way.</p>\n\n<p>I can\'t really see what would a trend of McCabe Cyclometric Complexity give? I think that CC should be used more for a snapshot of quality to provide feedback to the developers.</p>\n\n<p>Edit: Ooh. Just thought of a couple of other measurements that might be useful. Comments as a percentage of SLOC and test coverage. Neither of which you want to let slip. Coming back to retrofit either of these is never as god as doing them "in the heat of the moment!"</p>\n\n<p>HTH.</p>\n\n<p>cheers,</p>\n\n<p>Rob</p>\n'}, {'answer_id': 100173, 'author': 'prakash', 'author_id': 123, 'author_profile': 'https://Stackoverflow.com/users/123', 'pm_score': 2, 'selected': False, 'text': '<p><a href="http://sourceforge.net/projects/codeanalyze-gpl/" rel="nofollow noreferrer">Code Analyzer</a> is simple tool which generates this kind of metrics.</p>\n\n<p><a href="https://i.stack.imgur.com/iiyaB.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/iiyaB.png" alt="alt text"></a><br>\n<sub>(source: <a href="http://www.codeanalyzer.teel.ws/docs/post-analysis-shot.png" rel="nofollow noreferrer">teel.ws</a>)</sub>  </p>\n'}, {'answer_id': 105338, 'author': 'Andreas Petersson', 'author_id': 16542, 'author_profile': 'https://Stackoverflow.com/users/16542', 'pm_score': 2, 'selected': False, 'text': '<p>keep in mind, What you measure is what you get. loc says nothing about productivity or efficency. </p>\n\n<p>rate a programmer by lines of code and you will get.. lines of code.\nthe same argument goes for other metrics.</p>\n\n<p>otoh.. <a href="http://www.crap4j.org/" rel="nofollow noreferrer">http://www.crap4j.org/</a> is a very conservative and useful metric. it sets complexity in relation with coverage.</p>\n'}, {'answer_id': 238427, 'author': 'Patrick from NDepend team', 'author_id': 27194, 'author_profile': 'https://Stackoverflow.com/users/27194', 'pm_score': 2, 'selected': False, 'text': '<p>Concerning the tool <a href="http://www.NDepend.com" rel="nofollow noreferrer">NDepend</a> it comes with 82 different code metric, from Number of Lines of Code, to Method Rank (popularity), Cyclomatic Complexity, Lack of Cohesion of Methods, Percentage Coverage (extracted from NCover or VSTS), Depth of Inheritance...</p>\n\n<p>With its rule system, NDepend can also find issues and estimates <a href="http://www.ndepend.com/docs/technical-debt" rel="nofollow noreferrer">technical debt</a> which is an interesting code metric (amount of dev-effort to fix problems <em>vs.</em> amount of dev-time spoiled per year to let problems unfixed). </p>\n\n<p>All these metrics are detailled <a href="http://www.ndepend.com/Metrics.aspx" rel="nofollow noreferrer">here</a>. </p>\n'}, {'answer_id': 238436, 'author': 'andreas buykx', 'author_id': 19863, 'author_profile': 'https://Stackoverflow.com/users/19863', 'pm_score': 0, 'selected': False, 'text': '<p><a href="http://www.scitools.com/products/understand/" rel="nofollow noreferrer">Scitools\' Understand</a> does have the capability to generate a lot of code metrics for you. I don\'t have a lot of experience with the code metrics features, but the static analysis features in general were nice and the price was very reasonable. The support was excellent.</p>\n'}, {'answer_id': 238446, 'author': 'Jack Leow', 'author_id': 31506, 'author_profile': 'https://Stackoverflow.com/users/31506', 'pm_score': 2, 'selected': False, 'text': '<p>Atlassian FishEye is another excellent tool for the job. It integrates with your source control system (currently supports CVS, SVN and Perforce), and analyzes all your files that way. The analysis is rather basic though, and the product itself is commercial (but very reasonably priced, IMO).</p>\n\n<p>You can also get an add-on for it called Crucible that facilitates peer code reviews.</p>\n'}, {'answer_id': 2142984, 'author': 'abhishek', 'author_id': 255575, 'author_profile': 'https://Stackoverflow.com/users/255575', 'pm_score': 2, 'selected': False, 'text': '<p>NDepend, I am using it and its best for this purpose.\nCheck this :\n<a href="http://www.codeproject.com/KB/dotnet/NDepend.aspx" rel="nofollow noreferrer">http://www.codeproject.com/KB/dotnet/NDepend.aspx</a></p>\n'}, {'answer_id': 2143054, 'author': 'Romain Linsolas', 'author_id': 26457, 'author_profile': 'https://Stackoverflow.com/users/26457', 'pm_score': 4, 'selected': False, 'text': '<p><a href="http://sonar.codehaus.org" rel="noreferrer">Sonar</a> is definitively a tool that you must consider, especially for Java projects. However it will also handle PHP or C/C++, Flex and Cobol code.</p>\n\n<p>Here is a screenshot that show some metrics on a project:</p>\n\n<p><a href="http://sonar.codehaus.org/wp-content/uploads/2009/05/squid-metrics.png" rel="noreferrer">alt text http://sonar.codehaus.org/wp-content/uploads/2009/05/squid-metrics.png</a></p>\n\n<p>Note that you can try the tool by using their demo site at <a href="http://nemo.sonarsource.org" rel="noreferrer">http://nemo.sonarsource.org</a></p>\n'}, {'answer_id': 2263481, 'author': 'Topdown', 'author_id': 175295, 'author_profile': 'https://Stackoverflow.com/users/175295', 'pm_score': 2, 'selected': False, 'text': '<p>For Visual Studio .NET (at least C# and VB.NET) I find the free <a href="http://www.exactmagic.com/products/studiotools/index.html" rel="nofollow noreferrer">StudioTools</a> to be extremely useful for metrics. It also adds a number of features found in commercial tools such as <a href="http://www.jetbrains.com/resharper/" rel="nofollow noreferrer">ReSharper</a>.</p>\n'}, {'answer_id': 6748000, 'author': 'Benji', 'author_id': 852067, 'author_profile': 'https://Stackoverflow.com/users/852067', 'pm_score': 0, 'selected': False, 'text': '<p><a href="http://www.projectcodemeter.com" rel="nofollow">Project Code Meter</a> gives a differential development history report (in Excel format) which shows your coding progress metrics in SLOC, time and productivity percentage (it\'s time estimation is based on cyclomatic complexity and other metrics). Then in Excel you can easily produce the graph you want.</p>\n\n<p>see this article which describes it step by step:\n<a href="http://www.projectcodemeter.com/cost_estimation/help/FN_monsizing.htm" rel="nofollow">http://www.projectcodemeter.com/cost_estimation/help/FN_monsizing.htm</a></p>\n'}, {'answer_id': 12158068, 'author': 'Baljeetsingh', 'author_id': 1415364, 'author_profile': 'https://Stackoverflow.com/users/1415364', 'pm_score': 1, 'selected': False, 'text': '<p>I would recommend <a href="http://visualstudiogallery.msdn.microsoft.com/9f35524b-a784-4dbc-bd7b-6babd7a5a3b3" rel="nofollow">Code Metrics Viewer Exention</a> for visual studio. </p>\n\n<p>It is very easy to analyze solution at once, also do comparison if you made progress ;-) </p>\n\n<p>Read more <a href="http://codemetricsviewer.wordpress.com/features/" rel="nofollow">here</a> about the <a href="http://codemetricsviewer.wordpress.com/features/" rel="nofollow">features</a></p>\n'}, {'answer_id': 23445331, 'author': 'Tibor Bakota - FrontEndART', 'author_id': 3599240, 'author_profile': 'https://Stackoverflow.com/users/3599240', 'pm_score': 0, 'selected': False, 'text': '<p>For Java you can try our tool, <a href="http://www.quality-gate.com/" rel="nofollow">QualityGate</a> that computes more than 60 source code metrics, tracks all changes through time and also provides an overall rating for the maintainability of the source code. </p>\n'}]
['https://Stackoverflow.com/questions/60394', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1324220/']