-
Notifications
You must be signed in to change notification settings - Fork 0
For Developers
To run the tests, navigate to the catkin_ws
directory and run catkin_make run_tests
.
To ensure that the codebase stays clean, we will be using flake8 to enforce our style guide, which is mostly based off of pep8. To automate most of this process, you can use autopep8, which is a tool that automatically resolves most style issues. Example usage is shown below. Our team has agreed upon a 120 character line limit.
- Installation
pip install flake8 pip install --upgrade autopep8
- Usage
autopep8 --in-place --aggressive --max-line-length 120 --aggressive <path_to_file> flake8 --statistics --max-line-length 120 <path_to_file>
-
Open the Command Palette (Ctrl+Shift+P) and enter and select Preferences: Open Settings (JSON)
-
This opens the settings.json file. Add the following lines somewhere after the first line and before the last line, then save it
"python.linting.enabled": true, "python.linting.flake8Enabled": true, "python.linting.flake8Args": [ "--max-line-length=120", ],
- These lines enables Python linting, selects the flake8 linter, and increases the maximum line length warning to 120 characters
- If you get a warning about flake8 not being installed, click the install button, or run pip install flake8
-
It also might be helpful to set a vertical ruler at 120 characters so that you can see when you are about to go over the limit, and see trailing white spaces (another lint warning). Add the following lines to settings.json then save it
"editor.rulers": [120], "editor.renderWhitespace": "trailing",
-
To check if everything is working, add an extra white space to a line, save the file, and check the PROBLEMS tab (Ctrl+` to open the terminal then select the PROBLEMS tab). It should look something like below
To ensure that the code continues to work as we make changes, we have setup continuous integration with CircleCI. It pulls the Dockerhub image for ROS and OMPL, sets up the workspace, and runs the lint and tests. Click here to see how this is done.