Projekt

Obecné

Profil

Policies » Historie » Verze 16

Jan Pašek, 2021-03-03 16:51

1 3 Jan Pašek
h1. Project convention
2 1 Jan Pašek
3
h2. Git
4 6 Jan Pašek
5 13 Jan Pašek
*Commits*
6
7 12 Jan Pašek
Commit message shall have the following format:
8
<pre>
9
#<id> - <short description> <details>
10
</pre>
11
12
* *id* issue ID from the Redmine
13
* *short description* brief description of the change
14
* *details* detailed list of changes (added classes, changed interfaces, ...)
15 13 Jan Pašek
16
Each commit shall have a reasonable size to make the reviews as simple as possible.
17
18
*Branches*
19
20
# For each issue, a new branch shall be created. The branch name shall correlate with the issue name.
21
# When the work on a branch is finished by the *issue owner*, the work is posted for a code review. 
22
# After that, the code can be merged to master by the *reviewer*. 
23
# After the merge, the *reviewer* is responsible for verifying software integrity. 
24 14 Jan Pašek
# _In case the integrity of the software is seriously broken, the task can be returned to the *issue owner*._
25
26
*Code review*
27
28
* Reviewer walks through the code and checks the coding convention, code readability, stability, etc...
29
* Reviewer is responsible for basic functionality testing
30 15 Jan Pašek
* Code review is tracked in GitLab via pull request
31 11 Jan Pašek
32 1 Jan Pašek
h2. RedMine
33 2 Jan Pašek
34 16 Jan Pašek
* Everyone can create an issue
35
* New issues must have the following fields filled in: Type, Title, Description, State = Normal
36
* Optionally
37
38 4 Jan Pašek
h2. Code
39 5 Jan Pašek
40
h3. General
41
42
* Code and all comments shall be written in English
43 9 Jan Pašek
* Code review is done for all code changes
44
* Unit tests are done for all business logic parts 
45 5 Jan Pašek
* Python docstrings (bellow function header) shall be created for all functions describing the purpose, inputs and outputs
46
* Avoid using names that are too general or too wordy. Strike a good balance between the two
47
* When using CamelCase names, capitalize all letters of an abbreviation (e.g. HTTPServer)
48
49
h3. Packages
50
51
* Package names should be all lower case
52
* When multiple words are needed, an underscore should separate them
53
* It is usually preferable to stick to 1-word names
54
55
h3. Modules
56
57
* Module names should be all lower case
58
* When multiple words are needed, an underscore should separate them
59
* It is usually preferable to stick to 1 word names
60
61
h3. Classes
62
63
* Class names should follow the UpperCaseCamelCase convention
64
* Exception classes should end in “Error”
65
66
h3. Global Variables
67
68
* Global variables should be all lowercase
69
* Words in a global variable name should be separated by an underscore
70
71
h3. Instance Variables
72
73
* Instance variable names should be all lower case
74
* Words in an instance variable name should be separated by an underscore
75 10 Jan Pašek
* Non-public instance variables should begin with a double underscore
76
* If a protected attribute is necessary to be used, the variable name shall start with a single underscore
77 5 Jan Pašek
* 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
78
79
h3. Methods
80
81
* Method names should be all lower case
82
* Words in a method name should be separated by an underscore
83
* Non-public method should begin with a single underscore
84
* If a method name needs to be mangled, two underscores may begin its name
85
86
h3. Method Arguments
87
88
* Instance methods should have their first argument named ‘self’.
89
* Class methods should have their first argument named ‘cls’
90
91
h3. Functions
92
93
* Function names should be all lower case
94
* Words in a function name should be separated by an underscore
95
96
h3. Constants
97
98
* Constant names must be fully capitalized
99
* Words in a constant name should be separated by an underscore