You've already forked v8-code-style
mirror of
https://github.com/1C-Company/v8-code-style.git
synced 2025-12-06 02:15:13 +02:00
48 lines
713 B
Markdown
48 lines
713 B
Markdown
|
|
# Excessive named self reference in common module
|
||
|
|
|
||
|
|
Excessive usage of named self reference in common module (when referencing method, property or attribute).
|
||
|
|
For cached modules self reference is allowed.
|
||
|
|
|
||
|
|
## Noncompliant Code Example
|
||
|
|
|
||
|
|
Inside common module named "MyModule":
|
||
|
|
|
||
|
|
```bsl
|
||
|
|
Var myParam;
|
||
|
|
|
||
|
|
Function test() Export
|
||
|
|
// code here
|
||
|
|
EndFunction
|
||
|
|
|
||
|
|
MyModule.myParam = MyModule.test();
|
||
|
|
```
|
||
|
|
|
||
|
|
## Compliant Solution
|
||
|
|
|
||
|
|
Inside common module named "MyModule":
|
||
|
|
|
||
|
|
```bsl
|
||
|
|
Var myParam;
|
||
|
|
|
||
|
|
Function test() Export
|
||
|
|
// code here
|
||
|
|
EndFunction
|
||
|
|
|
||
|
|
myParam = test();
|
||
|
|
```
|
||
|
|
|
||
|
|
Inside common module named "MyModuleCached":
|
||
|
|
|
||
|
|
```bsl
|
||
|
|
Var myParam;
|
||
|
|
|
||
|
|
Function test() Export
|
||
|
|
// code here
|
||
|
|
EndFunction
|
||
|
|
|
||
|
|
myParam = MyModuleCached.test();
|
||
|
|
```
|
||
|
|
|
||
|
|
## See
|
||
|
|
|