Policies » Historie » Verze 8
Jan Pašek, 2021-03-03 13:04
1 | 3 | Jan Pašek | h1. Project convention |
---|---|---|---|
2 | 1 | Jan Pašek | |
3 | h2. Git |
||
4 | 6 | Jan Pašek | |
5 | 1 | Jan Pašek | h2. RedMine |
6 | 2 | Jan Pašek | |
7 | 4 | Jan Pašek | h2. Code |
8 | 5 | Jan Pašek | |
9 | h3. General |
||
10 | |||
11 | * Code and all comments shall be written in English |
||
12 | * Python docstrings (bellow function header) shall be created for all functions describing the purpose, inputs and outputs |
||
13 | * Avoid using names that are too general or too wordy. Strike a good balance between the two |
||
14 | * When using CamelCase names, capitalize all letters of an abbreviation (e.g. HTTPServer) |
||
15 | |||
16 | h3. Packages |
||
17 | |||
18 | * Package names should be all lower case |
||
19 | * When multiple words are needed, an underscore should separate them |
||
20 | * It is usually preferable to stick to 1-word names |
||
21 | |||
22 | h3. Modules |
||
23 | |||
24 | * Module names should be all lower case |
||
25 | * When multiple words are needed, an underscore should separate them |
||
26 | * It is usually preferable to stick to 1 word names |
||
27 | |||
28 | h3. Classes |
||
29 | |||
30 | * Class names should follow the UpperCaseCamelCase convention |
||
31 | * Exception classes should end in “Error” |
||
32 | |||
33 | h3. Global Variables |
||
34 | |||
35 | * Global variables should be all lowercase |
||
36 | * Words in a global variable name should be separated by an underscore |
||
37 | |||
38 | h3. Instance Variables |
||
39 | |||
40 | * Instance variable names should be all lower case |
||
41 | * Words in an instance variable name should be separated by an underscore |
||
42 | * Non-public instance variables should begin with a single underscore |
||
43 | * If an instance name needs to be mangled (interpreter rewrites the name in order to avoid name conflicts in subclasses), two underscores may begin its name |
||
44 | |||
45 | h3. Methods |
||
46 | |||
47 | * Method names should be all lower case |
||
48 | * Words in a method name should be separated by an underscore |
||
49 | * Non-public method should begin with a single underscore |
||
50 | * If a method name needs to be mangled, two underscores may begin its name |
||
51 | |||
52 | h3. Method Arguments |
||
53 | |||
54 | * Instance methods should have their first argument named ‘self’. |
||
55 | * Class methods should have their first argument named ‘cls’ |
||
56 | |||
57 | h3. Functions |
||
58 | |||
59 | * Function names should be all lower case |
||
60 | * Words in a function name should be separated by an underscore |
||
61 | |||
62 | h3. Constants |
||
63 | |||
64 | * Constant names must be fully capitalized |
||
65 | * Words in a constant name should be separated by an underscore |