80 likes | 358 Views
Javascript Code Quality Check Tools. JavaScript was originally intended to do small tasks in webpages , but now JavaScript is a surprisingly capable language, and it is now being used in larger projects.
E N D
Javascript Code Quality Check Tools JavaScript was originally intended to do small tasks in webpages, but now JavaScript is a surprisingly capable language, and it is now being used in larger projects. Many of the features that were intended to make the language easy to use are troublesome when projects become complicated. So now a tools needed for JavaScript syntax checker and validate code. Any code base eventually becomes huge at some point, and simple mistakes–that would not show themselves when written–can become show stoppers and waste hours of debugging. And this is when static code analysis tools come into play and help developers to spot such problems. Note: While static code analysis tools can spot many different kind of mistakes, it can’t detect if our program is correct, fast or has memory leaks. We should always combine tools like JSHint with unit and functional tests as well as with code reviews.
Javascript Code Quality Check Tools There are different tools available for Javascript code quality check below are the list of JavaScript code quality check tools used in the industry let’s look at each of them in details. jsLint: by Douglas Crockford jsHint: Community-driven jsLint branch that went a bit separate way Google Closure Linter Google Clouse Compiler
Javascript Code Quality Check Tools JSLint JSLint is a JavaScript program that looks for problems in JavaScript programs. It is a code quality tool checks JavaScript syntax and validate. JSLint takes a JavaScript source and scans it. If it finds a problem, it returns a message describing the problem and an approximate location within the source. The problem is not necessarily a syntax error, although it often is. JSLint looks at some style conventions as well as structural problems. It does not prove that our program is correct. It just provides another set of eyes to help spot problems. Mandatory sets javascript syntaxes rules for jsLint and some options can’t be disabled resulting in project run failure.
Javascript Code Quality Check Tools JSHint JSHint is a community-driven tool to detect errors and potential problems in JavaScript code and to enforce our team’s coding conventions. It is very flexible so you can easily adjust it to our particular coding guidelines and the environment we expect our code to execute in. The goal of this project is to help JavaScript developers write complex programs without worrying about typos and language gotchas. JSHint scans a program written in JavaScript and reports about commonly made mistakes and potential bugs. The potential problem could be a syntax error, a bug due to implicit type conversion, a leaking variable or something else. The main difference between jsHint and jsLint is that jsHint is customizable. We can enable/disable all of the style features. It’s not that strict as jsLint, but if we have a large amount of legacy code that should be lintered, it provides us with ability to disable some rules for our code to run properly.
Javascript Code Quality Check Tools Google Closure Linter The Closure Linter is a utility that checks JavaScript files for style issues such as operator placement, missing semicolons, spacing, the presence of JsDoc annotations, and more. The Closure Linter is used by nearly every team at Google that writes JavaScript The Closure Linter ensures that all of our project's JavaScript code follows the guidelines in the Google JavaScript Style Guide. It can also automatically fix many common errors, which saves our time and lets us focus on coding.
Javascript Code Quality Check Tools Google Clouse Compiler The Closure Compiler compiles JavaScript into compact, high-performance code. The compiler removes dead code and rewrites and minimizes what's left so that it downloads and runs quickly. It also checks syntax, variable references, and types, and warns about common JavaScript pitfalls. These checks and optimizations help us write apps that are less buggy and easier to maintain.
Javascript Code Quality Check Tools Compare Google Closure Linter A good utility, easy to install (with easy_install), doesn’t bother user with options and settings, just works from the box and checks your syntax, not going too deep into bugs and stuff. If you and your team are fans of Google style recommendations and use Eclipse for development that might be the tools just for you. jsLint Really thorough in searching different javascript bugs, insecurities and also checks syntax problems. The thing is, that this tools goes by strict set of rules, and if you agree with them and use jsLint right from the project start – it will work out great. Otherwise, if you have several developers that do not work by one code convention, or if your project is in the late development stage and went through several different developers – linting such code with jsLint might be quite difficult, because of different coding styles through the project, especially if someone disagrees with syntax rules. But, on the other hand, with support by many IDE’s jsLint can be used to highlight problems on the fly, so at least new code will be well written.
Javascript Code Quality Check Tools Compare jsHint Very customizable. From the box can check both syntax problems and search for possible bugs, but can become much stricter if you need it. Same as jsLint, has support if many popular IDE’s and can be set up to highlight possible problems. If you need to set some custom code conventions for your team – this is the tool for you. You can always tune the set of rules however you want, and even make it as strict as jsLint.