Skip to content

Guidelines for Submitting Code

Tobias Block edited this page Oct 10, 2023 · 2 revisions

Pulling the latest code changes

Because we will be working on the software in parallel with many people, code changes will pushed frequently to the repository. Therefore, it is important that you always pull the latest version of the repository before you start working on something. Otherwise, your local version will be out of sync and you will have to do more merging work -- or even revise your code if conflicting code changes have been committed in the meantime.

You can easily update your local repository via the Source Control page of Visual Studio (using the "Pull" button).

Also, if you work on something, don't wait forever with committing the code. It is better to regularly commit small changes.

Connecting Slack to GitHub

Because there will be many code commits to the repository during the day, it is helpful to connect your Slack account to GitHub, so that you receive a notification whenever a new change has been committed. You can do this in the Slack app by clicking the "Add apps" entry on the left side and selecting the GitHub app in the App Directory. You will have to give Slack read permissions to your GitHub account.

Checking Code with Mypy

Mypy is a very helpful tool for checking your Python code prior to the check-in into the public repository. It is already installed in the dev environment and you can invoke it with the following command:

cd /opt/mri4all/console
mypy .

Please only commit code that does not produce any Mypy errors. Sometimes, Mypy complains about issues that cannot be easily resolved (e.g., related to packages that are included). In this case, you can disable the Mypy check for individual code lines by appending the statement "# type: ignore" to a code line:

from PyQt5.QtGui import *  # type: ignore

Additional Requests

  1. Follow coding standards PEP8 as much as you can

  2. Use consistent and meaningful variable & function names​

  3. Add comments to the code (unless trivial to understand)​

  4. Use tools like mypy, Pylint, and GitHub Co-Pilot ​

  5. Double-check code before pushing to GitHub​

  6. Actively report, assign, and fix issues on GitHub (use the Slack integration!) ​

  7. Read the readme :) and chat with the team​

  8. Please add information to the wiki ​