~ubuntu-branches/ubuntu/precise/live-manual/precise

« back to all changes in this revision

Viewing changes to manual/fr/project_coding-style.ssi

  • Committer: Package Import Robot
  • Author(s): Daniel Baumann, chals, Ben Armstrong, skizzhg
  • Date: 2011-09-30 14:53:41 UTC
  • mfrom: (1.1.26 upstream)
  • Revision ID: package-import@ubuntu.com-20110930145341-8s03pt50brp1s8fw
Tags: 1:3.0~a8-1
[ chals ]
* Adding information about default username and password.
* Updating Spanish translation.
* Updating French translation.
* Fixing code string in user_customization-runtime.
* Translating newly created link into French and Spanish.

[ Ben Armstrong ]
* Eliminate/reduce use of word 'official', which is confusing
  especially as we move into supporting derivatives.

[ chals ]
* Updating Spanish translation.
* Updating French translation.
* Translating user_customization-binary.ssi.po into French.
* Deleting tag from project_bugs.ssi.po Spanish translation.
* Translating the title of the manual into French and thus fixing
  'fuzzy'.

[ skizzhg ]
* Updating about_project, user_customization-contents,
  user_customization-runtime. Italian translation.

[ chals ]
* Translating user_customization-installer.ssi.po into French.
* Translating project_bugs.ssi.po into French.
* Translating project_coding-style.ssi.po into French.
* Fixing broken link in user_customization-installer French.
* Translating project_procedures.ssi.po into French.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
B~ Coding Style
2
 
 
3
 
1~coding-style Coding Style
4
 
 
5
 
This chapter documents the coding style used in live-boot and others.
6
 
 
7
 
2~ Compatibility
8
 
 
9
 
_* Don't use syntax or semantics that are unique to the Bash shell. For
10
 
example, the use of array constructs.
11
 
 
12
 
_* Only use the POSIX subset - for example, use $(foo) over `foo`.
13
 
 
14
 
_* You can check your scripts with 'sh -n' and 'checkbashisms'.
15
 
 
16
 
2~ Indenting
17
 
 
18
 
_* Always use tabs over spaces.
19
 
 
20
 
2~ Wrapping
21
 
 
22
 
_* Generally, lines are 80 chars at maximum.
23
 
 
24
 
_* Use the "Linux style" of line breaks:
25
 
 
26
 
Bad:
 
1
B~ Style du code
 
2
 
 
3
1~coding-style Style du code
 
4
 
 
5
Ce chapitre documente le style du code utilisé en live-boot et autres.
 
6
 
 
7
2~ Compatibilité
 
8
 
 
9
_* Ne pas utiliser la syntaxe ou la sémantique qui sont uniques à le shell
 
10
Bash. Par exemple, l'utilisation de structures de tableau.
 
11
 
 
12
_* N'utiliser que le sous-ensemble POSIX - par exemple, utiliser $(foo) au
 
13
lieu de `foo`.
 
14
 
 
15
_* Vous pouvez vérifier vos scripts avec 'sh -n' et 'checkbashisms'.
 
16
 
 
17
2~ Indentation
 
18
 
 
19
_* Toujours utiliser des tabulations en lieu des espaces.
 
20
 
 
21
2~ Adaptateur
 
22
 
 
23
_* Généralement, les lignes sont de 80 caractères au maximum.
 
24
 
 
25
_* Utilisez le «style Linux» des sauts de ligne:
 
26
 
 
27
Mal:
27
28
 
28
29
code{
29
30
 
33
34
 
34
35
}code
35
36
 
36
 
Good:
 
37
Bien:
37
38
 
38
39
code{
39
40
 
44
45
 
45
46
}code
46
47
 
47
 
_* The same holds for functions:
 
48
_* La même chose vaut pour les fonctions:
48
49
 
49
 
Bad:
 
50
Mal:
50
51
 
51
52
code{
52
53
 
56
57
 
57
58
}code
58
59
 
59
 
Good:
 
60
Bien:
60
61
 
