sangfor code specification

table of Contents

The following is a partial extract:

Promote


Submitting code in sangfor is an experience of being continuously dismissed, and then constantly modified and submitted.

Sangfor's python code specification strictly follows the pep8 code specification

The following is a partial extract:

The variable file name is named, the lowercase word is connected with the underscore between the word, the constant should be all uppercase, and the class name is big camel case.

The naming of each file, the naming of each class, the naming of each function, the naming of each variable must be named as much as possible, and each function must follow the format and write comments

The blank line of the code format must be very standardized. The last line of code must have a blank line and this blank line must not contain spaces. The comments between the codes must be a separate line and cannot be placed behind the peer code.

Note: If there is a typo and the description is not clear enough, you must change the commit and go up for review. No, return and change again. Commit. If the review fails, continue to return and continue to change. If the review is still unsatisfactory, continue to return

The description of commit on git also needs to be added very standardized. It must be added with [Add]. Modifications must start with [Fix]. Even if there is one less space after add, you will be required to commit again.

The length of each line of code cannot exceed 100 

Try except must specify the type of exception captured

Each if must have a corresponding else to prevent the situation from being overwritten

The file name created in the use case should use uuid to create a 32-bit random code to prevent file name conflicts

Regular expressions can know what to match by looking at the expression 

Returning the data used for assertion requires the code that is comment res [0] so that it needs to be changed to res["name"]

That is to say, the leader review code will definitely point out for you to modify 

If the reviewer feels that they don't understand or have any doubts, they need to add comments or modify the wording.

 

Promote

As long as they are not standardized, they must be modified. For newcomers like me, it is a very good growth platform. From the beginning, they have developed a good habit of coding standards.

The biggest feeling is that the programs written by myself are more and more in line with the PEP8 standard.

 

Guess you like

Origin blog.csdn.net/chuancheng_zeng/article/details/115202628