|
| 1 | +# Code Style |
| 2 | +The following is a general guide on how to style your work so that the project |
| 3 | +remains consistent throughout all files. Please read this document in it's entirety |
| 4 | +and refer to it throughout the development of your contribution. |
| 5 | + |
| 6 | +1. [General Guidelines](#general-guidelines) |
| 7 | +2. [Commit Message Guidelines](#commit-message-guidelines) |
| 8 | +3. [Markdown Guidelines](#markdown-guidelines) |
| 9 | + |
| 10 | + |
| 11 | + |
| 12 | +## General Guidelines |
| 13 | +Listed is a example class used demonstrate general rules you should follow throughout the development of your contribution. |
| 14 | + |
| 15 | +- Docstrings are to follow reST (reStructuredText Docstring Format) as specified in [PEP 287](https://peps.python.org/pep-0287/) |
| 16 | +- Private attributes are to be prefixed with an underscore |
| 17 | +- Use of [typing](https://docs.python.org/3/library/typing.html) type hints |
| 18 | +- All files are to use 2 space indenting |
| 19 | + |
| 20 | +```python |
| 21 | +class ExampleClass: |
| 22 | + """ |
| 23 | + ExampleClass |
| 24 | + ------------ |
| 25 | + Example class for CODESTYLE.md |
| 26 | + """ |
| 27 | + # ^^^ reST Docstring Format |
| 28 | + |
| 29 | + _private_attribute : int # private attributes begin with a lowercase |
| 30 | + public_attribute : int # type hint for integer is defined here |
| 31 | + |
| 32 | + def __init__( |
| 33 | + self, |
| 34 | + public_attribute: int # type hint for parameters |
| 35 | + ) -> None: # the expected return value of method |
| 36 | + """ |
| 37 | + Initializes a ExampleClass |
| 38 | +
|
| 39 | + Parameters |
| 40 | + ---------- |
| 41 | + :param public_attribute: example attribute |
| 42 | + """ |
| 43 | + self.public_attribute = public_attribute |
| 44 | + self.private_attribute = square(public_attribute) |
| 45 | + |
| 46 | + def square(self, value: int) -> int: |
| 47 | + """ |
| 48 | + Example method that square roots a value |
| 49 | +
|
| 50 | + Parameters |
| 51 | + ---------- |
| 52 | + :param value: value that you want squared |
| 53 | + """ |
| 54 | + return value**2 |
| 55 | +``` |
| 56 | + |
| 57 | + |
| 58 | + |
| 59 | +## Commit Message Guidelines |
| 60 | +When committing, commit messages are prefixed with a `+` or `-`. Depending on the type of change made |
| 61 | +influences which prefix is used. |
| 62 | + |
| 63 | + - `+` when something is added. |
| 64 | + - `-` when something is removed. |
| 65 | + - none: when neither is applicable, like merge commits. |
| 66 | + |
| 67 | +Commit messages are also to begin with an uppercase character. Below list some example commit messages. |
| 68 | + |
| 69 | +``` |
| 70 | +git commit -m "+ Added README.md" |
| 71 | +git commit -m "- Removed README.md" |
| 72 | +git commit -m "Moved README.md" |
| 73 | +``` |
| 74 | + |
| 75 | + |
| 76 | + |
| 77 | +## Markdown Guidelines |
| 78 | +Currently, documentation for this project resides in markdown files. |
| 79 | + - Headings are to be separated with 3 lines |
| 80 | + - Use of HTML comments is appreciated |
| 81 | + - Use of HTML is permitted |
| 82 | + - [reference style links](https://www.markdownguide.org/basic-syntax/#reference-style-links) are not required by are appreciated |
| 83 | + - Exceedingly long lines are to be broken |
| 84 | + - The indents are to be two spaces |
| 85 | + |
| 86 | +```markdown |
| 87 | +<!--example markdown document--> |
| 88 | +# Section |
| 89 | +Lorem ipsum dolor sit amet, consectetur adipiscing elit, |
| 90 | +sed do eiusmod tempor incididunt ut labore et dolore |
| 91 | +magna aliqua. Ut enim ad minim veniam, quis nostrud |
| 92 | +exercitation ullamco laboris nisi ut aliquip ex ea |
| 93 | +commodo consequat. Duis aute irure dolor in |
| 94 | +reprehenderit in voluptate velit esse cillum dolore eu |
| 95 | +fugiat nulla pariatur. Excepteur sint occaecat cupidatat |
| 96 | +non proident, sunt in culpa qui officia deserunt mollit |
| 97 | +anim id est laborum. found [Lorem Ipsum Generator] |
| 98 | + |
| 99 | + |
| 100 | + |
| 101 | +# Section 2 |
| 102 | +<ul> |
| 103 | + <li> Apple |
| 104 | + <li> Orange |
| 105 | + <li> Pineapple |
| 106 | +</ul> |
| 107 | + |
| 108 | + |
| 109 | + |
| 110 | +[Lorem Ipsum Generator]: https://loremipsum.io/generator/ |
| 111 | +``` |
0 commit comments