Skip to content

Commit 8a7f27c

Browse files
committed
docs(diagnostics): add exceptions section to MagicDate and MagicNumber diagnostics
- Introduced an "Exceptions" section in both MagicDate and MagicNumber documentation to clarify scenarios where diagnostics do not trigger. - Included examples for structure property assignments and method calls that do not activate the diagnostics, enhancing user understanding of the limitations.
1 parent d4ead75 commit 8a7f27c

File tree

4 files changed

+95
-1
lines changed

4 files changed

+95
-1
lines changed

docs/diagnostics/MagicDate.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,26 @@
3535
ХоверБордБудетИзобретен = Неопределено;
3636
КонецЕсли;
3737
```
38+
39+
## Исключения
40+
41+
Диагностика не срабатывает в следующих случаях:
42+
43+
### Присваивание к свойствам структуры
44+
45+
```bsl
46+
// НЕ срабатывает - осмысленное имя свойства
47+
СтруктураДанных.ДатаНачала = '20230101';
48+
СтруктураДанных.ДатаОкончания = '20241231';
49+
50+
// НЕ срабатывает - присваивание к свойству структуры
51+
НоваяСтруктура = Новый Структура("ДатаСоздания");
52+
НоваяСтруктура.ДатаСоздания = '20240101';
53+
```
54+
55+
### Вызовы методов
56+
57+
```bsl
58+
// НЕ срабатывает - вызов метода
59+
НоваяСтруктура.Вставить("ДатаСоздания", '20240101');
60+
```

docs/diagnostics/MagicNumber.md

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
Возврат Длительность < 10 * 60 * 60;
1616
1717
КонецФункции
18-
```
18+
```
1919

2020
Хорошо
2121

@@ -30,3 +30,27 @@
3030
3131
КонецФункции
3232
```
33+
34+
## Исключения
35+
36+
Диагностика не срабатывает в следующих случаях:
37+
38+
### Присваивание к свойствам структуры
39+
40+
```bsl
41+
// НЕ срабатывает - осмысленное имя свойства
42+
СтруктураДанных.Код = 100;
43+
СтруктураДанных.Количество = 5;
44+
45+
// НЕ срабатывает - присваивание к свойству структуры
46+
НоваяСтруктура = Новый Структура("МояПеременная");
47+
НоваяСтруктура.МояПеременная = 20;
48+
```
49+
50+
### Вызовы методов
51+
52+
```bsl
53+
// НЕ срабатывает - вызов метода
54+
НоваяСтруктура.Вставить("МояПеременная", 20);
55+
Массив.Добавить(1);
56+
```

docs/en/diagnostics/MagicDate.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,26 @@ If CurrentDate < DateInventionHover() Then
3535
HoverBoardWillBeInvented = Undefined;
3636
EndIf;
3737
```
38+
39+
## Exceptions
40+
41+
The diagnostic does not trigger in the following cases:
42+
43+
### Structure property assignment
44+
45+
```bsl
46+
// Does NOT trigger - meaningful property name
47+
DataStructure.StartDate = '20230101';
48+
DataStructure.EndDate = '20241231';
49+
50+
// Does NOT trigger - structure property assignment
51+
NewStructure = New Structure("CreationDate");
52+
NewStructure.CreationDate = '20240101';
53+
```
54+
55+
### Method calls
56+
57+
```bsl
58+
// Does NOT trigger - method call
59+
NewStructure.Insert("CreationDate", '20240101');
60+
```

docs/en/diagnostics/MagicNumber.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,27 @@ Function GetsTheInterval (Duration in Seconds)
3030
3131
End Function
3232
```
33+
34+
## Exceptions
35+
36+
The diagnostic does not trigger in the following cases:
37+
38+
### Structure property assignment
39+
40+
```bsl
41+
// Does NOT trigger - meaningful property name
42+
DataStructure.Code = 100;
43+
DataStructure.Quantity = 5;
44+
45+
// Does NOT trigger - structure property assignment
46+
NewStructure = New Structure("MyVariable");
47+
NewStructure.MyVariable = 20;
48+
```
49+
50+
### Method calls
51+
52+
```bsl
53+
// Does NOT trigger - method call
54+
NewStructure.Insert("MyVariable", 20);
55+
Array.Add(1);
56+
```

0 commit comments

Comments
 (0)