Skip to content

Commit 3f59388

Browse files
authored
Merge pull request #1617 from 1c-syntax/l10n_develop
2 parents 163ceab + b48fda6 commit 3f59388

File tree

163 files changed

+2320
-1696
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

163 files changed

+2320
-1696
lines changed

docs/en/contributing/DiagnostcAddSettings.md

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Adding parameters for diagnostic
22

3-
Some diagnostics may have parameters that allow end users to customize the algorithm.
4-
For example: the parameter can be the maximum string length for diagnostics for long strings or a list of numeric constants that are not magic numbers.
3+
Some diagnostics may have parameters that allow end users to customize the algorithm.
4+
For example: the parameter can be the maximum string length for diagnostics for long strings or a list of numeric constants that are not magic numbers.
55

66
## Diagnostic parameter implementation
77

@@ -11,19 +11,20 @@ To implement the diagnostic parameter, you need to make changes to the diagnosti
1111

1212
Add a constant field to the diagnostic class, in which the default value of the parameter will be saved. For example `private static final String DEFAULT_COMMENTS_ANNOTATION = "//@";`.
1313

14-
It is necessary to add a private field in which the parameter value will be stored. The field needs to be annotated `@DiagnosticParameter` In the annotation, you must specify the type of the parameter and the default value (the value is always a string type).
15-
For example
14+
It is necessary to add a private field in which the parameter value will be stored. The field needs to be annotated `@DiagnosticParameter` In the annotation, you must specify the type of the parameter and the default value (the value is always a string type).
15+
For example
1616

1717
```java
1818
@DiagnosticParameter(
1919
type = String.class,
2020
defaultValue = "" + DEFAULT_COMMENTS_ANNOTATION
2121
)
2222
private String commentsAnnotation = DEFAULT_COMMENTS_ANNOTATION;
23+
2324
```
2425

25-
If the parameter is primitive or of type String and it is set by a simple setter, then that's it.
26-
If the parameter is "hard", for example, a pattern string for a regular expression that must be evaluated before setting, then you need to implement a method for setting parameter values `configure`.
26+
If the parameter is primitive or of type String and it is set by a simple setter, then that's it.
27+
If the parameter is "hard", for example, a pattern string for a regular expression that must be evaluated before setting, then you need to implement a method for setting parameter values `configure`.
2728

2829
For example, there are two parameters:
2930

@@ -43,14 +44,15 @@ Then the method of setting the parameter values will look:
4344
(String) configuration.getOrDefault("excludeMethods", EXCLUDE_METHODS_DEFAULT);
4445
this.excludeMethods = new ArrayList<>(Arrays.asList(excludeMethodsString.split(",")));
4546
}
47+
4648
```
4749

4850
### Test change
4951

50-
It is necessary to add a test to change the diagnostic settings.
51-
The test is added to the diagnostic test class *(a separate method for each combination of diagnostic setting options)*. At the beginning of the test, you need to set the value of the diagnostic parameter, the subsequent steps are similar to the general rules for writing tests.
52-
Для установки параметра диагностики из теста необходимо получить конфигурацию диагностики по умолчанию, используя метод `getDefaultConfiguration()` from the metadata of the current diagnostic `diagnosticInstance.getInfo()`. The next step is to change the parameter value by adding to the configuration collection, and then reconfigure using the method `configure`.
53-
Example
52+
It is necessary to add a test to change the diagnostic settings.
53+
The test is added to the diagnostic test class _(a separate method for each combination of diagnostic setting options)_. At the beginning of the test, you need to set the value of the diagnostic parameter, the subsequent steps are similar to the general rules for writing tests.
54+
To set a diagnostic parameter from a test, you need to get the default diagnostic configuration using the method `getDefaultConfiguration()` from the metadata of the current diagnostic `diagnosticInstance.getInfo()`. The next step is to change the parameter value by adding to the configuration collection, and then reconfigure using the method `configure`.
55+
Example
5456

5557
```java
5658
// get current configuration
@@ -61,13 +63,14 @@ configuration.put("commentsAnnotation", "//(с)");
6163

6264
// reconfiguring
6365
diagnosticInstance.configure(configuration);
66+
6467
```
6568

6669
### Adding a Parameter Description
6770

68-
For correct operation, it is necessary to add a parameter description for each language in the diagnostic resource files.
69-
Diagnostic resources are located in files`resources/com/github/_1c_syntax/bsl/languageserver/diagnostics/<DIAGNOSTIC_KEY>_en.properties` and `resources/com/github/_1c_syntax/bsl/languageserver/diagnostics/<DIAGNOSTIC_KEY>_ru.properties`.
70-
In each file you need to add a new line with the name of the parameter and its description
71+
For correct operation, it is necessary to add a parameter description for each language in the diagnostic resource files.
72+
Diagnostic resources are located in files`resources/com/github/_1c_syntax/bsl/languageserver/diagnostics/<DIAGNOSTIC_KEY>_en.properties` and `resources/com/github/_1c_syntax/bsl/languageserver/diagnostics/<DIAGNOSTIC_KEY>_ru.properties`.
73+
In each file, add a new line with the parameter name and description
7174

7275
```ini
7376
commentsAnnotation=Skip annotation comments starting with the specified substrings. A comma separated list. For example: //@,//(c)
Lines changed: 20 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,34 @@
11
# Diagnostic development workflow
22

