False positive: precondition is redundant

I know this doesn’t directly answer your question, but it appears you’re using a legacy mode for Code Contracts. This document describes the recommended assembly mode based on usage requirements: http://research.microsoft.com/en-us/projects/contracts/userdoc.pdf From Pages 20, 21… Another snippet from the document: 5.1.1 Assembly Mode The contract tools need to know which usage mode you choose. If … Read more

Can ReSharper be set to warn if IDisposable not handled correctly?

Correct automatic Dispose analysis requires DFA (Data Flow Analysis) in a global way. It is unlikely that you create an IDisposable object and doesn’t call any method on it and do not pass it around as an argument. If disposable object is passed to other methods (including calling its members, when “this” is implicitly passed), … Read more

JSR-305 annotations replacement for Java 9

It’s true that two modules cannot, ordinarily, define types in the same package. Until recently, putting jsr305.jar on the class path of a JDK 9 build would have no effect: That JAR file defines types in the javax.annotation package but that package is defined in the platform’s built-in java.xml.ws.annotation module, and the latter takes precedence. Owing … Read more

Where can I find an actively developed lint tool for Ruby?

ruby -c myfile.rb will check for correct Ruby syntax. Reek checks Ruby code for common code smells. Roodi checks Ruby code for common object-oriented design issues. Flog can warn you about unusually complex code. [Plug] If your project is in a public Github repository, Caliper can run the latter three tools and others on your … Read more

C#/.NET analysis tool to find race conditions/deadlocks

You’re probably looking for one of these: CHESS Typemock Racer NOTE: This answer is from 2010. As with all recommendations answers, recommendations tend to change over time. There may be other products out there now, CHESS which was a Microsoft Research Labs project may have evolved into a final product or been scrapped altogether. Please … Read more

@GuardedBy annotation with java.util.concurrent.locks.ReadWriteLock

At the time of this writing, @GuardedBy isn’t fully implemented by Findbugs, and is mostly just for documentation. (It is partially implemented.) I always use @GuardedBy(“readwritelock”) or the object that I use to synchronize. For example of the latter: class Example { private Object lock = new Object(); @GuardedBy(“lock”) private Stuff innards = …; public … Read more

Why do code quality discussions evoke strong reactions? [closed]

One obvious answer for the Stack Overflow part is that it isn’t a forum. It is a database of questions and answers, which means that duplicate questions are attempted avoided. How many different questions about code quality can you think of? That is why there aren’t 50,000 questions about “code quality”. Apart from that, anyone … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)