1 | /* $Id: ValidationKitCodingGuidelines.cpp 93115 2022-01-01 11:31:46Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VirtualBox Validation Kit - Coding Guidelines.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2010-2022 Oracle Corporation
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | * available from http://www.virtualbox.org. This file is free software;
|
---|
11 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | * General Public License (GPL) as published by the Free Software
|
---|
13 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
14 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
15 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | *
|
---|
17 | * The contents of this file may alternatively be used under the terms
|
---|
18 | * of the Common Development and Distribution License Version 1.0
|
---|
19 | * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
|
---|
20 | * VirtualBox OSE distribution, in which case the provisions of the
|
---|
21 | * CDDL are applicable instead of those of the GPL.
|
---|
22 | *
|
---|
23 | * You may elect to license modified versions of this file under the
|
---|
24 | * terms and conditions of either the GPL or the CDDL or both.
|
---|
25 | */
|
---|
26 |
|
---|
27 |
|
---|
28 | /** @page pg_validationkit_guideline Validation Kit Coding Guidelines
|
---|
29 | *
|
---|
30 | * The guidelines extends the VBox coding guidelines (@ref pg_vbox_guideline)
|
---|
31 | * and currently only defines python prefixes and linting.
|
---|
32 | *
|
---|
33 | *
|
---|
34 | * @section sec_validationkit_guideline_python Python
|
---|
35 | *
|
---|
36 | * Python is a typeless language so using prefixes to indicate the intended
|
---|
37 | * type of a variable or attribute can be very helpful.
|
---|
38 | *
|
---|
39 | * Type prefixes:
|
---|
40 | * - 'b' for byte (octect).
|
---|
41 | * - 'ch' for a single character.
|
---|
42 | * - 'f' for boolean and flags.
|
---|
43 | * - 'fn' for function or method references.
|
---|
44 | * - 'fp' for floating point values.
|
---|
45 | * - 'i' for integers.
|
---|
46 | * - 'l' for long integers.
|
---|
47 | * - 'o' for objects, structures and anything with attributes that doesn't
|
---|
48 | * match any of the other type prefixes.
|
---|
49 | * - 'r' for a range or xrange.
|
---|
50 | * - 's' for a string (can be unicode).
|
---|
51 | * - 'su' for a unicode string when the distinction is important.
|
---|
52 | *
|
---|
53 | * Collection qualifiers:
|
---|
54 | * - 'a' for a list or an array.
|
---|
55 | * - 'd' for a dictionary.
|
---|
56 | * - 'h' for a set (hashed).
|
---|
57 | * - 't' for a tuple.
|
---|
58 | *
|
---|
59 | * Other qualifiers:
|
---|
60 | * - 'c' for a count. Implies integer or long integer type. Higest
|
---|
61 | * priority.
|
---|
62 | * - 'sec' for a second value. Implies long integer type.
|
---|
63 | * - 'ms' for a millisecond value. Implies long integer type.
|
---|
64 | * - 'us' for a microsecond value. Implies long integer type.
|
---|
65 | * - 'ns' for a nanosecond value. Implies long integer type.
|
---|
66 | *
|
---|
67 | * The 'ms', 'us', 'ns' and 'se' qualifiers can be capitalized when prefixed by
|
---|
68 | * 'c', e.g. cMsElapsed. While this technically means they are no longer a
|
---|
69 | * prefix, it's easier to read and everyone understands what it means.
|
---|
70 | *
|
---|
71 | * The type collection qualifiers comes first, then the other qualifiers and
|
---|
72 | * finally the type qualifier.
|
---|
73 | *
|
---|
74 | * Python statements are terminated by semicolons (';') as a convention.
|
---|
75 | *
|
---|
76 | */
|
---|
77 |
|
---|