Lint tool for actionscript?

2019-02-16 09:33发布

问题:

Are there any lint tools available for actionscript? One source would be ideal, but anything is welcome.

My team is starting to adopt more a more rigorous style guide (where "more rigorous" means "existant"), and I think a linter would help us all adhere more easily to the style rules we've agreed on. I'm not above writing my own, but I'd like to see what else is out there first.

A quick search on Google reveals nothing (at least so far).

回答1:

If you're dealing with Flex, take a look at FlexPMD.



回答2:

FlexPMD should actually be named As3PMD. I mean you can run FlexPMD against a pure AS3 project, not necessarly a Flex project.

That said there are around 10 rules which are Flex-specific.

Xavier



回答3:

It's not Lint, but I've found the free FlashDevelop to make me write better code, as it complains about many possible problems, such as undeclared variables.

http://www.flashdevelop.org

You could check it out.

Then there's also flex builder that you can use to write AS.



回答4:

Not quite Lint, though Adobe's Flex mxmlc compiler gives plenty of helpful strict warnings about messy ActionScript, such as undeclared variables, missing function return types, and extra commas in an object/hash.

mxmlc resources:

  • http://livedocs.adobe.com/flex/3/html/help.html?content=compilers_15.html#153435
  • http://www.senocular.com/flash/tutorials/as3withmxmlc/

Some related code analysis tools are Yasca (analysis tool for JavaScript, Java, PHP, etc.) and asDox (AS3 parser written in Python), which might be decent starts for writing your own.



回答5:

I have used jslint in the past for jscript. As is written in JavaScript and the full source code is available, so you should be able to get it working with actionscript. I have not used any of the other tools mentions in the answers, so I don't know how they compare.

(jslint takes a very strong view about what is good jscript, you may or may not agree with it.)



回答6:

Actionscript 2.0 and 3.0 are ECMA compliant scripting languages. Since ECMA script is essentially Javascript, you can typically use something like JSure (appears to be Linux only) or Javascript Lint.