-
Notifications
You must be signed in to change notification settings - Fork 45
Home
Naveen Kumar Sangi edited this page Dec 19, 2016
·
4 revisions
Welcome to the UIP wiki!
Run
coala
over your code. Write unit tests for all your implementations. Then runpytest
over your code. Be sure to check that you have 100% code coverage too. This could be checked bypytest --cov
. Do not write your own configuration forpytest
withpytest.ini
orsetup.cfg
.
We are PEP8 Compliant.
Imports:
- Avoid module name collisions. Never use relative names in imports.
- Each import should be on a separate line.
- Even if the module is in same package, use full package name. This prevents importing same package twice.
- Import each module using the full pathname location of the package.
- We use camel casing while writing new packages.
- Modulate your code as much as possible.
Exceptions:
- Use them wisely.
- Never use catch all or catch with
Exception
orStandardError
. We need to have knowledge upon the specific type ofException
handled.
Variables:
- Use snake_casing for variable names.
- Avoid Global variables as much as possible.
Classes:
- Use Title Case for class names.
- Explicit inherit for
object
is not preferred.
General:
- Avoid over complexities in lines of code.
- Reduce cyclomatic complexity.
- Avoid using
True
andFalse
explicitly. Use implicitFalse
as much as possible. - A very strict not to semicolons ;.
- Also, the use of
Shebang #!
is not preferable. - One statement per line.
- Use
%
for string formatting. Rather than concatenation with+
. - Maximum line length is 80 characters.
- Whitespaces are used as per PEP8.
- Indent your code blocks with
4
spaces.
Docstrings & Comments: (We follow pydocstyle
)
- Docstrings are enclosed with Triple quotes(""") only.
- Indent with one level for docstrings.
- Use comments on a required scale. Remember that writing readable code is important.
moduleName, packageName, ClassName, method_name, ExceptionName, function_name, GLOBAL_CONSTANT_NAME, global_var_name, instance_var_name, function_parameter_name, local_var_name.