robotcode-robot 2.9.0.dev214__tar.gz → 2.9.0.dev264__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {robotcode_robot-2.9.0.dev214 → robotcode_robot-2.9.0.dev264}/.gitignore +1 -1
- {robotcode_robot-2.9.0.dev214 → robotcode_robot-2.9.0.dev264}/PKG-INFO +2 -2
- {robotcode_robot-2.9.0.dev214 → robotcode_robot-2.9.0.dev264}/pyproject.toml +1 -1
- robotcode_robot-2.9.0.dev264/src/robotcode/robot/__version__.py +1 -0
- {robotcode_robot-2.9.0.dev214 → robotcode_robot-2.9.0.dev264}/src/robotcode/robot/config/model.py +4 -2
- {robotcode_robot-2.9.0.dev214 → robotcode_robot-2.9.0.dev264}/src/robotcode/robot/diagnostics/diagnostic_rules.py +6 -0
- {robotcode_robot-2.9.0.dev214 → robotcode_robot-2.9.0.dev264}/src/robotcode/robot/diagnostics/document_cache_helper.py +3 -3
- {robotcode_robot-2.9.0.dev214 → robotcode_robot-2.9.0.dev264}/src/robotcode/robot/diagnostics/errors.py +6 -0
- {robotcode_robot-2.9.0.dev214 → robotcode_robot-2.9.0.dev264}/src/robotcode/robot/diagnostics/import_resolver.py +49 -8
- {robotcode_robot-2.9.0.dev214 → robotcode_robot-2.9.0.dev264}/src/robotcode/robot/diagnostics/imports_manager.py +56 -18
- {robotcode_robot-2.9.0.dev214 → robotcode_robot-2.9.0.dev264}/src/robotcode/robot/diagnostics/library_doc.py +122 -36
- {robotcode_robot-2.9.0.dev214 → robotcode_robot-2.9.0.dev264}/src/robotcode/robot/diagnostics/namespace.py +7 -2
- {robotcode_robot-2.9.0.dev214 → robotcode_robot-2.9.0.dev264}/src/robotcode/robot/diagnostics/namespace_analyzer.py +2 -3
- {robotcode_robot-2.9.0.dev214 → robotcode_robot-2.9.0.dev264}/src/robotcode/robot/diagnostics/semantic_analyzer/analyzer.py +2 -3
- {robotcode_robot-2.9.0.dev214 → robotcode_robot-2.9.0.dev264}/src/robotcode/robot/utils/robot_path.py +8 -3
- robotcode_robot-2.9.0.dev214/src/robotcode/robot/__version__.py +0 -1
- {robotcode_robot-2.9.0.dev214 → robotcode_robot-2.9.0.dev264}/README.md +0 -0
- {robotcode_robot-2.9.0.dev214 → robotcode_robot-2.9.0.dev264}/src/robotcode/robot/__init__.py +0 -0
- {robotcode_robot-2.9.0.dev214 → robotcode_robot-2.9.0.dev264}/src/robotcode/robot/config/__init__.py +0 -0
- {robotcode_robot-2.9.0.dev214 → robotcode_robot-2.9.0.dev264}/src/robotcode/robot/config/loader.py +0 -0
- {robotcode_robot-2.9.0.dev214 → robotcode_robot-2.9.0.dev264}/src/robotcode/robot/config/utils.py +0 -0
- {robotcode_robot-2.9.0.dev214 → robotcode_robot-2.9.0.dev264}/src/robotcode/robot/diagnostics/__init__.py +0 -0
- {robotcode_robot-2.9.0.dev214 → robotcode_robot-2.9.0.dev264}/src/robotcode/robot/diagnostics/analyzer_result.py +0 -0
- {robotcode_robot-2.9.0.dev214 → robotcode_robot-2.9.0.dev264}/src/robotcode/robot/diagnostics/data_cache.py +0 -0
- {robotcode_robot-2.9.0.dev214 → robotcode_robot-2.9.0.dev264}/src/robotcode/robot/diagnostics/diagnostics_modifier.py +0 -0
- {robotcode_robot-2.9.0.dev214 → robotcode_robot-2.9.0.dev264}/src/robotcode/robot/diagnostics/entities.py +0 -0
- {robotcode_robot-2.9.0.dev214 → robotcode_robot-2.9.0.dev264}/src/robotcode/robot/diagnostics/keyword_finder.py +0 -0
- {robotcode_robot-2.9.0.dev214 → robotcode_robot-2.9.0.dev264}/src/robotcode/robot/diagnostics/model_helper.py +0 -0
- {robotcode_robot-2.9.0.dev214 → robotcode_robot-2.9.0.dev264}/src/robotcode/robot/diagnostics/project_index.py +0 -0
- {robotcode_robot-2.9.0.dev214 → robotcode_robot-2.9.0.dev264}/src/robotcode/robot/diagnostics/scope_tree.py +0 -0
- {robotcode_robot-2.9.0.dev214 → robotcode_robot-2.9.0.dev264}/src/robotcode/robot/diagnostics/semantic_analyzer/__init__.py +0 -0
- {robotcode_robot-2.9.0.dev214 → robotcode_robot-2.9.0.dev264}/src/robotcode/robot/diagnostics/semantic_analyzer/enums.py +0 -0
- {robotcode_robot-2.9.0.dev214 → robotcode_robot-2.9.0.dev264}/src/robotcode/robot/diagnostics/semantic_analyzer/json_dump.py +0 -0
- {robotcode_robot-2.9.0.dev214 → robotcode_robot-2.9.0.dev264}/src/robotcode/robot/diagnostics/semantic_analyzer/model.py +0 -0
- {robotcode_robot-2.9.0.dev214 → robotcode_robot-2.9.0.dev264}/src/robotcode/robot/diagnostics/semantic_analyzer/nodes.py +0 -0
- {robotcode_robot-2.9.0.dev214 → robotcode_robot-2.9.0.dev264}/src/robotcode/robot/diagnostics/semantic_analyzer/run_keyword.py +0 -0
- {robotcode_robot-2.9.0.dev214 → robotcode_robot-2.9.0.dev264}/src/robotcode/robot/diagnostics/semantic_analyzer/serialization.py +0 -0
- {robotcode_robot-2.9.0.dev214 → robotcode_robot-2.9.0.dev264}/src/robotcode/robot/diagnostics/semantic_analyzer/variable_tokenizer.py +0 -0
- {robotcode_robot-2.9.0.dev214 → robotcode_robot-2.9.0.dev264}/src/robotcode/robot/diagnostics/variable_scope.py +0 -0
- {robotcode_robot-2.9.0.dev214 → robotcode_robot-2.9.0.dev264}/src/robotcode/robot/diagnostics/workspace_config.py +0 -0
- {robotcode_robot-2.9.0.dev214 → robotcode_robot-2.9.0.dev264}/src/robotcode/robot/document_formats.py +0 -0
- {robotcode_robot-2.9.0.dev214 → robotcode_robot-2.9.0.dev264}/src/robotcode/robot/language_definitions.py +0 -0
- {robotcode_robot-2.9.0.dev214 → robotcode_robot-2.9.0.dev264}/src/robotcode/robot/py.typed +0 -0
- {robotcode_robot-2.9.0.dev214 → robotcode_robot-2.9.0.dev264}/src/robotcode/robot/utils/__init__.py +0 -0
- {robotcode_robot-2.9.0.dev214 → robotcode_robot-2.9.0.dev264}/src/robotcode/robot/utils/ast.py +0 -0
- {robotcode_robot-2.9.0.dev214 → robotcode_robot-2.9.0.dev264}/src/robotcode/robot/utils/markdown_blocks.py +0 -0
- {robotcode_robot-2.9.0.dev214 → robotcode_robot-2.9.0.dev264}/src/robotcode/robot/utils/markdown_docs.py +0 -0
- {robotcode_robot-2.9.0.dev214 → robotcode_robot-2.9.0.dev264}/src/robotcode/robot/utils/markdownformatter.py +0 -0
- {robotcode_robot-2.9.0.dev214 → robotcode_robot-2.9.0.dev264}/src/robotcode/robot/utils/match.py +0 -0
- {robotcode_robot-2.9.0.dev214 → robotcode_robot-2.9.0.dev264}/src/robotcode/robot/utils/robot_patching.py +0 -0
- {robotcode_robot-2.9.0.dev214 → robotcode_robot-2.9.0.dev264}/src/robotcode/robot/utils/stubs.py +0 -0
- {robotcode_robot-2.9.0.dev214 → robotcode_robot-2.9.0.dev264}/src/robotcode/robot/utils/variables.py +0 -0
- {robotcode_robot-2.9.0.dev214 → robotcode_robot-2.9.0.dev264}/src/robotcode/robot/utils/visitor.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: robotcode-robot
|
|
3
|
-
Version: 2.9.0-dev.
|
|
3
|
+
Version: 2.9.0-dev.264
|
|
4
4
|
Summary: Support classes for RobotCode for handling Robot Framework projects.
|
|
5
5
|
Project-URL: Homepage, https://robotcode.io
|
|
6
6
|
Project-URL: Donate, https://opencollective.com/robotcode
|
|
@@ -27,7 +27,7 @@ Classifier: Topic :: Utilities
|
|
|
27
27
|
Classifier: Typing :: Typed
|
|
28
28
|
Requires-Python: >=3.10
|
|
29
29
|
Requires-Dist: platformdirs>=4.3
|
|
30
|
-
Requires-Dist: robotcode-core==2.9.0-dev.
|
|
30
|
+
Requires-Dist: robotcode-core==2.9.0-dev.264
|
|
31
31
|
Requires-Dist: robotframework>=5.0.0
|
|
32
32
|
Requires-Dist: tomli>=1.1.0; python_version < '3.11'
|
|
33
33
|
Description-Content-Type: text/markdown
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "2.9.0-dev.264"
|
{robotcode_robot-2.9.0.dev214 → robotcode_robot-2.9.0.dev264}/src/robotcode/robot/config/model.py
RENAMED
|
@@ -127,7 +127,8 @@ class Expression:
|
|
|
127
127
|
expr: str = field(
|
|
128
128
|
description="""\
|
|
129
129
|
Expression to evaluate. This must be a Python "eval" expression.
|
|
130
|
-
|
|
130
|
+
Only certain names are available, to keep expressions simple queries.
|
|
131
|
+
This is not a sandbox: like the rest of the project, the configuration must come from a trusted source.
|
|
131
132
|
|
|
132
133
|
Examples:
|
|
133
134
|
```toml
|
|
@@ -180,7 +181,8 @@ class Condition:
|
|
|
180
181
|
if_: str = field(
|
|
181
182
|
description="""\
|
|
182
183
|
Condition to evaluate. This must be a Python "eval" expression.
|
|
183
|
-
|
|
184
|
+
Only certain names are available, to keep expressions simple queries.
|
|
185
|
+
This is not a sandbox: like the rest of the project, the configuration must come from a trusted source.
|
|
184
186
|
|
|
185
187
|
Examples:
|
|
186
188
|
```toml
|
|
@@ -35,6 +35,12 @@ def private_keyword_call_message(keyword: KeywordDoc, source: Optional[str]) ->
|
|
|
35
35
|
return None
|
|
36
36
|
|
|
37
37
|
|
|
38
|
+
def deprecated_keyword_message(keyword: KeywordDoc) -> str:
|
|
39
|
+
"""The `DeprecatedKeyword` message for a call of `keyword`, in the form of Robot Framework's warning."""
|
|
40
|
+
reason = keyword.deprecated_message
|
|
41
|
+
return f"Keyword '{keyword.name}' is deprecated.{f' {reason}' if reason else ''}"
|
|
42
|
+
|
|
43
|
+
|
|
38
44
|
# The section headers of keyword documentation, as Robot Framework 7.5 recognizes them.
|
|
39
45
|
_DOC_SECTION_HEADER = re.compile(
|
|
40
46
|
r"[*_]*(args|arguments|parameters|returns|return|yields|raises|raise|tags)[*_]*::?[*_]*(\s+.*)?",
|
|
@@ -41,7 +41,7 @@ from ..utils import RF_VERSION
|
|
|
41
41
|
from ..utils.markdown_blocks import RobotBlock, find_robot_blocks, read_markdown_data
|
|
42
42
|
from ..utils.stubs import Languages
|
|
43
43
|
from .data_cache import CacheSection
|
|
44
|
-
from .imports_manager import ImportsManager, NamespaceMetaData
|
|
44
|
+
from .imports_manager import ImportsManager, NamespaceMetaData, model_doc_cache_source
|
|
45
45
|
from .library_doc import LibraryDoc
|
|
46
46
|
from .namespace import (
|
|
47
47
|
DocumentType,
|
|
@@ -727,7 +727,7 @@ class DocumentsCacheHelper:
|
|
|
727
727
|
try:
|
|
728
728
|
for section, source_of in (
|
|
729
729
|
(CacheSection.NAMESPACE, _namespace_cache_source),
|
|
730
|
-
(CacheSection.RESOURCE,
|
|
730
|
+
(CacheSection.RESOURCE, model_doc_cache_source),
|
|
731
731
|
):
|
|
732
732
|
missing = [
|
|
733
733
|
entry.entry_name
|
|
@@ -737,7 +737,7 @@ class DocumentsCacheHelper:
|
|
|
737
737
|
if not missing:
|
|
738
738
|
continue
|
|
739
739
|
if section == CacheSection.RESOURCE:
|
|
740
|
-
imports_manager.remove_cached_resource_docs(missing)
|
|
740
|
+
imports_manager.remove_cached_resource_docs(sorted({model_doc_cache_source(m) for m in missing}))
|
|
741
741
|
else:
|
|
742
742
|
data_cache.remove_entries(section, missing)
|
|
743
743
|
except (SystemExit, KeyboardInterrupt):
|
|
@@ -26,6 +26,12 @@ class Error:
|
|
|
26
26
|
VARIABLES_TIMEOUT_ERROR = "VariablesTimeoutError"
|
|
27
27
|
LIBRARY_EXIT_ERROR = "LibraryExitError"
|
|
28
28
|
VARIABLES_EXIT_ERROR = "VariablesExitError"
|
|
29
|
+
LIBRARY_NOT_FOUND = "LibraryNotFound"
|
|
30
|
+
RESOURCE_NOT_FOUND = "ResourceNotFound"
|
|
31
|
+
VARIABLES_NOT_FOUND = "VariablesNotFound"
|
|
32
|
+
LIBRARY_IMPORT_FAILED = "LibraryImportFailed"
|
|
33
|
+
RESOURCE_IMPORT_FAILED = "ResourceImportFailed"
|
|
34
|
+
VARIABLES_IMPORT_FAILED = "VariablesImportFailed"
|
|
29
35
|
DEPRECATED_KEYWORD = "DeprecatedKeyword"
|
|
30
36
|
KEYWORD_CONTAINS_ERRORS = "KeywordContainsErrors"
|
|
31
37
|
RESERVED_KEYWORD = "ReservedKeyword"
|
|
@@ -13,6 +13,7 @@ from dataclasses import dataclass, field
|
|
|
13
13
|
from pathlib import Path
|
|
14
14
|
from typing import Any, Dict, Iterable, List, Optional, Tuple, Union
|
|
15
15
|
|
|
16
|
+
from robot.errors import DataError
|
|
16
17
|
from robotcode.core.lsp.types import (
|
|
17
18
|
Diagnostic,
|
|
18
19
|
DiagnosticRelatedInformation,
|
|
@@ -23,9 +24,10 @@ from robotcode.core.lsp.types import (
|
|
|
23
24
|
)
|
|
24
25
|
from robotcode.core.uri import Uri
|
|
25
26
|
from robotcode.core.utils.logging import LoggingDescriptor
|
|
26
|
-
from robotcode.core.utils.path import file_id, same_file_id
|
|
27
|
+
from robotcode.core.utils.path import file_id, normalized_path, same_file_id
|
|
27
28
|
|
|
28
29
|
from ..utils import RF_VERSION
|
|
30
|
+
from ..utils.robot_path import ImportNotFoundError
|
|
29
31
|
from .entities import (
|
|
30
32
|
Import,
|
|
31
33
|
LibraryEntry,
|
|
@@ -60,18 +62,47 @@ class _NameSpaceError(Exception):
|
|
|
60
62
|
pass
|
|
61
63
|
|
|
62
64
|
|
|
65
|
+
_ROBOTCODE_CODES = frozenset(value for name, value in vars(Error).items() if name.isupper() and isinstance(value, str))
|
|
66
|
+
|
|
67
|
+
_NOT_FOUND_CODES = {
|
|
68
|
+
LibraryImport: Error.LIBRARY_NOT_FOUND,
|
|
69
|
+
ResourceImport: Error.RESOURCE_NOT_FOUND,
|
|
70
|
+
VariablesImport: Error.VARIABLES_NOT_FOUND,
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
_IMPORT_FAILED_CODES = {
|
|
74
|
+
LibraryImport: Error.LIBRARY_IMPORT_FAILED,
|
|
75
|
+
ResourceImport: Error.RESOURCE_IMPORT_FAILED,
|
|
76
|
+
VariablesImport: Error.VARIABLES_IMPORT_FAILED,
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
def _failed_import_code(imp: Import, code: str, not_found: bool = False) -> str:
|
|
81
|
+
"""The code of a failed import whose error has `code`: an exception's class name or one of RobotCode's codes."""
|
|
82
|
+
if not_found:
|
|
83
|
+
return _NOT_FOUND_CODES.get(type(imp), code)
|
|
84
|
+
if code in _ROBOTCODE_CODES:
|
|
85
|
+
return code
|
|
86
|
+
return _IMPORT_FAILED_CODES.get(type(imp), code)
|
|
87
|
+
|
|
88
|
+
|
|
63
89
|
@dataclass(frozen=True, slots=True)
|
|
64
90
|
class FailedImport:
|
|
65
91
|
"""An import whose resolution raised or whose library or variables documentation has errors.
|
|
66
92
|
|
|
67
93
|
`base_dir` and `variables` are what its file or module was looked up with.
|
|
68
|
-
`
|
|
94
|
+
`source` is the normalized path that lookup found, or `None` when it found nothing.
|
|
69
95
|
"""
|
|
70
96
|
|
|
71
97
|
imp: Import
|
|
72
98
|
base_dir: str
|
|
73
99
|
variables: Dict[str, Any]
|
|
74
|
-
|
|
100
|
+
source: Optional[str]
|
|
101
|
+
|
|
102
|
+
@property
|
|
103
|
+
def found(self) -> bool:
|
|
104
|
+
"""Whether the lookup found the file or module, so that only loading failed."""
|
|
105
|
+
return self.source is not None
|
|
75
106
|
|
|
76
107
|
|
|
77
108
|
@dataclass(frozen=True, slots=True)
|
|
@@ -186,8 +217,10 @@ class ImportResolver:
|
|
|
186
217
|
|
|
187
218
|
def _record_failed_import(self, imp: Import, base_dir: str) -> None:
|
|
188
219
|
# _refresh_variables replaces the dict, so the import keeps the variables it was resolved with
|
|
189
|
-
found = self._imports_manager.find_import_source(imp, base_dir, self._variables)
|
|
190
|
-
self._failed_imports.append(
|
|
220
|
+
found = self._imports_manager.find_import_source(imp, base_dir, self._variables)
|
|
221
|
+
self._failed_imports.append(
|
|
222
|
+
FailedImport(imp, base_dir, self._variables, str(normalized_path(found)) if found is not None else None)
|
|
223
|
+
)
|
|
191
224
|
|
|
192
225
|
def _append_diagnostics(
|
|
193
226
|
self,
|
|
@@ -346,7 +379,7 @@ class ImportResolver:
|
|
|
346
379
|
message=str(e),
|
|
347
380
|
severity=DiagnosticSeverity.ERROR,
|
|
348
381
|
source=DIAGNOSTICS_SOURCE_NAME,
|
|
349
|
-
code=type(e).__qualname__,
|
|
382
|
+
code=_failed_import_code(imp, type(e).__qualname__, isinstance(e, ImportNotFoundError)),
|
|
350
383
|
)
|
|
351
384
|
elif parent_import is not None:
|
|
352
385
|
self._append_diagnostics(
|
|
@@ -591,6 +624,14 @@ class ImportResolver:
|
|
|
591
624
|
)
|
|
592
625
|
return
|
|
593
626
|
|
|
627
|
+
# Robot Framework refuses the file: the import keeps its entry for navigation, but nothing of the file
|
|
628
|
+
# reaches the scope or the keyword lookup
|
|
629
|
+
if resource_doc.import_error is not None:
|
|
630
|
+
entry.import_range = imp.range
|
|
631
|
+
entry.import_source = imp.source
|
|
632
|
+
self._import_entries[imp] = entry
|
|
633
|
+
raise DataError(resource_doc.import_error.message)
|
|
634
|
+
|
|
594
635
|
# Already imported check
|
|
595
636
|
already_imported = next(
|
|
596
637
|
(
|
|
@@ -784,7 +825,7 @@ class ImportResolver:
|
|
|
784
825
|
message=err.message,
|
|
785
826
|
severity=DiagnosticSeverity.ERROR,
|
|
786
827
|
source=DIAGNOSTICS_SOURCE_NAME,
|
|
787
|
-
code=err.type_name,
|
|
828
|
+
code=_failed_import_code(imp, err.type_name),
|
|
788
829
|
)
|
|
789
830
|
elif entry.library_doc.errors is not None:
|
|
790
831
|
for err in entry.library_doc.errors:
|
|
@@ -793,7 +834,7 @@ class ImportResolver:
|
|
|
793
834
|
message=err.message,
|
|
794
835
|
severity=DiagnosticSeverity.ERROR,
|
|
795
836
|
source=DIAGNOSTICS_SOURCE_NAME,
|
|
796
|
-
code=err.type_name,
|
|
837
|
+
code=_failed_import_code(imp, err.type_name),
|
|
797
838
|
)
|
|
798
839
|
|
|
799
840
|
if entry.library_doc.loaded_without_arguments:
|
|
@@ -58,7 +58,7 @@ from robotcode.core.utils.path import (
|
|
|
58
58
|
from ..__version__ import __version__
|
|
59
59
|
from ..language_definitions import ROBOT_LANGUAGE_IDS
|
|
60
60
|
from ..utils import RF_VERSION
|
|
61
|
-
from ..utils.robot_path import find_file_ex
|
|
61
|
+
from ..utils.robot_path import ImportNotFoundError, find_file_ex
|
|
62
62
|
from ..utils.stubs import Languages
|
|
63
63
|
from ..utils.variables import contains_variable, environment_value_hash
|
|
64
64
|
from .data_cache import CACHE_DIR_NAME, CacheSection, build_cache_dir
|
|
@@ -588,6 +588,16 @@ class _VariablesEntry(_ImportEntry):
|
|
|
588
588
|
return self.get_libdoc_with_meta()[0]
|
|
589
589
|
|
|
590
590
|
|
|
591
|
+
def _model_doc_cache_key(source: str, suite_model: bool) -> str:
|
|
592
|
+
"""The key of a model doc: a doc built from a suite model has its own, see `get_libdoc_from_model`."""
|
|
593
|
+
return f"{source}\nsuite" if suite_model else source
|
|
594
|
+
|
|
595
|
+
|
|
596
|
+
def model_doc_cache_source(entry_name: str) -> str:
|
|
597
|
+
"""The source of a model doc entry in the disk cache, see `_model_doc_cache_key`."""
|
|
598
|
+
return entry_name.split("\n", 1)[0]
|
|
599
|
+
|
|
600
|
+
|
|
591
601
|
@dataclass(slots=True)
|
|
592
602
|
class LibraryMetaData:
|
|
593
603
|
name: Optional[str]
|
|
@@ -598,7 +608,9 @@ class LibraryMetaData:
|
|
|
598
608
|
|
|
599
609
|
file_infos: Optional[Dict[str, DiskInfo]] = None
|
|
600
610
|
|
|
601
|
-
|
|
611
|
+
# not compared: a failed load of the same file must not make a stored namespace look outdated;
|
|
612
|
+
# the cache reads check it explicitly
|
|
613
|
+
has_errors: bool = field(default=False, compare=False)
|
|
602
614
|
|
|
603
615
|
@property
|
|
604
616
|
def cache_key(self) -> str:
|
|
@@ -1137,9 +1149,10 @@ class ImportsManager:
|
|
|
1137
1149
|
|
|
1138
1150
|
``sources`` are normalized paths, as the entries of the cache name them.
|
|
1139
1151
|
"""
|
|
1140
|
-
for source in sources
|
|
1141
|
-
|
|
1142
|
-
|
|
1152
|
+
keys = [_model_doc_cache_key(source, suite_model) for source in sources for suite_model in (False, True)]
|
|
1153
|
+
for key in keys:
|
|
1154
|
+
self._model_docs_by_source.pop(key, None)
|
|
1155
|
+
self.data_cache.remove_entries(CacheSection.RESOURCE, keys)
|
|
1143
1156
|
|
|
1144
1157
|
@_logger.call
|
|
1145
1158
|
def get_command_line_variables(self) -> List[VariableDefinition]:
|
|
@@ -1223,7 +1236,11 @@ class ImportsManager:
|
|
|
1223
1236
|
Range.zero(),
|
|
1224
1237
|
f"Error in command line variable file '{name}({', '.join(args)})': {e}",
|
|
1225
1238
|
DiagnosticSeverity.ERROR,
|
|
1226
|
-
|
|
1239
|
+
(
|
|
1240
|
+
DiagnosticError.VARIABLES_NOT_FOUND
|
|
1241
|
+
if isinstance(e, ImportNotFoundError)
|
|
1242
|
+
else type(e).__name__
|
|
1243
|
+
),
|
|
1227
1244
|
)
|
|
1228
1245
|
)
|
|
1229
1246
|
except (SystemExit, KeyboardInterrupt):
|
|
@@ -1901,7 +1918,9 @@ class ImportsManager:
|
|
|
1901
1918
|
if entry is not None and entry.meta is not None:
|
|
1902
1919
|
if entry.meta.has_errors:
|
|
1903
1920
|
self._logger.debug(
|
|
1904
|
-
lambda:
|
|
1921
|
+
lambda: (
|
|
1922
|
+
f"Saved library spec for {name}{args!r} is not used because its load reported errors"
|
|
1923
|
+
),
|
|
1905
1924
|
context_name="import",
|
|
1906
1925
|
)
|
|
1907
1926
|
elif entry.meta == meta:
|
|
@@ -2016,6 +2035,8 @@ class ImportsManager:
|
|
|
2016
2035
|
model: ast.AST,
|
|
2017
2036
|
source: str,
|
|
2018
2037
|
meta: Optional[RobotFileMeta] = None,
|
|
2038
|
+
*,
|
|
2039
|
+
suite_model: bool = False,
|
|
2019
2040
|
) -> ResourceDoc:
|
|
2020
2041
|
"""Build (or load from cache) the ResourceDoc for a parsed model.
|
|
2021
2042
|
|
|
@@ -2031,10 +2052,10 @@ class ImportsManager:
|
|
|
2031
2052
|
return entry[source]
|
|
2032
2053
|
|
|
2033
2054
|
if meta is not None and meta.trusted:
|
|
2034
|
-
result = self._get_model_doc_cached(source, meta)
|
|
2055
|
+
result = self._get_model_doc_cached(source, meta, suite_model)
|
|
2035
2056
|
if result is None:
|
|
2036
2057
|
result = get_model_doc(model=model, source=source)
|
|
2037
|
-
self._save_model_doc_cache(source, result, meta)
|
|
2058
|
+
self._save_model_doc_cache(source, result, meta, suite_model)
|
|
2038
2059
|
else:
|
|
2039
2060
|
result = get_model_doc(model=model, source=source)
|
|
2040
2061
|
|
|
@@ -2054,16 +2075,19 @@ class ImportsManager:
|
|
|
2054
2075
|
return None
|
|
2055
2076
|
return RobotFileMeta(normalized, info)
|
|
2056
2077
|
|
|
2057
|
-
def _get_model_doc_cached(
|
|
2058
|
-
|
|
2078
|
+
def _get_model_doc_cached(
|
|
2079
|
+
self, source: str, meta: RobotFileMeta, suite_model: bool = False
|
|
2080
|
+
) -> Optional[ResourceDoc]:
|
|
2081
|
+
key = _model_doc_cache_key(meta.source, suite_model)
|
|
2082
|
+
known = self._model_docs_by_source.get(key)
|
|
2059
2083
|
if known is not None and known[0] == meta:
|
|
2060
2084
|
return known[1]
|
|
2061
2085
|
|
|
2062
2086
|
try:
|
|
2063
|
-
entry = self.data_cache.read_entry(CacheSection.RESOURCE,
|
|
2087
|
+
entry = self.data_cache.read_entry(CacheSection.RESOURCE, key, RobotFileMeta, ResourceDoc)
|
|
2064
2088
|
# a doc read with other language settings would hold what the file defines under those settings
|
|
2065
2089
|
if entry is not None and entry.meta == replace(meta, languages=self._languages_fingerprint):
|
|
2066
|
-
self._model_docs_by_source[
|
|
2090
|
+
self._model_docs_by_source[key] = (meta, entry.data)
|
|
2067
2091
|
return entry.data
|
|
2068
2092
|
except (SystemExit, KeyboardInterrupt):
|
|
2069
2093
|
raise
|
|
@@ -2076,12 +2100,15 @@ class ImportsManager:
|
|
|
2076
2100
|
|
|
2077
2101
|
return None
|
|
2078
2102
|
|
|
2079
|
-
def _save_model_doc_cache(
|
|
2080
|
-
self
|
|
2103
|
+
def _save_model_doc_cache(
|
|
2104
|
+
self, source: str, result: ResourceDoc, meta: "RobotFileMeta", suite_model: bool = False
|
|
2105
|
+
) -> None:
|
|
2106
|
+
key = _model_doc_cache_key(meta.source, suite_model)
|
|
2107
|
+
self._model_docs_by_source[key] = (meta, result)
|
|
2081
2108
|
|
|
2082
2109
|
try:
|
|
2083
2110
|
self.data_cache.save_entry(
|
|
2084
|
-
CacheSection.RESOURCE,
|
|
2111
|
+
CacheSection.RESOURCE, key, replace(meta, languages=self._languages_fingerprint), result
|
|
2085
2112
|
)
|
|
2086
2113
|
except (SystemExit, KeyboardInterrupt):
|
|
2087
2114
|
raise
|
|
@@ -2115,8 +2142,16 @@ class ImportsManager:
|
|
|
2115
2142
|
entry = self.data_cache.read_entry(
|
|
2116
2143
|
CacheSection.VARIABLES, meta.cache_key_for_args(args), LibraryMetaData, VariablesDoc
|
|
2117
2144
|
)
|
|
2118
|
-
if entry is not None and entry.meta
|
|
2119
|
-
|
|
2145
|
+
if entry is not None and entry.meta is not None:
|
|
2146
|
+
if entry.meta.has_errors:
|
|
2147
|
+
self._logger.debug(
|
|
2148
|
+
lambda: (
|
|
2149
|
+
f"Saved variables spec for {name}{args!r} is not used because its load reported errors"
|
|
2150
|
+
),
|
|
2151
|
+
context_name="import",
|
|
2152
|
+
)
|
|
2153
|
+
elif entry.meta == meta:
|
|
2154
|
+
return entry.data, meta
|
|
2120
2155
|
except (SystemExit, KeyboardInterrupt):
|
|
2121
2156
|
raise
|
|
2122
2157
|
except BaseException as e:
|
|
@@ -2157,6 +2192,9 @@ class ImportsManager:
|
|
|
2157
2192
|
None,
|
|
2158
2193
|
)
|
|
2159
2194
|
|
|
2195
|
+
if meta is not None:
|
|
2196
|
+
meta.has_errors = bool(result.errors)
|
|
2197
|
+
|
|
2160
2198
|
self._save_import_cache(CacheSection.VARIABLES, meta, result, "variables", name, args)
|
|
2161
2199
|
|
|
2162
2200
|
return result, meta
|
|
@@ -16,6 +16,7 @@ from contextlib import contextmanager
|
|
|
16
16
|
from dataclasses import MISSING, dataclass, field, fields
|
|
17
17
|
from enum import Enum
|
|
18
18
|
from pathlib import Path
|
|
19
|
+
from types import ModuleType
|
|
19
20
|
from typing import (
|
|
20
21
|
AbstractSet,
|
|
21
22
|
Any,
|
|
@@ -66,6 +67,7 @@ from robot.utils.escaping import unescape
|
|
|
66
67
|
from robot.utils.htmlformatters import HeaderFormatter as RobotHeaderFormatter
|
|
67
68
|
from robot.utils.importer import Importer
|
|
68
69
|
from robot.utils.robotpath import find_file as robot_find_file
|
|
70
|
+
from robot.utils.text import getshortdoc
|
|
69
71
|
from robot.variables import Variables
|
|
70
72
|
from robot.variables.filesetter import PythonImporter, YamlImporter
|
|
71
73
|
from robot.variables.finders import VariableFinder
|
|
@@ -106,6 +108,7 @@ from ..utils.markdown_docs import (
|
|
|
106
108
|
from ..utils.markdownformatter import MarkDownFormatter, NameLinker
|
|
107
109
|
from ..utils.match import normalize, normalize_namespace
|
|
108
110
|
from ..utils.robot_patching import patch_variable_not_found
|
|
111
|
+
from ..utils.robot_path import ImportNotFoundError
|
|
109
112
|
from ..utils.variables import contains_variable, replace_curdir_in_variable_values, search_variable
|
|
110
113
|
from .entities import (
|
|
111
114
|
ArgumentDefinition,
|
|
@@ -119,6 +122,7 @@ from .entities import (
|
|
|
119
122
|
VariableDefinition,
|
|
120
123
|
VariablesImport,
|
|
121
124
|
)
|
|
125
|
+
from .errors import Error as DiagnosticError
|
|
122
126
|
|
|
123
127
|
if RF_VERSION < (7, 0):
|
|
124
128
|
from robot.running.handlers import _PythonHandler, _PythonInitHandler # pyright: ignore[reportMissingImports]
|
|
@@ -1110,9 +1114,13 @@ class KeywordDoc(SourceEntity):
|
|
|
1110
1114
|
|
|
1111
1115
|
@property
|
|
1112
1116
|
def deprecated_message(self) -> str:
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1117
|
+
# Robot Framework's run-time warning takes the text after the closing `*` of the short doc;
|
|
1118
|
+
# BuiltIn writes its reason between the asterisks, so that is the fallback.
|
|
1119
|
+
short_doc: str = getshortdoc(self.doc)
|
|
1120
|
+
if not short_doc.startswith("*DEPRECATED") or "*" not in short_doc[1:]:
|
|
1121
|
+
return ""
|
|
1122
|
+
_, marker, after = short_doc.split("*", 2)
|
|
1123
|
+
return after.strip() or marker[len("DEPRECATED") :].strip()
|
|
1116
1124
|
|
|
1117
1125
|
@property
|
|
1118
1126
|
def name_range(self) -> Range:
|
|
@@ -2259,6 +2267,8 @@ class ResourceDoc(LibraryDoc):
|
|
|
2259
2267
|
|
|
2260
2268
|
resource_imports: List[Import] = field(default_factory=list, compare=False)
|
|
2261
2269
|
resource_variables: List[VariableDefinition] = field(default_factory=list, compare=False)
|
|
2270
|
+
# why Robot Framework refuses to import the file as a resource; not in `errors`, which the file reports itself
|
|
2271
|
+
import_error: Optional[Error] = field(default=None, compare=False)
|
|
2262
2272
|
|
|
2263
2273
|
|
|
2264
2274
|
@functools.lru_cache(maxsize=1024)
|
|
@@ -2688,6 +2698,50 @@ class IgnoreEasterEggLibraryWarning(Exception): # noqa: N818
|
|
|
2688
2698
|
pass
|
|
2689
2699
|
|
|
2690
2700
|
|
|
2701
|
+
def _find_import_file(name: str, base_dir: str, file_type: str) -> str:
|
|
2702
|
+
try:
|
|
2703
|
+
return cast(str, robot_find_file(name, base_dir or ".", file_type))
|
|
2704
|
+
except DataError as e:
|
|
2705
|
+
raise ImportNotFoundError(str(e)) from e
|
|
2706
|
+
|
|
2707
|
+
|
|
2708
|
+
def _mark_not_found(error: Error, exception: BaseException, import_name: str, code: str) -> Error:
|
|
2709
|
+
"""Give `error` the code `code` when the import's file, or the module imported by name, was not found.
|
|
2710
|
+
|
|
2711
|
+
`ImportNotFoundError` comes from the lookup of a variable file; a library's file is looked up before the
|
|
2712
|
+
load. Robot Framework's `Importer` raises its `DataError` while handling the original exception, so that
|
|
2713
|
+
exception is the first link of the `__context__` chain that isn't a `DataError`. A missing module of
|
|
2714
|
+
another name is a dependency of the imported file and keeps the error as it is. For `module.Name`, the
|
|
2715
|
+
`Importer` takes `Name` from the module with `getattr`, so a name the module doesn't contain is an
|
|
2716
|
+
`AttributeError` on that module.
|
|
2717
|
+
"""
|
|
2718
|
+
cause: Optional[BaseException] = exception
|
|
2719
|
+
seen: Set[int] = set()
|
|
2720
|
+
while isinstance(cause, DataError) and id(cause) not in seen:
|
|
2721
|
+
seen.add(id(cause))
|
|
2722
|
+
cause = cause.__context__
|
|
2723
|
+
module_name, _, member_name = import_name.rpartition(".")
|
|
2724
|
+
if (
|
|
2725
|
+
isinstance(exception, ImportNotFoundError)
|
|
2726
|
+
or (
|
|
2727
|
+
isinstance(cause, ModuleNotFoundError)
|
|
2728
|
+
and cause.name is not None
|
|
2729
|
+
and (import_name == cause.name or import_name.startswith(cause.name + "."))
|
|
2730
|
+
)
|
|
2731
|
+
or (
|
|
2732
|
+
isinstance(cause, AttributeError)
|
|
2733
|
+
and isinstance(cause.obj, ModuleType)
|
|
2734
|
+
and cause.obj.__name__ == module_name
|
|
2735
|
+
and cause.name == member_name
|
|
2736
|
+
)
|
|
2737
|
+
):
|
|
2738
|
+
error.type_name = code
|
|
2739
|
+
# the import's name is wrong, not the file of the module the error would otherwise point to
|
|
2740
|
+
error.source = None
|
|
2741
|
+
error.line_no = None
|
|
2742
|
+
return error
|
|
2743
|
+
|
|
2744
|
+
|
|
2691
2745
|
def _find_library_internal(
|
|
2692
2746
|
name: str,
|
|
2693
2747
|
working_dir: str = ".",
|
|
@@ -2712,7 +2766,7 @@ def _find_library_internal(
|
|
|
2712
2766
|
result = name
|
|
2713
2767
|
|
|
2714
2768
|
if is_library_by_path(result):
|
|
2715
|
-
result =
|
|
2769
|
+
result = _find_import_file(result, base_dir, "Library")
|
|
2716
2770
|
|
|
2717
2771
|
return (result, robot_variables)
|
|
2718
2772
|
|
|
@@ -2848,20 +2902,25 @@ def get_library_doc(
|
|
|
2848
2902
|
),
|
|
2849
2903
|
module_spec=module_spec,
|
|
2850
2904
|
errors=[
|
|
2851
|
-
|
|
2852
|
-
|
|
2853
|
-
|
|
2854
|
-
|
|
2855
|
-
|
|
2856
|
-
|
|
2857
|
-
|
|
2858
|
-
|
|
2859
|
-
|
|
2860
|
-
|
|
2861
|
-
|
|
2862
|
-
|
|
2863
|
-
|
|
2905
|
+
_mark_not_found(
|
|
2906
|
+
error_from_exception(
|
|
2907
|
+
e,
|
|
2908
|
+
(
|
|
2909
|
+
source or module_spec.origin
|
|
2910
|
+
if module_spec is not None and module_spec.origin
|
|
2911
|
+
else import_name
|
|
2912
|
+
if is_library_by_path(import_name)
|
|
2913
|
+
else None
|
|
2914
|
+
),
|
|
2915
|
+
(
|
|
2916
|
+
1
|
|
2917
|
+
if source is not None or (module_spec is not None and module_spec.origin is not None)
|
|
2918
|
+
else None
|
|
2919
|
+
),
|
|
2864
2920
|
),
|
|
2921
|
+
e,
|
|
2922
|
+
import_name,
|
|
2923
|
+
DiagnosticError.LIBRARY_NOT_FOUND,
|
|
2865
2924
|
)
|
|
2866
2925
|
],
|
|
2867
2926
|
python_path=sys.path,
|
|
@@ -2902,13 +2961,9 @@ def get_library_doc(
|
|
|
2902
2961
|
raise
|
|
2903
2962
|
except BaseException as e:
|
|
2904
2963
|
lib = None
|
|
2905
|
-
|
|
2906
|
-
|
|
2907
|
-
|
|
2908
|
-
source or module_spec.origin if module_spec is not None else None,
|
|
2909
|
-
1 if source is not None or (module_spec is not None and module_spec.origin is not None) else None,
|
|
2910
|
-
)
|
|
2911
|
-
)
|
|
2964
|
+
# no default source: only a traceback makes it an error inside the library's file, wrong
|
|
2965
|
+
# arguments or a `DataError` from `__init__` are errors of the import, by name and by path alike
|
|
2966
|
+
errors.append(error_from_exception(e, None, None))
|
|
2912
2967
|
|
|
2913
2968
|
if args:
|
|
2914
2969
|
try:
|
|
@@ -3276,7 +3331,7 @@ def _find_variables_internal(
|
|
|
3276
3331
|
result = name
|
|
3277
3332
|
|
|
3278
3333
|
if is_variables_by_path(result):
|
|
3279
|
-
result =
|
|
3334
|
+
result = _find_import_file(result, base_dir, "Variables")
|
|
3280
3335
|
|
|
3281
3336
|
return result
|
|
3282
3337
|
|
|
@@ -3545,16 +3600,23 @@ def get_variables_doc(
|
|
|
3545
3600
|
source=source or module_spec.origin if module_spec is not None else import_name,
|
|
3546
3601
|
module_spec=module_spec,
|
|
3547
3602
|
errors=[
|
|
3548
|
-
|
|
3549
|
-
|
|
3550
|
-
|
|
3551
|
-
|
|
3552
|
-
|
|
3553
|
-
|
|
3554
|
-
|
|
3555
|
-
|
|
3603
|
+
_mark_not_found(
|
|
3604
|
+
error_from_exception(
|
|
3605
|
+
e,
|
|
3606
|
+
(
|
|
3607
|
+
source or module_spec.origin
|
|
3608
|
+
if module_spec is not None and module_spec.origin
|
|
3609
|
+
else import_name
|
|
3610
|
+
if is_variables_by_path(import_name)
|
|
3611
|
+
else None
|
|
3612
|
+
),
|
|
3613
|
+
1
|
|
3614
|
+
if source is not None or (module_spec is not None and module_spec.origin is not None)
|
|
3615
|
+
else None,
|
|
3556
3616
|
),
|
|
3557
|
-
|
|
3617
|
+
e,
|
|
3618
|
+
import_name,
|
|
3619
|
+
DiagnosticError.VARIABLES_NOT_FOUND,
|
|
3558
3620
|
)
|
|
3559
3621
|
],
|
|
3560
3622
|
python_path=sys.path,
|
|
@@ -3578,7 +3640,7 @@ def find_file(
|
|
|
3578
3640
|
except DataError as error:
|
|
3579
3641
|
raise DataError(f"Replacing variables from setting '{file_type}' failed: {error}")
|
|
3580
3642
|
|
|
3581
|
-
return
|
|
3643
|
+
return _find_import_file(name, base_dir, file_type)
|
|
3582
3644
|
|
|
3583
3645
|
|
|
3584
3646
|
class CompleteResultKind(Enum):
|
|
@@ -4171,7 +4233,7 @@ def get_model_doc(
|
|
|
4171
4233
|
else:
|
|
4172
4234
|
lib = res
|
|
4173
4235
|
|
|
4174
|
-
|
|
4236
|
+
doc = _build_resource_doc(
|
|
4175
4237
|
lib,
|
|
4176
4238
|
source,
|
|
4177
4239
|
keyword_name_nodes=res_builder.keyword_name_nodes,
|
|
@@ -4179,6 +4241,30 @@ def get_model_doc(
|
|
|
4179
4241
|
resource_imports=res_builder.imports,
|
|
4180
4242
|
resource_variables=res_builder.variables,
|
|
4181
4243
|
)
|
|
4244
|
+
doc.import_error = _resource_import_error(model, source)
|
|
4245
|
+
return doc
|
|
4246
|
+
|
|
4247
|
+
|
|
4248
|
+
# Robot Framework's builder refuses a resource file at an invalid section header from 6.1 on, and at a fatal
|
|
4249
|
+
# error token (a test or task section) before
|
|
4250
|
+
_RESOURCE_FATAL_TOKEN = RobotToken.INVALID_HEADER if RF_VERSION >= (6, 1) else RobotToken.FATAL_ERROR
|
|
4251
|
+
|
|
4252
|
+
|
|
4253
|
+
def _resource_import_error(model: ast.AST, source: str) -> Optional[Error]:
|
|
4254
|
+
# the lexer puts these tokens into a section header or a statement directly in a section
|
|
4255
|
+
for section in getattr(model, "sections", ()):
|
|
4256
|
+
for statement in (section.header, *section.body):
|
|
4257
|
+
if not isinstance(statement, Statement):
|
|
4258
|
+
continue
|
|
4259
|
+
token = statement.get_token(_RESOURCE_FATAL_TOKEN)
|
|
4260
|
+
if token is not None:
|
|
4261
|
+
return Error(
|
|
4262
|
+
message=f"Error in file '{source}' on line {token.lineno}: {token.error}",
|
|
4263
|
+
type_name="DataError",
|
|
4264
|
+
source=source,
|
|
4265
|
+
line_no=token.lineno,
|
|
4266
|
+
)
|
|
4267
|
+
return None
|
|
4182
4268
|
|
|
4183
4269
|
|
|
4184
4270
|
def get_resource_doc_from_resource(resource: Any, source: Optional[str] = None) -> ResourceDoc:
|
|
@@ -460,7 +460,10 @@ class Namespace:
|
|
|
460
460
|
|
|
461
461
|
def _on_resources_changed(self, sender: Any, resources: Any) -> None:
|
|
462
462
|
for p in resources:
|
|
463
|
-
if any(e for e in self.resources.values() if e.library_doc.source == p.source)
|
|
463
|
+
if any(e for e in self.resources.values() if e.library_doc.source == p.source) or (
|
|
464
|
+
# a resource file Robot Framework refused is not imported, but fixing it changes the result
|
|
465
|
+
p.source is not None and any(f.source == str(normalized_path(p.source)) for f in self._failed_imports)
|
|
466
|
+
):
|
|
464
467
|
self.invalidated(self)
|
|
465
468
|
return
|
|
466
469
|
|
|
@@ -799,7 +802,9 @@ class NamespaceBuilder:
|
|
|
799
802
|
if self._disk_info is not None
|
|
800
803
|
else None
|
|
801
804
|
)
|
|
802
|
-
library_doc = self._imports_manager.get_libdoc_from_model(
|
|
805
|
+
library_doc = self._imports_manager.get_libdoc_from_model(
|
|
806
|
+
self._model, self._source, source_meta, suite_model=self._document_type != DocumentType.RESOURCE
|
|
807
|
+
)
|
|
803
808
|
document_uri = (
|
|
804
809
|
self._document.document_uri if self._document is not None else str(Uri.from_path(self._source))
|
|
805
810
|
)
|
|
@@ -70,7 +70,7 @@ from ..utils.variables import (
|
|
|
70
70
|
)
|
|
71
71
|
from ..utils.visitor import Visitor
|
|
72
72
|
from .analyzer_result import AnalyzerResult
|
|
73
|
-
from .diagnostic_rules import private_keyword_call_message, tags_row_without_empty_row
|
|
73
|
+
from .diagnostic_rules import deprecated_keyword_message, private_keyword_call_message, tags_row_without_empty_row
|
|
74
74
|
from .entities import (
|
|
75
75
|
ArgumentDefinition,
|
|
76
76
|
BuiltInVariableDefinition,
|
|
@@ -897,8 +897,7 @@ class NamespaceAnalyzer(Visitor):
|
|
|
897
897
|
if result.is_deprecated:
|
|
898
898
|
self._append_diagnostics(
|
|
899
899
|
range=kw_range,
|
|
900
|
-
message=
|
|
901
|
-
f"{f': {result.deprecated_message}' if result.deprecated_message else ''}.",
|
|
900
|
+
message=deprecated_keyword_message(result),
|
|
902
901
|
severity=DiagnosticSeverity.HINT,
|
|
903
902
|
tags=[DiagnosticTag.DEPRECATED],
|
|
904
903
|
code=Error.DEPRECATED_KEYWORD,
|
|
@@ -107,7 +107,7 @@ from ...utils.variables import (
|
|
|
107
107
|
)
|
|
108
108
|
from ...utils.visitor import Visitor
|
|
109
109
|
from ..analyzer_result import AnalyzerResult
|
|
110
|
-
from ..diagnostic_rules import private_keyword_call_message, tags_row_without_empty_row
|
|
110
|
+
from ..diagnostic_rules import deprecated_keyword_message, private_keyword_call_message, tags_row_without_empty_row
|
|
111
111
|
from ..entities import (
|
|
112
112
|
ArgumentDefinition,
|
|
113
113
|
BuiltInVariableDefinition,
|
|
@@ -2241,8 +2241,7 @@ class SemanticAnalyzer(Visitor):
|
|
|
2241
2241
|
if result.is_deprecated:
|
|
2242
2242
|
self._append_diagnostics(
|
|
2243
2243
|
range=kw_range,
|
|
2244
|
-
message=
|
|
2245
|
-
f"{f': {result.deprecated_message}' if result.deprecated_message else ''}.",
|
|
2244
|
+
message=deprecated_keyword_message(result),
|
|
2246
2245
|
severity=DiagnosticSeverity.HINT,
|
|
2247
2246
|
tags=[DiagnosticTag.DEPRECATED],
|
|
2248
2247
|
code=Error.DEPRECATED_KEYWORD,
|
|
@@ -4,8 +4,15 @@ import sys
|
|
|
4
4
|
from os import PathLike
|
|
5
5
|
from typing import List, Optional, Union
|
|
6
6
|
|
|
7
|
+
from robot.errors import DataError
|
|
8
|
+
|
|
7
9
|
_PathLike = Union[str, "PathLike[str]"]
|
|
8
10
|
|
|
11
|
+
|
|
12
|
+
class ImportNotFoundError(DataError):
|
|
13
|
+
"""The file of a `Library`, `Resource` or `Variables` import does not exist."""
|
|
14
|
+
|
|
15
|
+
|
|
9
16
|
# Cache of sys.path entries that are valid directories.
|
|
10
17
|
# Populated lazily on first use; call invalidate_sys_path_cache()
|
|
11
18
|
# if sys.path changes during the process lifetime.
|
|
@@ -29,8 +36,6 @@ def find_file_ex(
|
|
|
29
36
|
basedir: _PathLike = ".",
|
|
30
37
|
file_type: Optional[str] = None,
|
|
31
38
|
) -> str:
|
|
32
|
-
from robot.errors import DataError
|
|
33
|
-
|
|
34
39
|
ret = _find_absolute_path(path) if os.path.isabs(path) else _find_relative_path(path, basedir)
|
|
35
40
|
if ret:
|
|
36
41
|
return ret
|
|
@@ -47,7 +52,7 @@ def find_file_ex(
|
|
|
47
52
|
else default
|
|
48
53
|
)
|
|
49
54
|
|
|
50
|
-
raise
|
|
55
|
+
raise ImportNotFoundError("%s '%s' does not exist." % (file_type, path))
|
|
51
56
|
|
|
52
57
|
|
|
53
58
|
def find_file(
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "2.9.0-dev.214"
|
|
File without changes
|
{robotcode_robot-2.9.0.dev214 → robotcode_robot-2.9.0.dev264}/src/robotcode/robot/__init__.py
RENAMED
|
File without changes
|
{robotcode_robot-2.9.0.dev214 → robotcode_robot-2.9.0.dev264}/src/robotcode/robot/config/__init__.py
RENAMED
|
File without changes
|
{robotcode_robot-2.9.0.dev214 → robotcode_robot-2.9.0.dev264}/src/robotcode/robot/config/loader.py
RENAMED
|
File without changes
|
{robotcode_robot-2.9.0.dev214 → robotcode_robot-2.9.0.dev264}/src/robotcode/robot/config/utils.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{robotcode_robot-2.9.0.dev214 → robotcode_robot-2.9.0.dev264}/src/robotcode/robot/utils/__init__.py
RENAMED
|
File without changes
|
{robotcode_robot-2.9.0.dev214 → robotcode_robot-2.9.0.dev264}/src/robotcode/robot/utils/ast.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{robotcode_robot-2.9.0.dev214 → robotcode_robot-2.9.0.dev264}/src/robotcode/robot/utils/match.py
RENAMED
|
File without changes
|
|
File without changes
|
{robotcode_robot-2.9.0.dev214 → robotcode_robot-2.9.0.dev264}/src/robotcode/robot/utils/stubs.py
RENAMED
|
File without changes
|
{robotcode_robot-2.9.0.dev214 → robotcode_robot-2.9.0.dev264}/src/robotcode/robot/utils/variables.py
RENAMED
|
File without changes
|
{robotcode_robot-2.9.0.dev214 → robotcode_robot-2.9.0.dev264}/src/robotcode/robot/utils/visitor.py
RENAMED
|
File without changes
|