3-
1. Go to the section [issues](https://github.com/1c-syntax/bsl-language-server/issues) and select your task from the list. It is necessary to choose tasks that do not have an executor, i.e. `Assignees` is not specified (the block is on the right, almost under the heading).
4-
5-
1. If there is no task for diagnostics, then you need to create it by clicking the `New issue` button
6-
3+
1. Go to the section [issues](https://github.com/1c-syntax/bsl-language-server/issues) and select your task from the list. It is necessary to choose tasks that do not have an executor, i.e. `Assignees` is not specified (the block is on the right, almost under the heading).
4+
1. If there is no task for diagnostics, then you need to create it by clicking the `New issue` button
75
2. Write in the comments to the task to the maintainers that you want to take the task to work. After your nickname appears in the task in the `Assignees` block, you can proceed.
8-
96
3. You need to create a fork of the repository in `GitHub`, clone the repository to your computer and create a new feature branch (development by git flow).
10-
11-
1. If the fork has already been created earlier, then you need to update the `develop` branch from the primary repository. The easiest way to do this is as follows
12-
1. The local repository has two remote repository addresses: yours and primary
13-
2. Get updates from both repositories `git fetch --progress "--all" --prune`
14-
3. In the local repository, switch to the branch `develop`
15-
4. Reset the branch state to the state of the primary repository (`git reset --hard`)
16-
5. Pushin the branch to your remote repository
17-
18-
4. To create all the necessary files in the right places, you need to run the command `gradlew newDiagnostic --key="KeyDiagnostic"`, instead `KeyDiagnostic` you must specify the key of your diagnostic. Details in help `gradlew -q help --task newDiagnostic`. Parameters:
19-
20-
- `--key` - Diagnostic key
21-
- `--nameRu` - Russian description
22-
- `--nameEn` - English description
7+
1. If the fork has already been created earlier, then you need to update the `develop` branch from the primary repository. The easiest way to do this is as follows
8+
1. The local repository has two remote repository addresses: yours and primary
9+
2. Get updates from both repositories `git fetch --progress "--all" --prune`
10+
3. In the local repository, switch to the branch `develop`
11+
4. Reset the branch state to the state of the primary repository (`git reset --hard`)
12+
5. Pushin the branch to your remote repository
13+
4. To create all the necessary files in the right places, you need to run the command `gradlew newDiagnostic --key="KeyDiagnostic"`, instead `KeyDiagnostic` you must specify the key of your diagnostic. Details in help `gradlew -q help --task newDiagnostic`. Parameters:
14+
15+
* `--key` - Diagnostic key
16+
* `--nameRu` - Russian description
17+
* `--nameEn` - English description
2318

2419
At startup, a list of available diagnostic tags is displayed. You must enter 1-3 tags from the space separated ones.
2520

26-
1. To develop
27-
2. After completion of the development of diagnostics: it is necessary to check the changes (after testing), and also perform a number of service tasks.
28-
To simplify, a special command has been created that can be run in the console `gradlew precommit` or from the Gradle taskbar `precommit`. Task actions:
21+
5. To develop
22+
6. After completion of the development of diagnostics: it is necessary to check the changes (after testing), and also perform a number of service tasks.
23+
To simplify, a special command has been created that can be run in the console `gradlew precommit` or from the Gradle taskbar `precommit`. Task includes subtasks
2924

3025
- test - autotesting project
3126
- licenseFormat - installation of a license block in java source files
3227
- updateDiagnosticDocs - diagnostic help update
3328
- updateDiagnosticIndex - diagnostic index update
3429
- updateJsonSchema - json schema update
3530

36-
1. If everything is done correctly, you need to commit the changes and push to your remote repository.
37-
2. You need to create `Pull request` from your feature branch to the `develop` branch of the primary repository and fill in the information in the description.
38-
3. Before closing `Pull request`, the maintainers will conduct a Code review. Correction of errors must be done in the same feature branch, GitHub will automatically add changes to the created `Pull request`.
39-
4. Closing `Pull request` confirms the completion of the task.
31+
7. If everything is done correctly, you need to commit the changes and push to your remote repository.
32+
8. You need to create `Pull request` from your feature branch to the `develop` branch of the primary repository and fill in the information in the description.
33+
9. Before closing `Pull request`, the maintainers will conduct a Code review. Correction of errors must be done in the same feature branch, GitHub will automatically add changes to the created `Pull request`.
34+
10. Closing `Pull request` confirms the completion of the task.

0 commit comments

Comments
 (0)