Skip to content

Commit

Permalink
Merge pull request #3027 from 1c-syntax/translations_docs-diagnostics…
Browse files Browse the repository at this point in the history
…-rewritemethodparameter-md--develop_en

Translate 'docs/diagnostics/RewriteMethodParameter.md' in 'en'
  • Loading branch information
theshadowco authored Mar 27, 2023
2 parents 9de8c00 + 4e8d901 commit 24f7604
Showing 1 changed file with 31 additions and 3 deletions.
34 changes: 31 additions & 3 deletions docs/en/diagnostics/RewriteMethodParameter.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,42 @@
<!-- Блоки выше заполняются автоматически, не трогать -->
## Description
<!-- Описание диагностики заполняется вручную. Необходимо понятным языком описать смысл и схему работу -->
It is wrong to write methods in which their arguments are overwritten immediately on entry.

It is necessary to correct this deficiency by removing the parameters, converting them to local variables.

## Examples
<!-- В данном разделе приводятся примеры, на которые диагностика срабатывает, а также можно привести пример, как можно исправить ситуацию -->
Suspicious code
```bsl
Procedure Configor(Val ConnectionString, Val User = "", Val Pass = "") Export
ConnectionString = "/F""" + DataBaseDir + """"; // Error
...
EndProcedure
```

Сorrected:
```bsl
Procedure Configor(Val DataBaseDir, Val User = "", Val Pass = "") Export
ConnectionString = "/F""" + DataBaseDir + """"; // No error
...
EndProcedure
```
or
```bsl
Procedure Configor(Val DataBaseDir, Val User = "", Val Pass = "") Export
If Not EmpyString(DataBaseDir) Then
NewConnectionString = "/F""" + DataBaseDir + """";
Else
NewConnectionString = ConnectionString; // Hmm, where is this from?
EndIf;
...
EndProcedure
```

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

0 comments on commit 24f7604

Please sign in to comment.