diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 627e6e2..7f70a1b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -3,10 +3,10 @@ The following is a set of guidelines for contributing to PISA. ## Code Style Guidelines -We use [black](https://github.com/psf/black) as our base code formatter. Before submitting a PR make sure you have properly formatted your code by running: +We use [black](https://github.com/psf/black) as our base code formatter with a line length of 12 chars. Before submitting a PR make sure you have properly formatted your code by running: -``` -black {source_file_or_directory} +```bash +black --line-length=120 {source_file_or_directory} ``` On top of that, there are a few rules to also have in mind. @@ -30,6 +30,23 @@ else: missed_confirmations[tx] = 1 ``` +An exception to the rule are nested `if` statements that placed right after each other and `if` statements with a single line of code. + +```python +for opt, arg in opts: + if opt in ["-s", "server"]: + if arg: + pisa_api_server = arg +``` + +```python +if rcode == 0: + rcode, message = self.check_start_time(start_time, block_height) +if rcode == 0: + rcode, message = self.check_end_time(end_time, start_time, block_height) +``` + + ## Code Documentation Code should be, at least, documented using docstrings. We use the [Sphinx Google Style](https://www.sphinx-doc.org/en/master/usage/extensions/example_google.html#example-google) for documenting functions.