Coding Standards & Checkers
Use the space bar or right arrow for next slide,
left arrow to back up.
Objectives
Define coding standards
Make code easier to navigate and read
Reduce chance for errors
Enable automated processing of code by tools
Enforce the style
Doing it by hand takes too much time
Is likely not to be done consistently
How does Framework fit in?
It may have code templates
It may generate code
Does it enforce any standards?
What are its standards?
Do they match other established standards?
Do we need to worry about matching standard for hand-written code with framework's provided/generated code?
Languages we will be using
Python
HTML
CSS
Javascript
SQL - indirect, through web2py API
XML - probably
How does Web2Py fit in?
May or may not adhere to established standards
Web discussions suggest it does not adhere to established Python coding standards.
Perhaps we should check on this?
DOCTYPE says "XHTML 1.0 Strict/EN"
Web discussions suggest it does not actually adhere to the standard
Perhaps we should check on this?
HTML & CSS Coding Standards
W3C standard for HTML 4.01
http://validator.w3.org/source/
: HTML validator
http://validator.w3.org/docs/checklink.html
: link checker
CSS Level 2
http://jigsaw.w3.org/css-validator/
: CSS validator
Python Coding Standards
http://www.python.org/dev/peps/pep-0008/
: Style Guide for Python Code (a.k.a. PEP8), from
http://www.python.org
http://github.com/cburroughs/pep8.py
: pep8.py, a checker for the PEP8 style guide mentioned above
http://www.logilab.org/857
: CalTech Python style guide
http://www.cs.caltech.edu/courses/cs11/material/python/misc/python_style_check
: CalTech style checker
Other Python Code Checkers
http://www.logilab.org/857
: Pylint, a Python style checker
http://www.divmod.org/trac/wiki/DivmodPyflakes
: PyFlakes, another lint-like checker
http://pychecker.sourceforge.net/
: Pychecker, a static error checker similar to
lint
(subject to some spurious warnings)
Javascript Checkers
http://www.javascriptlint.com/
: JavaScript Lint
http://www.jslint.com/
: JS Lint