How to Find an Actively Developed Lint Tool for Ruby

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

You could give Diamondback Ruby a try. It does a static typecheck of Ruby code, and will thus blame you for using an undefined variable.

While DRuby is an ongoing research project, it already works quite well for small, self-contained Ruby scripts. Currently, it is unable to analyze much of the Ruby standard library “out-of-the-box”. Currently they are working toward typing Ruby on Rails (see their most recent papers).

Automatic code quality tool for Ruby?

I've recently started looking for something like this for Ruby. What I've run across so far:

  • Saikuro
  • Roodi
  • Flog

These might be places to start. Unfortunately I haven't used any of the three enough yet to offer a good opinion.

Are there style checker for Ruby code as JSLint for javascript

There's this tool named rails_best_practices but it's Rails-specific, not general Ruby, and it acts more as a guideline.

Coding style checker or code formatter for Ruby / Rails

There's some style checkers listed at in the Ruby toolbox at https://www.ruby-toolbox.com/categories/code_metrics .

Also, turning on warnings can check for some kinds of bad code. Do so with $VERBOSE = true or by one of the ways listed here.

Are there any XSL Lint tools?

Phillip,

Creating a good lint for xlst is quite hard, because validity of xslt templates depends on the parser that is used. Each parser has it own extensions.
For example java's xalan can be easily extended with custom xpath functions, which are obviously coded in java. Because of that any .net validator will fail to validate advance xalan's xslts.

So first of all you need to know what processor you are going to use. If you use java based processors I recommend to use Eclipse which can validate the templates on the fly.

I've tired two eclipse plugins, It is worth mentioning that both support debugging and xslt/xpath code completion:


Oxygen XML editor - a commercial (~$300) XML/XSLT editor/eclipse plugin.
It can use the following engines: Xalan, Saxon, Xsltproc,

It is able to check:

  • correctness of xsl:template
  • correctness of name attribute of xsl:call-template
  • duplicated definition of xslt variables
  • validity of dtd's
  • validity of xslt header
  • validity of xml namespaces
  • validity of XPath
  • validity of xsl:value-of if an xml is associated to xslt
  • correctness of xsl:import for local and remote files (it support xml catalogs)

I must say that the plugin is really good but on the other hand it isn't open source.


XSLT Project - an open source plugin (it is part of Eclipse Web Tools Platform).
It is quite young (started in September 2008), however it has very active community. Currently it supports only Xalan and JAXP.

It detects the following errors and warnings:

  • invalid xslt header
  • incorrect dtd
  • incorrect imports (it handle only relative imports, xml catalogs are planed for version
    1.1)

The above list is definitely incomplete because lack of support for xml catalogs made this project unusable for me.

Any tips for speeding up static analysis tool PC-Lint? Any experiences using .LOB files?

The main speedup I got was when I started redirecting Lint's sometimes massive output to a file in stead of a regular DOS box on Windows, and then look at the file in an editor.
The -passes option does almost linearly increase the time if the number of passes gets high enough, but not quite when using 2 or 3, since a pre-pocessing/parsing stage is not needed except for the first pass.
I my experience, for really large projects, external include guards, or (Microsoft) the option +pragma(once,once) - if #pragma once is consistently used - may result in enormous speed increases. In one project I dropped compile times by a factor of more than 20, and linting times just a little less...

Using .lob files is like compiling to objects and then linking objects: It depends on how effective your makefile is, and the speed increase depends on how many and which files you have just changed. Be aware, though, that using .lob files is not as thorough as linting all files in one go; some issues have to be ignored, because the .lob files contain only a representation of the source files.

How to debug Ruby scripts

Use Pry (GitHub).

Install via:

$ gem install pry
$ pry

Then add:

require 'pry'; binding.pry

into your program.

As of pry 0.12.2 however, there are no navigation commands such as next, break, etc. Some other gems additionally provide this, see for example pry-byebug.



Related Topics



Leave a reply



Submit