Skip to content

Commit f6abd4b

Browse files
committed
Apply suggestions from code review
1 parent b0218ab commit f6abd4b

File tree

4 files changed

+9
-7
lines changed

4 files changed

+9
-7
lines changed

docs/diagnostics/IncorrectLineBreak.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,27 +14,28 @@
1414
операнды на новой строке предваряются стандартным отступом, либо выравниваются по началу первого операнда без учета знаков операций.
1515

1616
При необходимости параметры процедур, функций и методов следует переносить следующим образом:
17+
1718
* параметры выравниваются по началу первого параметра, либо предваряются стандартным отступом;
1819
* закрывающая скобка и разделитель операторов ";" пишутся в той же строке, что и последний параметр;
1920
* также допустим и способ форматирования, который предлагает функция автоформатирования в конфигураторе
2021

2122
Сложные логические условия в Если…ИначеЕсли…КонецЕсли следует переносить следующим образом:
23+
2224
* каждое элементарное условие нужно начинать с новой строки, если длина строки превышает ограничение в 120 символов;
2325
* логические операторы И, ИЛИ ставятся в начале строки, а не в конце предыдущей строки;
2426
* все условия предваряются стандартным отступом, либо выравниваются по началу первого условия, без учета логического оператора (для выравнивания выражений относительно первой строки рекомендуется использовать пробелы).
2527

2628
## Примеры
2729
<!-- В данном разделе приводятся примеры, на которые диагностика срабатывает, а также можно привести пример, как можно исправить ситуацию -->
2830

29-
```
31+
```bsl
3032
СуммаДокумента = СуммаБезСкидки +
3133
СуммаРучнойСкидки +
3234
СуммаАвтоматическойСкидки;
3335
```
3436

3537
## Источники
3638
<!-- Необходимо указывать ссылки на все источники, из которых почерпнута информация для создания диагностики -->
37-
<!-- Примеры источников
3839

3940
* Источник: [Стандарт: Перенос выражений](https://its.1c.ru/db/v8std#content:444:hdoc)
4041

docs/en/diagnostics/IncorrectLineBreak.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,32 +6,35 @@
66

77
<!-- Блоки выше заполняются автоматически, не трогать -->
88
## Description
9+
910
Long arithmetic expressions are carried as follows:
1011
one entry can contain more than one operand;
1112
when wrapping, operation characters are written at the beginning of the line (and not at the end of the previous line);
1213
operands on a new line are preceded by standard indentation, or they are aligned to the beginning of the first operand, regardless of the operation signs.
1314

1415
If necessary, parameters of procedures, functions and methods should be transferred as follows:
16+
1517
* parameters are either aligned to the beginning of the first parameter, or preceded by standard indentation;
1618
* closing parenthesis and operator separator ";" are written on the same line as the last parameter;
1719
* the formatting method that offers the auto-formatting function in the configurator is also acceptable
1820

1921
Complex logical conditions in If ... ElseIf ... EndIf should be carried as follows:
22+
2023
* The basis for the newline if the line length is limited to 120 characters;
2124
* logical operators AND, OR are placed at the beginning of a line, and not at the end of the previous line;
2225
* all conditions are preceded by the standard first indent, or they are aligned at the start of work without taking into account the logical operator (it is recommended to use spaces to align expressions relative to the first line).
26+
2327
## Examples
2428
<!-- В данном разделе приводятся примеры, на которые диагностика срабатывает, а также можно привести пример, как можно исправить ситуацию -->
2529

26-
```
30+
```bsl
2731
AmountDocument = AmountWithoutDiscount +
2832
AmountManualDiscounts +
2933
AmountAutomaticDiscount;
3034
```
3135

3236
## Sources
3337
<!-- Необходимо указывать ссылки на все источники, из которых почерпнута информация для создания диагностики -->
34-
<!-- Примеры источников
3538

3639
* Источник: [Стандарт: Перенос выражений (RU)](https://its.1c.ru/db/v8std#content:444:hdoc)
3740

src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/IncorrectLineBreakDiagnostic.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@
4646
DiagnosticTag.STANDARD,
4747
DiagnosticTag.BADPRACTICE
4848
}
49-
5049
)
5150
public class IncorrectLineBreakDiagnostic extends AbstractDiagnostic {
5251

@@ -80,7 +79,7 @@ private void checkContent(Pattern pattern) {
8079
Matcher matcher = pattern.matcher(checkText);
8180

8281
if (matcher.find()) {
83-
diagnosticStorage.addDiagnostic(i+1,matcher.start(1),i+1,matcher.end(1));
82+
diagnosticStorage.addDiagnostic(i + 1, matcher.start(1) , i + 1, matcher.end(1));
8483
}
8584
}
8685
}

src/main/java/com/github/_1c_syntax/bsl/languageserver/utils/Ranges.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,5 +123,4 @@ public static Optional<Range> getFirstSignificantTokenRange(Collection<Token> to
123123
.filter(range -> (!range.getStart().equals(range.getEnd())))
124124
.findFirst();
125125
}
126-
127126
}

0 commit comments

Comments
 (0)