code-analysis

How can I compare similar codebases?

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 a...

Where can I find static/dynamic code analysis tools for XSLT?

Are there any static or dynamic code analysis tools that analyze XSLT/XSL code? The resources I have been able to find so far are: 1. Oxygen xml editor 2. http://gandhimukul.tripod.com/xslt/xslquality.html which looks faily basic in its capabilities ...

Is there a way to figure out the top callers of a C function?

Say I have function that is called a LOT from many different places. So I would like to find out who calls this functions the most. For example, top 5 callers or who ever calls this function more than N times. I am using AS3 Linux, gcc 3.4. For now I just put a breakpoint and then stop there after every 300 times, thus brute-forcing ...

php best practices enforcement

I try to ensure that the code I write is of the best quality possible, so I strive to follow accepted sets of best practices. In perl, I try to follow the guidelines in the popular book "Perl Best Practices" and I use the perlcritic module to enforce the policies recommended in that book. Perlcritic checks my code to ensure that each re...

How to configure StyleCop to suppress warnings on generated code?

Another project, Visual Studio's Code Analysis has this option. But I couldn't find it for StyleCop (AKA Source Analysis). The file I want to ignore is a dbml's .designer.cs code, that includes the // <autogenerated> tag. A blog post tells me that it would be sufficient, but in my case it is not. ...

C# lock and code analysis warning CA2002

In my application I have a form that starts synchronization process and for number of reasons I want to allow only one synchronization to run at a time. So I've added a static bool field to my form indicating whether sync is in progress and added a lock to set this field to true if it wasn't already set so that first thread could start s...

Programmatically inspect .NET code

I am looking for a way to programmatically inspect a .NET (C#, VB.NET,..) source code to perform static code analysis. I'd like to perform queries on the code such as: - list classes whose name begin by x - list all the subclasses of x - list methods which instanciate an object of class x - determine if method x contains a variable name...

Static Code Analysis - Which ones to turn on first?

Hi, We're using VS2008 with the built in static code analysis rule set. We've got a relatively large C# solution (150+ projects) and while some of the projects (< 20) are using static code analysis religiously, most are not. We want to start enforcing static code analysis on all projects, but enabling all rules would create a massive di...

Can I safely ignore CodeAnalysis warning: replace string == "" with string.IsNullOrEmpty ?

I've got code similar to this: string s = CreateString(); if (s == "") foo(s); If s equals "", foo should be called. If string is null, which should never happen, then a NullReferenceException is fine (as this is, after all, an exceptional situation). CodeAnalysis tells me to test for s.IsNullOrEmpty. This would alter the functionali...

How to Check References of Annotated Methods

I'm trying to find a way to check my classes for references of methods with a particular annotation (think "Deprecated"). As far as i see it, analysing byte code won't work because it doesn't contain any annotations. Using APT doesn't really help because i need the references to the methods, not the annotated methods themselves. So, wh...

Configuring Team System Code Analysis via a FxCop rules file

Is there anyway to configure the code analysis rules in Visual Studio Team System to match those in an FxCop configuration file and keep them in sync automatically? Not all the developers on the team have TS so keeping the rules we are currently running in an FxCop file is required so everyone can run the same set, but it would nice for...

Syntax analysis question

In school we were assigned to design a language and then to implement it, (I'm having so much fun implementing it =)). My teacher told us to use yacc/lex, but i decided to go with java + regex API, here is how the the language I designed looks: Program "my program" var yourName = read() if { equals("guy1" to yourName) } print("hello m...

Visual Studio Team System 2008 Database Edition - no Code Analysis tools?

I can't find the code analsis tool in Visual Studio Team System 2008 Database Edition. Is this feature not available in the Database Edition? ...

Clean-rooming when software testing

I want to examine exactly how my code operates when using other libraries to which I do not have the code for. Whilst I can do this online (i.e. with FileMon, RegMon and TCPView from SysInternals), I was wondering if there was a good offline method that would allow me to run up my code in a virtual machine, shutdown the virtual machine a...

Getting code statistics from big projects

I'm interested in code statistics tools. Specifically I need to get statistics on Java EE code, but any code analyzer would do. Should I start creating one of my own or is there some project that you have used? ex. LOC, number of classes , libs ... What is your experience ? ...

SourceMonitor xml dump to database

Hi, Is there a library or a tool that could parse the xml dump of SourceMonitor and save it in database? SourceMonitor is a great tool, but I'd like to have better visualization and statistics-over-time of our code, which you really can't get with SourceMonitor. ...

Free or commercial code analysis service for Visual Basic

Anyone know a good code analysis service or tool for vb.net? Like the one for c# with visual studio 2008 team edition or style cop for c# Update: My bad ,I am only using the visual studio pro in my new work place,so I could not use the code analysis for visual studio 2008 team edition ...

Obtain Listing of all Fields in a Project

I have a relatively large solution that I compile to DLL. I would like to print out or list all the fields in every class in this project. I'm looking for a Visual Studio feature, Visual Studio add-on, external tool, script, or code snippet (something involving reflection, perhaps?) that will allow me to simply print out all these fie...

CAT.NET "Sanitize the file path prior to passing it to file system routines" message

Hi. I'm analyzing my code (C#, desktop application) with CAT.NET Code Analysis and getting "Sanitize the file path prior to passing it to file system routines" message when dealing with file names. What I don't understand is that to ensure the file name is valid, I use: void SomeMethod(String filename) { filename = System.IO.Path.Ge...

Addin Suggestions for Analyzing An Inherited ASP.net Website Solution

Hi All, I have "inherited" an ASP.net 2.0 VB project and have been given a list of items the customer wants changed. This is not my original work, I've "inherited" it from another coder who went AWOL. The customer just wants the site to work, but has found a few issues that need to be changed. Unfortunately, the project is over budge...