Changeset View
Changeset View
Standalone View
Standalone View
HACKING
Show First 20 Lines • Show All 126 Lines • ▼ Show 20 Line(s) | |||||
127 | 127 | | |||
128 | Boolean operators | 128 | Boolean operators | ||
129 | 129 | | |||
130 | Use the standard !, !=, ==, && etc style, not the "not", "and" etc. style. Keep krita code | 130 | Use the standard !, !=, ==, && etc style, not the "not", "and" etc. style. Keep krita code | ||
131 | using one, easily recognizable, C++ style. | 131 | using one, easily recognizable, C++ style. | ||
132 | 132 | | |||
133 | 133 | | |||
134 | Boudewijn Rempt | 134 | Boudewijn Rempt | ||
135 | | ||||
136 | | ||||
137 | With Krita now supporting Python scripting, we need guidelines for these as well. | ||||
138 | These guidelines are preliminary and may be further refined in the future. | ||||
139 | | ||||
140 | To keep it simple, we have chosen to follow the style guide suggested by Python: PEP8. | ||||
141 | | ||||
142 | All rules should be followed, except the max limit of 79 characters per line. As this | ||||
143 | can reduce readability in some cases, this rule is optional. | ||||
144 | | ||||
145 | The full PEP8 specification is available here: https://www.python.org/dev/peps/pep-0008/ | ||||
146 | | ||||
147 | To check compliance you can run pep8.py against the code. | ||||
148 | You can also use autopep8.py to automatically fix detected compliance issues. | ||||
149 | | ||||
150 | pep8.py can be downloaded via Python's package manager (pip) [https://pypi.python.org/pypi/pep8], | ||||
151 | or your distribution's package manager. | ||||
152 | autopep8.py can also be downloaded via Python's package manager [https://pypi.python.org/pypi/autopep8], | ||||
153 | or your distribution's package manager. | ||||
154 | | ||||
155 | Both of these scripts come bundled with the PyDev plugin, which is available for Eclipse and other IDEs. | ||||
156 | The PyDev integration can be configured to visually highlight portions of the code which is not in compliance, | ||||
157 | as well as run autopep8 via shortcuts. | ||||
158 | | ||||
159 | pep8.py and autopep8.py can suppress select rules via the "--ignore" command line argument. | ||||
160 | To ignore the 79 charachers per line rule, pep8.py can be called like this: | ||||
161 | | ||||
162 | pep8.py --ignore=E501 | ||||
163 | | ||||
164 | You can read more about the error codes and what they mean here: | ||||
165 | http://pep8.readthedocs.io/en/release-1.7.x/intro.html#error-codes |