Back to top

More on finding high quality Drupal modules

I've written in the past about finding high quality Drupal modules and the advice that I gave there is still mostly valid. And if you want to improve the quality of data about Drupal modules you should consider Improving Drupal without any work.

Today I revisited a topic that Killes introduced (at least to me) in his post about seeing results of code checker on Drupal modules. This can provide yet another data point about the quality of a drupal module.

The Drupal Code Checker

The Code Checker itself is a php script which lives in CVS. It takes a pass at the code and runs some basic checks. It's validation of SQL queries only works if the queries fit onto one line, it expects SQL keywords (like SELECT and UPDATE to be uppercase). It has problems, but, it is also better than nothing! And, if you see a way to improve it you can edit the file and provide a patch (or patch it yourself if you have CVS access).

The check is run after a commit to CVS during the next run of the packaging script (which happens 3 times a day every 8 hours, 1AM, 9AM, and 17 GMT).

Drupal Code Style

In the scripts/ directory of every Drupal download is a file code-style.pl. This code style check is another validation that is probably not perfect and which is not run in an automated fasion, but it does provide valuable information about the quality of code. Usage examples include:


$ ./code-style.pl ../path/to/myfile.module
$ ./code-style.pl ../modules/path.module

You'll need a perl environment to run the script, but even on Windows that's easy to get with Cygwin.

What does this have to do with quality Modules?

Ok, this is great, but how does it relate to quality modules? As I said, there are flaws with these tests and they may give a perfect review to a piece of code that completely kills your site....however, code that passes these tests is more likely to be well maintained. In the crazy world we live in, there is no such thing as a Golden Seal for modules. We can never really be 100% certain about the quality of modules unless we take the time to through the thing line by line examining it and re-examing it - but we can take hints about quality from a variety of indicators and then draw a conclusion based upon those loose indicators.

So - there's the trick. Does your module pass these tests? If not, why not?

Category: 
People Involved: 

Comments

Good to know

that there are these scripts to help developers improve the quality of their code and reduce security risks.