Skip to content

Commit a13ded5

Browse files
authored
Merge pull request #3011 from 1c-syntax/translations_docs-contributing-styleguide-md--develop_en
Translate 'docs/contributing/StyleGuide.md' in 'en'
2 parents 7775eb3 + 3c714b9 commit a13ded5

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

docs/en/contributing/StyleGuide.md

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,29 @@ This document contains general guidelines for writing code in the BSL Language S
44

55
Try to stick to them and the code review process will be simple.
66

7-
## General recommendations
7+
## Null values
88

99
If a method can legally return `null`, it is recommended that you return `Optional<T>` instead of explicitly returning `null`. Exceptions (eg. high frequency or performance functions) are negotiated separately.
1010

11+
The description of the `package-info.java` package must indicate that the NonNull API is used by default in the package.
12+
To do this, the annotation `@DefaultAnnotation(NonNull.class)` is added above the package name
13+
14+
Example:
15+
```java
16+
// ...license...
17+
@DefaultAnnotation(NonNull.class)
18+
package com.github._1c_syntax.bsl.languageserver;
19+
20+
import edu.umd.cs.findbugs.annotations.DefaultAnnotation;
21+
import edu.umd.cs.findbugs.annotations.NonNull;
22+
```
23+
24+
To explicitly indicate that a method can accept or return `null`, use the annotation `@edu.umd.cs.findbugs.annotations.Nullable`.
25+
26+
This avoids using the `@edu.umd.cs.findbugs.annotations.NonNull` annotation.
27+
28+
The `null` control annotations from the `javax.annotations` or `jetbrains.annotations` packages are not allowed.
29+
1130
## Formatting
1231

1332
1. All code in the modules should be automatically formatted.
@@ -56,6 +75,6 @@ To simplify the creation of a logger instance, it is recommended to use the `@lo
5675
1. Connecting new libraries to the implementation scope should be done carefully, with control over the increase in the size of the resulting jar file. If possible, "unnecessary" and unused sub-dependencies should be excluded through `exclude`.
5776
1. Explicit linking of the `com.google.guava`, `Google Collections` library or other parts of the Guava family of libraries is prohibited. **If absolutely necessary**, it is permissible to copy the implementation from `Guava` inside the BSL Language Server, subject to the terms of the Guava license. For everything else, there is Apache Commons.
5877
1. Import of `*.google.*` classes, as well as other parts of Guava libraries, is prohibited. With no exceptions.
59-
78+
1. The `jsr305` package and its annotations should not be used in code. See section "Null values".
6079

6180
> In the process...

0 commit comments

Comments
 (0)