Reputation: 20249
I spent some two hours trying to understand why the JavaScript file I am including in my Facebook application is not showing when I view the source of my page. Then guess what the problem turned out to be? I forget to add the final closing bracket of a statement, and as Facebook processes the scripts before adding them (to avoid having unexpected errors in Facebook platform), it didn't attach this script because it has a syntax error!! That is, a whole JavaScript was not added because of a missing bracket!
So to save my time in the future I want to get some syntax validation tools for the scripting languages I am using: PHP, Python, JavaScript, MySQL (although not really a scripting language). Can anybody help me with that? It would be great if they are Vim plugins as I use it heavily.
Feel free to share validation tools for other programming languages, I don't want to keep this post for me only.
Upvotes: 2
Views: 925
Reputation: 11232
It's tagged with VIM
so I would suggeest to look at jslint.vim.
I use it (with a few fixes for Windows XP) with VIM 7.3.
Other nice (and much easier to setup on Windows) tool is syntastic.vim. According to documentation it works for eruby
, haml
, html
, javascript
, php
, python
, ruby
and sass
.
Upvotes: 4
Reputation: 13776
Javascript: JSLint
Python: PyLint, PyChecker, PyFlakes
PHP: Is there a static code analyzer [like Lint] for PHP files?
With scrip^H^H^H^Hdynamic languages, i advise to carefully configure the various lint-like tools, because the style of programming and requirements of the project dictate different needs as for what should be forbidden or not.
For instance, you might want to avoid 'import *' in Python, except in a few cases. Or eval() except you really know what you are doing, etc.
There are several VIM plugins to integrate these tools.
Upvotes: 1
Reputation: 3669
Have a look at the JS Editor available from http://www.yaldex.com/Free_JavaScript_Editor.htm
Their interface is really nice but restricted to Javascript only.
I have used Notepad++ in the past which highlights syntax sufficiently well but lacks other features you'd normally expect in an IDE.
Upvotes: 1