Update 'PYGUIDE.md'

This commit is contained in:
Guille 2020-06-09 12:11:57 -04:00
parent 84ea64d672
commit 95e3ec7060

View File

@ -1,5 +1,5 @@
# Cerc Python Style Guide
## What's coding style and why it matters
## What's coding style and why it matters.
Coding style is just how the code looks, it's incredibly personal, and everyone has their style.
@ -11,9 +11,9 @@ At CERC, we are following the [PEP8](https://www.python.org/dev/peps/pep-0008/)
We use [PyCharm](https://www.jetbrains.com/pycharm/) as an integrated development environment and follow the tool's overall advice but the space indentation, which we set to two spaces instead of default four spaces.
For code analysis, we enforce the usage of [pylint](https://www.pylint.org/) with our own [custom style definition](pylintrc)
For code analysis, we enforce the usage of [pylint](https://www.pylint.org/) with our own [custom style definition](pylintrc).
## Naming convention
## Naming convention.
* Name your folders and files in lowercase.
* Your class names must start in capital letters and follow the python CapWords pattern.
@ -23,9 +23,9 @@ For code analysis, we enforce the usage of [pylint](https://www.pylint.org/) wit
* Avoid the usage of "get_" and "set_" methods whenever possible, by using @property and @variable.setter decorators instead.
* "Private" methods, variables and properties start with _ (underscore)
## Imports
## Imports.
Place your imports at the top of the file, after the license and contact information
comment
comment.
```python
"""
@ -40,7 +40,7 @@ import sys
Ensure that your imports are used and remove any unused.
## Object attributes and methods
## Object attributes and methods.
Use properties whenever possible and encapsulate the access to all the calculated object attributes into properties, as shown in the following example.
@ -55,7 +55,7 @@ Use properties whenever possible and encapsulate the access to all the calculate
```
or like in the following example for read and write properties
And like in the following example for read and write properties.
```python
@ -69,7 +69,7 @@ or like in the following example for read and write properties
```
If your method or attribute returns a complex object use type hints as in this example
If your method or attribute returns a complex object use type hints as in this example.
```python
@ -95,11 +95,11 @@ Always access your variable through the method and avoid to access directly.
```
### Coments
### Coments.
#### code documentation
#### Code documentation.
all public classes, properties, and methods must have code comments
All public classes, properties, and methods must have code comments.
```python
@ -141,7 +141,7 @@ Attributes with known units should be explicit in method's comment.
return self._distance
```
#### To do's
#### To do's.
Pending to implement operations should be indicated with ToDo comments to highlight the missing functionality.