Skip to content

Commit 24f7604

Browse files
authored
Merge pull request #3027 from 1c-syntax/translations_docs-diagnostics-rewritemethodparameter-md--develop_en
Translate 'docs/diagnostics/RewriteMethodParameter.md' in 'en'
2 parents 9de8c00 + 4e8d901 commit 24f7604

File tree

1 file changed

+31
-3
lines changed

1 file changed

+31
-3
lines changed

docs/en/diagnostics/RewriteMethodParameter.md

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,42 @@
33
<!-- Блоки выше заполняются автоматически, не трогать -->
44
## Description
55
<!-- Описание диагностики заполняется вручную. Необходимо понятным языком описать смысл и схему работу -->
6+
It is wrong to write methods in which their arguments are overwritten immediately on entry.
7+
8+
It is necessary to correct this deficiency by removing the parameters, converting them to local variables.
69

710
## Examples
811
<!-- В данном разделе приводятся примеры, на которые диагностика срабатывает, а также можно привести пример, как можно исправить ситуацию -->
12+
Suspicious code
13+
```bsl
14+
Procedure Configor(Val ConnectionString, Val User = "", Val Pass = "") Export
15+
ConnectionString = "/F""" + DataBaseDir + """"; // Error
16+
...
17+
EndProcedure
18+
```
19+
20+
Сorrected:
21+
```bsl
22+
Procedure Configor(Val DataBaseDir, Val User = "", Val Pass = "") Export
23+
ConnectionString = "/F""" + DataBaseDir + """"; // No error
24+
...
25+
EndProcedure
26+
```
27+
or
28+
```bsl
29+
Procedure Configor(Val DataBaseDir, Val User = "", Val Pass = "") Export
30+
If Not EmpyString(DataBaseDir) Then
31+
NewConnectionString = "/F""" + DataBaseDir + """";
32+
Else
33+
NewConnectionString = ConnectionString; // Hmm, where is this from?
34+
EndIf;
35+
36+
...
37+
EndProcedure
38+
```
939

1040
## Sources
1141
<!-- Необходимо указывать ссылки на все источники, из которых почерпнута информация для создания диагностики -->
1242
<!-- Примеры источников
1343
14-
* Источник: [Стандарт: Тексты модулей](https://its.1c.ru/db/v8std#content:456:hdoc)
15-
* Полезная информация: [Отказ от использования модальных окон](https://its.1c.ru/db/metod8dev#content:5272:hdoc)
16-
* Источник: [Cognitive complexity, ver. 1.4](https://www.sonarsource.com/docs/CognitiveComplexity.pdf) -->
44+
* [PVS-Studio V763. Parameter is always rewritten in function body before being used](https://pvs-studio.com/ru/docs/warnings/v6023)

0 commit comments

Comments
 (0)