Coding Requirements
Documentation Requirements
- Set up VS Code to use reStructuredText formatting of docstrings.
- Docstrings are mandatory for each module, class, method or function.
Implementation Requirements
MUST be based on the design and MIGHT trigger revisions of the design and test cases.
- Implement each function/method in the Python module by following your design and complying with the implementation requirements given in the docstring, if any. In addition, your implementation:
- MUST NOT use list comprehensions OR lambda functions
- MUST NOT use iteration over range(len(…)) when you need the element itself from the collection
- MUST NOT take input from the user
- MUST NOT change the input parameter if the parameter is a mutable collection.
- The parameter is used to get an actual value from calling the function/method.
- MUST have variable names according to Python naming conventions
- MUST have docstrings according to Python docstring conventions
- MUST use return statements, NOT print() calls, to return a value to the calling function/method
- MUST have
raise
stateemnts to validate the parameter data types, if required in the lab/homework specifications
- Static analysis of code is supported by VS Code in real time. Pay attention to the warnings and errors reported in the Problems panel.
- Test, debug, fix errors, review the function/method design accordingly.
- This incremental development step MUST conclude the development cycle of one function/method at a time.
Version control
- When the implementation runs correctly, commit changes associated with this development step.
Note
- Test-driven development is not linear.
- Changes to implementation might require changes to the design or test cases or even documentation.
- Go back to previous steps as needed.
Static Analysis Requirements of Code Syntax and Styling
Checking static code analysis problems MUST happen each time you complete the implementation of a development step, whether it’s a function or method, or class, or testing function.
- Examine the warnings and errors reported the Problems panel, if any, and fix them.
- Use
black
formatter to automatically fix some of the errors (reported bypylance
,pylint
, andflake8
)- These are Microsoft VS Code extensions (Python libraries) you can install using the VS Code Extensions panel.
- Remaining errors listed in the Problems panel must be fixed by you.
- Install and run
pycodestyle
to check on and fix additional errors.
Version control
- Do version control do document that you have resolved the static analysis errors.