Skip to content

Commit 8a125bf

Browse files
committed
Spaces around assignments - addressed #1
1 parent afab795 commit 8a125bf

File tree

1 file changed

+20
-12
lines changed

1 file changed

+20
-12
lines changed

README.md

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,24 @@
11
# cos-guidelines
2-
There is mandatory and recommended parts. _Recommended part to being formed at the moment_
2+
This is the first approximation of COS guidelines we use for github.com/intersystems-ru projects. There are mandatory and recommended parts.
33

4-
But here is general advice: use common sense and try to *be consistent* wherever you write code.
4+
We do not plan to be too much restrictive, but rather flexible enough to allow many reasonable styles.
5+
Here is the general advice: use common sense and try to *be consistent* wherever you write code.
56
If there is some style already established in the class or utility being modified then we recommend
67
to continue use that same style, than introducing yet another one, which may be more recommended
7-
but will produce inconsistent results.
8+
but which will be introducing some unnecessary inconsistency.
89

910
## Mandatory part
1011

1112
* Only "modern" syntax permitted, dotted syntax is not generally allowed (with few exceptions)
12-
* No short name for statements keywords allowed - use fully expanded keyword names. This same rule applie to builtin function names - they should be fully pronounced.
13+
* No short name for statements keywords or built-in functions allowed - use fully expanded names.
1314

1415
## Recommended part
15-
* We recommend to use fully expanded keyword in lower case or capitalized. Whatever you'll select should be consistent across class or utility, i.e.
16+
* We recommend to use fully expanded keyword or function name in lower case or capitalized. Whatever you'll select should be consistent across class or utility, i.e.
1617
```
1718
If (expression) {
1819
Do ##class(Sample).%New(initexpresion)
1920
For i=1:1:10 {
20-
Write something, $Zversion, !
21+
Write something, $ZVersion, !
2122
}
2223
}
2324
```
@@ -31,16 +32,23 @@ If (expression) {
3132
}
3233
}
3334
```
34-
* Use the reasonable name convention which is consistent across hierarchy. We recommend to use CamelCase for classes, methods and properties (e.g. `Sample.Person`, `OpenFile`, `LastIndex`, etc.), but smallCamelCase for local variables (e.g. `startDate`, `endDate`), but please be consistent and use local schea if it's different thancurrent recommendation.
35-
* For better readablity please insert spaces after comma in argument list, i.e.
36-
```
37-
Write 1, 2, 3
38-
Do ..Method(Arg1, Arg2, Arg3)
39-
```
35+
* Use the reasonable name convention consistently across whole hierarchy. We recommend to use CamelCase for classes, methods and properties (e.g. `Sample.Person`, `OpenFile`, `LastIndex`, etc.), but smallCamelCase for local variables (e.g. `startDate`, `endDate`), but please be consistent and use local schema if it's different than current recommendation.
4036
* We recommend to use `#dim` statement for declaration of local variables types, e.g.
4137
```
4238
#dim array as %ArrayOfDataTypes = ##class(%ArrayOfDataTypes).%New()
4339
do array.SetAt(id, "id")
4440
#dim status As %Status = $$$OK
4541
```
4642
This will help editor to provide better auto-complete, and eventually will be used by static checker for type informantion extraction.
43+
* For better readablity please insert spaces after comma in argument list, i.e.
44+
```
45+
Write 1, 2, 3
46+
Do ..Method(Arg1, Arg2, Arg3)
47+
```
48+
* For better readability please insert spaces around assignment. You may align several neighbour assignments according to your tastes, i.e.
49+
```
50+
#dim index As %Integer = 0
51+
#dim countOfItems As %Integer = ..Count()
52+
set j = k + 1
53+
set iN = jN \ l
54+
```

0 commit comments

Comments
 (0)