You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you are new hear, it is really recommended that you talk to maintainers
14
+
before starting to work on an issue.
15
+
That way you avoid working on something that is already being worked on or
16
+
something that is not in line with the project's goals.
17
+
18
+
If you want to develop a new feature that is not in the issues list, please open
19
+
a new issue to discuss it with the maintainers before submitting a PR.
20
+
21
+
Once the issue is assigned to you, you can start working on it.
22
+
23
+
24
+
25
+
Creating a new branch
26
+
---------------------
27
+
28
+
At your local machine, ...
29
+
30
+
Opening the PR
31
+
--------------
32
+
33
+
When you open a PR, you should:
34
+
35
+
* Use labels to help maintainers understand what the PR is about.
36
+
* Link any issue that may be closed when the PR is merged.
37
+
38
+
39
+
Remember, the PR is yours, not ours! You should keep track of it and update it as needed.
40
+
41
+
42
+
Continuous Integration (CI)
43
+
---------------------------
44
+
45
+
There are several automation on our repository to help us maintain the code quality.
46
+
47
+
Currently, our CI pipeline runs the following checks:
48
+
49
+
* **Linting**: we run `flake8`, `pylint`, `black` and `isort` on top of your latest commit in order to check for code style issues. To understand more about these tools, please read ...
50
+
* **Testing**: we run the tests defined in the `tests` folder to make sure your changes do not break any existing functionality. The tests will be executed 6 times, each time with a different Python version (the oldest and newest supported version) and with three different operating systems (Windows, Linux and MacOS).
51
+
* **Coverage**: based on the tests results, we also check the code coverage. There is an automation to check if the code coverage increased or decreased with your PR. It also points
52
+
53
+
Once you open your PR or commit and push to your branch, the CI will be initialized.
54
+
Please correct any issues that may arise from the CI checks.
55
+
56
+
.. note::
57
+
58
+
All the commands we run in the CI pipeline can also be run locally. It is important \
59
+
that you run the checks locally before pushing your changes to the repository.
60
+
61
+
The CHANGELOG file
62
+
------------------
63
+
64
+
We keep track of the changes in the `CHANGELOG.md` file. When you open a PR, you should add a new entry to the `Unreleased` section of the file. This entry should simply be the title of your PR.
65
+
66
+
.. note::
67
+
68
+
In the future we would like to automate the CHANGELOG update, but for now \
Copy file name to clipboardExpand all lines: docs/development/style_guide.rst
+41-14Lines changed: 41 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,31 +1,38 @@
1
1
Style Guide
2
2
===========
3
3
4
-
This page describes code, documentation and git branching styles used throughout RocketPy's development.
4
+
This page describes code, documentation and git branching styles used throughout
5
+
RocketPy's development.
5
6
6
7
Code Style
7
8
----------
8
9
9
-
We mostly follow the standard Python style conventions as described here: `Style Guide for Python Code <https://www.python.org/dev/peps/pep-0008/>`_
10
+
We mostly follow the standard Python style conventions as described here:
11
+
`Style Guide for Python Code <https://www.python.org/dev/peps/pep-0008/>`_
10
12
11
13
Naming Conventions
12
14
^^^^^^^^^^^^^^^^^^
13
-
RocketPy was, unfortunately, initially coded using `Camel Case <https://en.wikipedia.org/wiki/Camel_case>`_.
15
+
RocketPy was, unfortunately, initially coded using
16
+
`Camel Case <https://en.wikipedia.org/wiki/Camel_case>`_.
14
17
However, PEP8 specifies the following::
15
18
16
-
Function names should be lowercase, with words separated by underscores as necessary to improve readability.
19
+
Function names should be lowercase, with words separated by underscores as \
20
+
necessary to improve readability.
17
21
Variable names follow the same convention as function names.
18
22
19
23
mixedCase is allowed only in contexts where that is already the prevailing style (e.g. threading.py), to retain backwards compatibility.
20
24
21
25
Therefore, `Snake Case <https://en.wikipedia.org/wiki/Snake_case>`_ is preferred.
22
-
For this reason, RocketPy is being converted from Camel to Snake as of version ``1.0.0``.
23
-
New contributions should strive to follow Snake case as well.
26
+
For this reason, RocketPy has being fully converted from `CamelCase` to `snake_case` as of version ``1.0.0``.
27
+
New contributions should strive to follow `snake_case` case as well.
24
28
25
-
Furthermore, when it comes to naming new variables, functions, classes or anything in RocketPy, always try to use descriptive names.
29
+
Furthermore, when it comes to naming new variables, functions, classes or
30
+
anything in RocketPy, always try to use descriptive names.
26
31
27
-
As an example, instead of using `a` or `alpha` as a variable for a rocket's angle of attack, `angle_of_attack` is preferred.
28
-
Such descriptive names make the code significantly easier to understand, review and maintain.
32
+
As an example, instead of using `a` or `alpha` as a variable for a rocket's
33
+
angle of attack, `angle_of_attack` is preferred.
34
+
Such descriptive names make the code significantly easier to understand, review
35
+
and maintain.
29
36
30
37
In summary:
31
38
@@ -38,18 +45,38 @@ In summary:
38
45
angle_of_attack =0.2# in rad
39
46
40
47
41
-
Linting
42
-
^^^^^^^
43
-
As far as line wrapping, parentheses, calling chains and other code style related matter goes, RocketPy currently employs `Black style <https://black.readthedocs.io/en/stable/the_black_code_style/current_style.html>`_.
48
+
Linting and formatting
49
+
^^^^^^^^^^^^^^^^^^^^^^
50
+
51
+
As far as line wrapping, parentheses, calling chains and other code style
52
+
related matter goes, RocketPy currently employs `Black style <https://black.readthedocs.io/en/stable/the_black_code_style/current_style.html>`_.
44
53
Installing Black and running it before submitting a pull request is highly recommend.
45
54
Currently, there are pull request tests in place to enforce that Black style is used.
46
55
56
+
Aside from Black, RocketPy also uses `Flake8 <https://flake8.pycqa.org/en/latest/>`_
57
+
and `Pylint <https://pylint.pycqa.org/en/latest/>`_ to check for code style issues.
58
+
59
+
Running these commands before submitting a pull request is also highly recommended:
60
+
61
+
.. code-block:: bash
62
+
63
+
make flake8
64
+
make pylint
65
+
66
+
These commands will check for any code style issues in the codebase.
67
+
The `flake8` command will throw a report directly to the console, while the
68
+
`pylint` command will create a `.pylint_report.txt` file in the root directory,
69
+
which you can open to see the report.
70
+
71
+
47
72
48
73
Documentation Style
49
74
-------------------
50
75
51
-
Every class, method, attribute and function added to RocketPy should be well documented using docstrings.
52
-
RocketPy follows NumPy style docstrings, which are very well explained here: `NumPyDoc Style Guide <https://numpydoc.readthedocs.io/en/latest/format.html>`_.
76
+
Every class, method, attribute and function added to RocketPy should be well
77
+
documented using docstrings.
78
+
RocketPy follows NumPy style docstrings, which are very well explained here:
0 commit comments