Skip to content

Commit 708557a

Browse files
authored
Revise pre-commit instructions and docstring guidelines
Updated the CONTRIBUTING.md file to clarify pre-commit plugin usage and improve docstring requirements.
1 parent 45e929e commit 708557a

1 file changed

Lines changed: 5 additions & 9 deletions

File tree

‎CONTRIBUTING.md‎

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ These calculations or manipulations can use data types, classes, or functions of
8686
Algorithms in this repo should not be how-to examples for existing Python packages. Instead, they should perform internal calculations or manipulations to convert input values into different output values.
8787
Those calculations or manipulations can use data types, classes, or functions of existing Python packages, but each algorithm in this repo should add unique value.
8888

89-
#### Pre-commit plugin
89+
#### Pre-commit
9090

9191
Use [pre-commit](https://pre-commit.com/#installation) to automatically format your code to match our coding style:
9292

@@ -95,9 +95,7 @@ python3 -m pip install pre-commit # only required the first time
9595
pre-commit install
9696
```
9797

98-
That's it! The plugin will run every time you commit any changes. If there are any errors found during the run, fix them and commit those changes. You can even run the plugin manually on all files:
99-
100-
That's it! The plugin will run every time you commit any changes. If any errors are found during the run, fix them and commit those changes. You can even run the plugin manually on all files:
98+
That's it! Pre-commit will run every time you commit any changes. If any errors are found during the run, fix them and commit those changes. You can even run the plugin manually on all files:
10199

102100
```bash
103101
pre-commit run --all-files --show-diff-on-failure
@@ -130,8 +128,6 @@ We want your work to be readable by others; therefore, we encourage you to note
130128
ruff check
131129
```
132130

133-
- Original code submission require docstrings or comments to describe your work.
134-
135131
- Original code submissions require docstrings or comments to describe your work.
136132

137133
- More on docstrings and comments:
@@ -141,12 +137,12 @@ We want your work to be readable by others; therefore, we encourage you to note
141137
The following are considered to be bad and may be requested to be improved:
142138

143139
```python
144-
x = x + 2 # increased by 2
140+
x += 2 # increased by 2
145141
```
146142

147-
This is too trivial. Comments are expected to be explanatory. For comments, you can write them above, on, or below a line of code, as long as you are consistent within the same piece of code.
143+
This is too trivial. Comments should not merely repeat what the code already says. Comments should explain ___why___ we are doing things. Comments on the same line as code should never cause the line to wrap (> 88 characters per line). Comments which are not on the same line as code should appear ___before___ the code they describe. "First tell the reader ___why___ with comments and then show them ___how___ with code."
148144

149-
We encourage you to put docstrings inside your functions, but please pay attention to the indentation of docstrings. The following is a good example:
145+
We require you to put docstrings inside your functions, but please pay attention to the indentation of docstrings. The following is a good example:
150146

151147
```python
152148
def sum_ab(a, b):

0 commit comments

Comments
 (0)