Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Steinhardt <psteinhardt@gitlab.com>2020-04-17 15:05:29 +0300
committerPatrick Steinhardt <psteinhardt@gitlab.com>2020-04-21 12:16:16 +0300
commit69df7240ee24916e597a911acfe828b7d5cea2b9 (patch)
tree517b545a4ac74bae92dd322dc2552754a0cc8180 /STYLE.md
parent31ebd91546ea9df484f97a9c9ba131d88c74ae74 (diff)
STYLE: add a note about character sets for coding
Developer-facing code should use the ASCII character set as far as possible to ensure improve accessibility across platforms. Many platforms lack a lot of UTF8 code glyps, leading to code that is hard to read on such platforms if they are used. Add a note to our style guide that mandates this rule.
Diffstat (limited to 'STYLE.md')
-rw-r--r--STYLE.md18
1 files changed, 13 insertions, 5 deletions
diff --git a/STYLE.md b/STYLE.md
index e9bfc5c08..afc0a610e 100644
--- a/STYLE.md
+++ b/STYLE.md
@@ -1,5 +1,13 @@
# Gitaly code style
+## Character set
+
+### Avoid non-ASCII characters in developer-facing code
+
+Code that is developer-facing only, like variables, functions or test
+descriptions should use the ASCII character set only. This is to ensure that
+code is accessible to different developers with varying setups.
+
## Errors
### Use %v when wrapping errors
@@ -204,12 +212,12 @@ Example of **invalid** usage:
import (
"io"
"os/exec"
-
+
"context"
-
+
"gitlab.com/gitlab-org/gitaly/internal/git/alternates"
"gitlab.com/gitlab-org/gitaly/internal/git/repository"
-
+
"gitlab.com/gitlab-org/gitaly/internal/command"
)
```
@@ -251,12 +259,12 @@ via deferred statements. For example:
func (scs SuperCoolService) MyAwesomeRPC(ctx context.Context, r Request) error {
done := make(chan struct{}) // signals the goroutine is done
defer func() { <-done }() // wait until the goroutine is done
-
+
go func() {
defer close(done) // signal when the goroutine returns
doWork(r)
}()
-
+
return nil
}
```