lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]




On Feb 20, 2008 6:22 PM, Mark Hamburg <mhamburg@adobe.com> wrote:
A linter looking for writes to globals, however, would complain about
method1 and method2.

On an advanced project, you probably want a customized linter anyways. Looking at the opcodes is a bit late for most analysis, but if you do your checkings at AST level, you can easily add rules like "Don't complain about global assignments when in a function that's an argument to makeClass" (there aren't that many such special functions in a typical project). With a metalua.walk based linter, it would look like:

match function lint_cfg.expr.down
| `Call{ `Id 'makeClass', _, `Function{ _, body } } ->
   walk_block_without_complaining_about_globals(body);
   return 'break' -- prevent regular walking
...
end

I'd be interested to read about the other things you checked statically, and the things you didn't check but wished you did.