Grammalecte  Check-in [8d356dc23c]

Overview
Comment:[build] coding style
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | build
Files: files | file ages | folders
SHA3-256: 8d356dc23cfba65e5abf5bc50a1131737c4396dd12c979534ad6c3dc9973fb36
User & Date: olr on 2025-09-11 11:23:41
Other Links: manifest | tags
Context
2025-09-11
13:42
[fr] faux positifs Leaf check-in: 41ad053ed0 user: olr tags: trunk, fr
11:23
[build] coding style check-in: 8d356dc23c user: olr tags: trunk, build
10:31
[lo] LexiconEditor: fix close/reopen bug check-in: fa81cd2276 user: olr tags: trunk, lo
Changes

Added coding_style.md version [322335bf23].





























































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
# Coding style

## History

Grammalecte is a fork of Lightproof which used a lot of different ways to name variables.
An attempt to unify them has been made. Though not perfect, we try to follow the same coding style in all files of this project.

As a software written in Python and JavaScript and mainly provided as extensions for other softwares, it’s not always possible to follow the same principles.


## Variable names

### Style

* Local variable: lowerCamelCase (even in Python).
* function name: lowerCamelCase (even in Python) or lowercase.
* attributes: lowerCamelCase (even in Python) or lowercase.
* class name: UpperCamelCase
* Module name: lowercase_separated_by_underscores

One-letter names should be avoided, though tolerated for specific usages, as long as the variable is used only for few lines.


### Hungarian notation

As much as possible, we use the Hungarian notation for variable names, meaning we add one (or several) lowercase letters as a prefix to each variables. These prefixes are mainly a way to remember the type of the variables.

```
b:      boolean

i:      integer (mainly for index)
j:      integer (mainly for index)
k:      integer (mainly for index)
n:      integer (count)

f:      float

c:      string (one char)
s:      string
sf:     string (filename, no path)
sp:     string (path, folder only)
spf:    string (path, folder and filename)

by:     binary string or array

z:      compiled regular expression (with re.compile() or new RegExp() or /.../)
m:      match object

d:      dictionary (or Map in JavaScript)

l:      list or array
a:      list or array or set
t:      tuple

o:      object defined by our project
x:      object defined by 3rd part software (library, DOM element, etc.)

e:      event or error object
h:      file handler
```