61
62
code{
62
63
 
69
70
 
70
71
2~ Variables
71
72
 
72
 
_* Variables are always in capital letters.
73
 
 
74
 
_* Variables that used in #{lb config}# always start with #{LB_}# prefix.
75
 
 
76
 
_* Internal temporary variables in live-build should start with the
77
 
#{\_LB_}# prefix.
78
 
 
79
 
_* Local variables start with live-build #{\_\_LB_}# prefix.
80
 
 
81
 
_* Variables in connection to a boot parameter in live-config start with
82
 
#{LIVE_}#.
83
 
 
84
 
_* All other variables in live-config start with #{_}# prefix.
85
 
 
86
 
_* Use braces around variables; e.g. write #{${FOO}}# instead of #{$FOO}#.
87
 
 
88
 
_* Always protect variables with quotes to respect potential whitespaces:
89
 
write #{"${FOO}"}# not #{${FOO}}#.
90
 
 
91
 
_* For consistency reasons, always use quotes when assigning values to
92
 
variables:
93
 
 
94
 
Bad:
 
73
_* Les variables sont toujours en lettres majuscules.
 
74
 
 
75
_* Les variables utilisées dans #{lb config}# commencent toujours par le
 
76
préfixe #{LB_}#.
 
77
 
 
78
_* Les variables temporaires internes en live-build devraient commencer avec
 
79
le préfixe #{\_LB_}#.
 
80
 
 
81
_* Les variables locales commencent avec le préfixe #{\_\_LB_}#.
 
82
 
 
83
_* Les variables en relation avec un paramètre de démarrage en live-config
 
84
commencent par #{LIVE_}#.
 
85
 
 
86
_* Toutes les autres variables en live-config commencent par le préfixe
 
87
#{_}#.
 
88
 
 
89
_* Utilisez des accolades autour des variables; par exemple écrire
 
90
#{${FOO}}# au lieu de #{$FOO}#.
 
91
 
 
92
_* Toujours protéger les variables avec guillemets pour respecter les
 
93
espaces potentiels: écrire #{"${FOO}"}# en lieu de #{${FOO}}#.
 
94
 
 
95
_* Pour des raisons de cohérence, toujours utiliser les guillemets lors de
 
96
l'attribution des valeurs aux variables:
 
97
 
 
98
Mal:
95
99
 
96
100
code{
97
101
 
99
103
 
100
104
}code
101
105
 
102
 
Good:
 
106
Bien:
103
107
 
104
108
code{
105
109
 
107
111
 
108
112
}code
109
113
 
110
 
_* If multiple variables are used, quote the full expression:
 
114
_* Si plusieurs variables sont utilisées, utiliser les guillemets pour
 
115
l'expression complète:
111
116
 
112
 
Bad:
 
117
Mal:
113
118
 
114
119
code{
115
120
 
120
125
 
121
126
}code
122
127
 
123
 
Good:
 
128
Bien:
124
129
 
125
130
code{
126
131
 
131
136
 
132
137
}code
133
138
 
134
 
2~ Miscellaneous
135
 
 
136
 
_* Use "#{|}#" (without the surround quotes) as a seperator in calls to sed,
137
 
e.g. "#{sed -e 's|foo|bar|'}#" (without "").
138
 
 
139
 
_* Don't use the #{test}# command for comparisons or tests, use "#{[}#"
140
 
"#{]}#" (without ""); e.g. "#{if [ -x /bin/foo ]; ...}#" and not "#{if test
141
 
-x /bin/foo; ...}#".
142
 
 
143
 
_* Use #{case}# wherever possible over #{test}#, as it's easier to read and
144
 
faster in execution.
 
139
2~ Autres
 
140
 
 
141
_* Utilisez "#{|}#" (sans les guillemets autour) comme un séparateur dans
 
142
les appels à sed, par exemple "#{sed -e 's|foo|bar|'}#" (sans" ").
 
143
 
 
144
_* Ne pas utiliser la commande #{test}# pour des comparaisons ou des tests,
 
145
utilisez "#{[}#" "#{]}#" (sans ""); par exemple "#{if [ -x /bin/foo ];
 
146
...}#" et non pas "#{if test -x /bin/foo; ...}#".
 
147
 
 
148
_* Utiliser #{case}# dans la mesure du possible en lieu de #{test}#, parce
 
149
qu'il est plus facile à lire et plus rapide dans l'exécution.