| Homepage | Content | Slides | Video |
Warning
This lesson is under construction. Learn from it at your own risk. If you have any feedback, please fill out our General Feedback Survey.
(How to( find( the missing parenthesis)).
These tools look at your code files and never actually run the program.
Includes Linting and Type Checking.
Dynamic Code Analysis tools actually run your code and make verifications by watching how your program acts, where it fails, what it does in memory, and if your tests are adequate enough.
Includes Debuggers, Memory Profiling Tools, and Code Coverage.
$ valgrind ./tests/bin/lexer_tests
...
==6703== Conditional jump or move depends on uninitialised value(s)
...
==6703== by 0x4018C1: print_token (lexer.c:36)
==6703== by 0x4011F7: test_get_tok (lexer_tests.c:54)
==6703== by 0x4008CD: main (lexer_tests.c:8)
...
==6703== LEAK SUMMARY:
==6703== definitely lost: 192 bytes in 8 blocks
==6703== indirectly lost: 162 bytes in 10 blocks
$ python some_script.py
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<stdin>", line 2, in f
TypeError: unsupported operand type(s) for * : 'int' and 'NoneType'
src/times.js: line 407, col 20, Expected '{' and instead saw 'return'.
src/times.js: line 415, col 49, Missing semicolon.
src/times.js: line 407, col 58, 'error' is not defined.
The Linux kernel style guidelines are actually fun to read:
First off, I’d suggest printing out a copy of the GNU coding standards, and NOT read it. Burn them, it’s a great symbolic gesture.
NASA’s Jet Propulsion Laboratory style guidelines are very short and are concerned with automated tooling to do code analysis:
All loops shall have a statically determinable upper-bound on the maximum number of loop iterations.
Setup and enter the virtual environment.
$ virtualenv <virtualenv name>
New python executable in /path/to/<venv name>/bin/python
Installing setuptools, pip, wheel...
done.
$ soruce <venv name>/bin/activate
Install a package. This installs it in the current working directory and so does not ask for root permissions.
(<venv name>) $ pip install flask
[...]
To list all packages in the venv:
(<venv name>) $ pip freeze
click==6.6
Flask==0.11.1
itsdangerous==0.24
Jinja2==2.8
MarkupSafe==0.23
Werkzeug==0.11.11
Deactivate (leave) the venv.
(<venv name>) $ deactivate
$
A Carbon Copy of the Production Environment(s)