Skip to content

Commit bd396fb

Browse files
committed
doc: update the articel about avoiding global resource files
1 parent 57f9209 commit bd396fb

File tree

1 file changed

+41
-28
lines changed

1 file changed

+41
-28
lines changed

docs/04_tip_and_tricks/avoiding_a_global_resource_file.md

Lines changed: 41 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -69,34 +69,47 @@ The recommended solution is to **modularize your resources**:
6969

7070
This modular approach not only eliminates issues like circular dependencies and performance bottlenecks but also enhances maintainability and clarity. It ensures that suite settings clearly document which components are required for each test suite.
7171

72-
### When Restructuring Isn’t Possible
73-
74-
If restructuring your project is not an option, you can mitigate potential issues by managing the warnings provided by your development environment. For instance, you can suppress warnings related to circular dependencies and redundant imports either on a per-file basis or globally.
75-
76-
For global suppression in VS Code, add the following to your `settings.json`:
77-
78-
```json
79-
"robotcode.analysis.diagnosticModifiers.ignore": [
80-
"PossibleCircularImport",
81-
"CircularImport",
82-
"ResourceAlreadyImported",
83-
"VariablesAlreadyImported",
84-
"LibraryAlreadyImported"
85-
]
86-
```
87-
88-
Alternatively, you can use a [`robot.toml`](/03_reference/config) file with these contents:
89-
90-
```toml
91-
[tool.robotcode-analyze.modifiers]
92-
ignore = [
93-
"PossibleCircularImport",
94-
"CircularImport",
95-
"ResourceAlreadyImported",
96-
"VariablesAlreadyImported",
97-
"LibraryAlreadyImported"
98-
]
99-
```
72+
## When Restructuring Isn’t Possible
73+
74+
If restructuring your project isn’t an option, you can mitigate potential issues by managing warnings from your development environment. For example, you can suppress warnings related to circular dependencies and redundant imports on a per-file basis or globally.
75+
76+
- **Suppress Warnings in Specific Files:**
77+
Use directives to disable warnings for circular dependencies and already-imported resources on a per-file basis.
78+
79+
```robot
80+
# robotcode: ignore[*ResourceAlreadyImported*, PossibleCircularImport]
81+
*** Settings ***
82+
Variables variables
83+
84+
Resource already_imported.resource # robotcode: ignore[ResourceAlreadyImported]
85+
Resource circular_import.resource # robotcode: ignore[PossibleCircularImport]
86+
```
87+
88+
- **Suppress Warnings Globally:**
89+
For global suppression in VS Code, add the following to your `settings.json`:
90+
91+
```json
92+
"robotcode.analysis.diagnosticModifiers.ignore": [
93+
"PossibleCircularImport",
94+
"CircularImport",
95+
"ResourceAlreadyImported",
96+
"VariablesAlreadyImported",
97+
"LibraryAlreadyImported"
98+
]
99+
```
100+
101+
Alternatively, to remain IDE-independent, use a [`robot.toml`](/03_reference/config) file with these contents:
102+
103+
```toml
104+
[tool.robotcode-analyze.modifiers]
105+
ignore = [
106+
"PossibleCircularImport",
107+
"CircularImport",
108+
"ResourceAlreadyImported",
109+
"VariablesAlreadyImported",
110+
"LibraryAlreadyImported"
111+
]
112+
```
100113

101114
## Conclusion
102115

0 commit comments

Comments
 (0)