readability-cli 0.4.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,356 @@
1
+ xml-stylesheet type="text/xsl" href="styleguide.xsl"?
2
+
3
+
4
+ # Google Vimscript Style Guide
5
+
6
+ Revision 1.1
7
+
8
+ Nate Soares
9
+ Artemis Sparks
10
+ David Barnett
11
+
12
+
13
+
14
+ ## Background
15
+
16
+ This is a casual version of the vimscript style guide, because
17
+ vimscript is a casual language. When submitting vim plugin code, you
18
+ must adhere to these rules. For clarifications, justifications, and
19
+ explanations about the finer points of vimscript, please refer to the
20
+ [heavy guide](vimscriptfull.xml).
21
+
22
+
23
+
24
+ ## Portability
25
+
26
+ It's hard to get vimscript right. Many commands depend upon the user's
27
+ settings. By following these guidelines, you can hope to make your
28
+ scripts portable.
29
+
30
+ ### Strings
31
+
32
+ **Prefer single quoted strings**
33
+
34
+ Double quoted strings are semantically different in vimscript, and
35
+ you probably don't want them (they break regexes).
36
+
37
+ Use double quoted strings when you need an escape sequence (such as
38
+ `"\n"`) or if you know it doesn't matter and you need to
39
+ embed single quotes.
40
+
41
+
42
+
43
+ ### Matching Strings
44
+
45
+ **Use the `=~#` or `=~?` operator families over the
46
+ `=~` family.**
47
+
48
+ The matching behavior depends upon the user's ignorecase and smartcase
49
+ settings and on whether you compare them with the `=~`,
50
+ `=~#`, or `=~?` family of operators. Use the
51
+ `=~#` and `=~?` operator families explicitly
52
+ when comparing strings unless you explicitly need to honor the user's
53
+ case sensitivity settings.
54
+
55
+
56
+
57
+ ### Regular Expressions
58
+
59
+ **Prefix all regexes with `\m\C`.**
60
+
61
+ In addition to the case sensitivity settings, regex behavior depends
62
+ upon the user's nomagic setting. To make regexes act like nomagic and
63
+ noignorecase are set, prepend all regexes with `\m\C`.
64
+
65
+ You are welcome to use other magic levels (`\v`) and case
66
+ sensitivities (`\c`) so long as they are intentional and
67
+ explicit.
68
+
69
+
70
+
71
+ ### Dangerous commands
72
+
73
+ **Avoid commands with unintended side effects.**
74
+
75
+ Avoid using `:s[ubstitute]` as it moves the cursor and
76
+ prints error messages. Prefer functions (such as
77
+ `search()`) better suited to scripts.
78
+
79
+ For many vim commands, functions exist that do the same thing with
80
+ fewer side effects. See `:help functions()` for a list of
81
+ built-in functions.
82
+
83
+
84
+
85
+ ### Fragile commands
86
+
87
+ **Avoid commands that rely on user settings.**
88
+
89
+ Always use `normal!` instead of `normal`. The
90
+ latter depends upon the user's key mappings and could do anything.
91
+
92
+ Avoid `:s[ubstitute]`, as its behavior depends upon a
93
+ number of local settings.
94
+
95
+ The same applies to other commands not listed here.
96
+
97
+
98
+
99
+ ### Catching Exceptions
100
+
101
+ **Match error codes, not error text.**
102
+
103
+ Error text may be locale dependent.
104
+
105
+
106
+
107
+ ## General Guidelines
108
+
109
+ ### Messaging
110
+
111
+ **Message the user infrequently.**
112
+
113
+ Loud scripts are annoying. Message the user only when:
114
+
115
+ * A long-running process has kicked off.
116
+ * An error has occurred.
117
+
118
+
119
+
120
+ ### Type checking
121
+
122
+ **Use strict and explicit checks where possible.**
123
+
124
+ Vimscript has unsafe, unintuitive behavior when dealing with some
125
+ types. For instance, `0 == 'foo'` evaluates to true.
126
+
127
+ Use strict comparison operators where possible. When comparing against
128
+ a string literal, use the `is#` operator. Otherwise, prefer
129
+ `maktaba#value#IsEqual` or check `type()`
130
+ explicitly.
131
+
132
+ Check variable types explicitly before using them. Use functions from
133
+ `maktaba#ensure`, or check `maktaba#value` or
134
+ `type()` and throw your own errors.
135
+
136
+ Use `:unlet` for variables that may change types,
137
+ particularly those assigned inside loops.
138
+
139
+
140
+
141
+ ### Python
142
+
143
+ **Use sparingly.**
144
+
145
+ Use python only when it provides critical functionality, for example
146
+ when writing threaded code.
147
+
148
+
149
+
150
+ ### Other Languages
151
+
152
+ **Use vimscript instead.**
153
+
154
+ Avoid using other scripting languages such as ruby and lua. We can
155
+ not guarantee that the end user's vim has been compiled with support
156
+ for non-vimscript languages.
157
+
158
+
159
+
160
+ ### Boilerplate
161
+
162
+ **Use [maktaba](https://github.com/google/maktaba).**
163
+
164
+ maktaba removes boilerplate, including:
165
+
166
+ * Plugin creation
167
+ * Error handling
168
+ * Dependency checking
169
+
170
+
171
+
172
+ ### Plugin layout
173
+
174
+ **Organize functionality into modular plugins**
175
+
176
+ Group your functionality as a plugin, unified in one directory (or
177
+ code repository) which shares your plugin's name (with a "vim-" prefix
178
+ or ".vim" suffix if desired). It should be split into plugin/,
179
+ autoload/, etc. subdirectories as necessary, and it should declare
180
+ metadata in the addon-info.json format (see the
181
+ [VAM documentation](https://github.com/MarcWeber/vim-addon-manager/blob/master/doc/vim-addon-manager-additional-documentation.txt) for details).
182
+
183
+
184
+
185
+ ### Functions
186
+
187
+ **In the autoload/ directory, defined with `[!]` and
188
+ `[abort]`.**
189
+
190
+ Autoloading allows functions to be loaded on demand, which makes
191
+ startuptime faster and enforces function namespacing.
192
+
193
+ Script-local functions are welcome, but should also live in autoload/
194
+ and be called by autoloaded functions.
195
+
196
+ Non-library plugins should expose commands instead of functions.
197
+ Command logic should be extracted into functions and autoloaded.
198
+
199
+ `[!]` allows developers to reload their functions
200
+ without complaint.
201
+
202
+ `[abort]` forces the function to halt when it encounters
203
+ an error.
204
+
205
+
206
+
207
+ ### Commands
208
+
209
+ **In the plugin/commands.vim or under the ftplugin/ directory, defined
210
+ without `[!]`.**
211
+
212
+ General commands go in `plugin/commands.vim`.
213
+ Filetype-specific commands go in `ftplugin/`.
214
+
215
+ Excluding `[!]` prevents your plugin from silently
216
+ clobbering existing commands. Command conflicts should be resolved by
217
+ the user.
218
+
219
+
220
+
221
+ ### Autocommands
222
+
223
+ **Place them in plugin/autocmds.vim, within augroups.**
224
+
225
+ Place all autocommands in augroups.
226
+
227
+ The augroup name should be unique. It should either be, or be prefixed
228
+ with, the plugin name.
229
+
230
+ Clear the augroup with `autocmd!` before defining new
231
+ autocommands in the augroup. This makes your plugin re-entrable.
232
+
233
+
234
+
235
+ ### Mappings
236
+
237
+ **Place them in `plugin/mappings.vim`, using
238
+ `maktaba#plugin#MapPrefix` to get a prefix.**
239
+
240
+ All key mappings should be defined in
241
+ `plugin/mappings.vim`.
242
+
243
+ Partial mappings (see :help using-<Plug>.) should be defined in
244
+ `plugin/plugs.vim`.
245
+
246
+
247
+
248
+ ### Settings
249
+
250
+ **Change settings locally**
251
+
252
+ Use `:setlocal` and `&l:` instead of
253
+ `:set` and `&` unless you have explicit
254
+ reason to do otherwise.
255
+
256
+
257
+
258
+ ## Style
259
+
260
+ Follow google style conventions. When in doubt, treat vimscript style
261
+ like python style.
262
+
263
+ ### Whitespace
264
+
265
+ **Similar to python.**
266
+
267
+ * Use two spaces for indents
268
+ * Do not use tabs
269
+ * Use spaces around operators
270
+
271
+ This does not apply to arguments to commands.
272
+
273
+ ```
274
+ let s:variable = "concatenated " . "strings"
275
+ command -range=% MyCommand
276
+ ```
277
+ * Do not introduce trailing whitespace
278
+
279
+ You need not go out of your way to remove it.
280
+
281
+ Trailing whitespace is allowed in mappings which prep commands
282
+ for user input, such as
283
+ "`noremap <leader>gf :grep -f` ".
284
+ * Restrict lines to 80 columns wide
285
+ * Indent continued lines by four spaces
286
+ * Do not align arguments of commands
287
+
288
+ ```
289
+ BAD:
290
+
291
+
292
+ command -bang MyCommand call myplugin#foo()
293
+ command MyCommand2 call myplugin#bar()
294
+ ```
295
+
296
+ ```
297
+ command -bang MyCommand call myplugin#foo()
298
+ command MyCommand2 call myplugin#bar()
299
+ ```
300
+
301
+
302
+ ### Naming
303
+
304
+ **In general, use
305
+ `plugin-names-like-this`,
306
+ `FunctionNamesLikeThis`,
307
+ `CommandNamesLikeThis`,
308
+ `augroup_names_like_this`,
309
+ `variable_names_like_this`.
310
+
311
+ Always prefix variables with their scope.**
312
+
313
+ Keep them short and sweet.
314
+
315
+
316
+
317
+ Prefix script-local functions with `s:`
318
+
319
+ Autoloaded functions may not have a scope prefix.
320
+
321
+ Do not create global functions. Use autoloaded functions
322
+ instead.
323
+
324
+
325
+
326
+ Prefer succinct command names over common command prefixes.
327
+
328
+
329
+
330
+ Augroup names count as variables for naming purposes.
331
+
332
+
333
+
334
+ * Global variables with `g:`
335
+ * Script-local variables with `s:`
336
+ * Function arguments with `a:`
337
+ * Function-local variables with `l:`
338
+ * Vim-predefined variables with `v:`
339
+ * Buffer-local variables with `b:`
340
+
341
+ `g:`, `s:`, and `a:` must always
342
+ be used.
343
+
344
+ `b:` changes the variable semantics; use it when you
345
+ want buffer-local semantics.
346
+
347
+ `l:` and `v:` should be used for consistency,
348
+ future proofing, and to avoid subtle bugs. They are not strictly
349
+ required. Add them in new code but don’t go out of your way to add
350
+ them elsewhere.
351
+
352
+ Revision 1.1
353
+
354
+ Nate Soares
355
+ Artemis Sparks
356
+ David Barnett