robotcode-robot 0.97.0__tar.gz → 0.99.0__tar.gz

Sign up to get free protection for your applications and to get access to all the features.
Files changed (34) hide show
  1. {robotcode_robot-0.97.0 → robotcode_robot-0.99.0}/PKG-INFO +2 -2
  2. {robotcode_robot-0.97.0 → robotcode_robot-0.99.0}/pyproject.toml +1 -1
  3. robotcode_robot-0.99.0/src/robotcode/robot/__version__.py +1 -0
  4. {robotcode_robot-0.97.0 → robotcode_robot-0.99.0}/src/robotcode/robot/diagnostics/errors.py +1 -0
  5. {robotcode_robot-0.97.0 → robotcode_robot-0.99.0}/src/robotcode/robot/diagnostics/namespace.py +60 -6
  6. robotcode_robot-0.97.0/src/robotcode/robot/__version__.py +0 -1
  7. {robotcode_robot-0.97.0 → robotcode_robot-0.99.0}/.gitignore +0 -0
  8. {robotcode_robot-0.97.0 → robotcode_robot-0.99.0}/LICENSE.txt +0 -0
  9. {robotcode_robot-0.97.0 → robotcode_robot-0.99.0}/README.md +0 -0
  10. {robotcode_robot-0.97.0 → robotcode_robot-0.99.0}/src/robotcode/robot/__init__.py +0 -0
  11. {robotcode_robot-0.97.0 → robotcode_robot-0.99.0}/src/robotcode/robot/config/__init__.py +0 -0
  12. {robotcode_robot-0.97.0 → robotcode_robot-0.99.0}/src/robotcode/robot/config/loader.py +0 -0
  13. {robotcode_robot-0.97.0 → robotcode_robot-0.99.0}/src/robotcode/robot/config/model.py +0 -0
  14. {robotcode_robot-0.97.0 → robotcode_robot-0.99.0}/src/robotcode/robot/config/utils.py +0 -0
  15. {robotcode_robot-0.97.0 → robotcode_robot-0.99.0}/src/robotcode/robot/diagnostics/__init__.py +0 -0
  16. {robotcode_robot-0.97.0 → robotcode_robot-0.99.0}/src/robotcode/robot/diagnostics/data_cache.py +0 -0
  17. {robotcode_robot-0.97.0 → robotcode_robot-0.99.0}/src/robotcode/robot/diagnostics/diagnostics_modifier.py +0 -0
  18. {robotcode_robot-0.97.0 → robotcode_robot-0.99.0}/src/robotcode/robot/diagnostics/document_cache_helper.py +0 -0
  19. {robotcode_robot-0.97.0 → robotcode_robot-0.99.0}/src/robotcode/robot/diagnostics/entities.py +0 -0
  20. {robotcode_robot-0.97.0 → robotcode_robot-0.99.0}/src/robotcode/robot/diagnostics/imports_manager.py +0 -0
  21. {robotcode_robot-0.97.0 → robotcode_robot-0.99.0}/src/robotcode/robot/diagnostics/keyword_finder.py +0 -0
  22. {robotcode_robot-0.97.0 → robotcode_robot-0.99.0}/src/robotcode/robot/diagnostics/library_doc.py +0 -0
  23. {robotcode_robot-0.97.0 → robotcode_robot-0.99.0}/src/robotcode/robot/diagnostics/model_helper.py +0 -0
  24. {robotcode_robot-0.97.0 → robotcode_robot-0.99.0}/src/robotcode/robot/diagnostics/namespace_analyzer.py +0 -0
  25. {robotcode_robot-0.97.0 → robotcode_robot-0.99.0}/src/robotcode/robot/diagnostics/workspace_config.py +0 -0
  26. {robotcode_robot-0.97.0 → robotcode_robot-0.99.0}/src/robotcode/robot/py.typed +0 -0
  27. {robotcode_robot-0.97.0 → robotcode_robot-0.99.0}/src/robotcode/robot/utils/__init__.py +0 -0
  28. {robotcode_robot-0.97.0 → robotcode_robot-0.99.0}/src/robotcode/robot/utils/ast.py +0 -0
  29. {robotcode_robot-0.97.0 → robotcode_robot-0.99.0}/src/robotcode/robot/utils/markdownformatter.py +0 -0
  30. {robotcode_robot-0.97.0 → robotcode_robot-0.99.0}/src/robotcode/robot/utils/match.py +0 -0
  31. {robotcode_robot-0.97.0 → robotcode_robot-0.99.0}/src/robotcode/robot/utils/robot_path.py +0 -0
  32. {robotcode_robot-0.97.0 → robotcode_robot-0.99.0}/src/robotcode/robot/utils/stubs.py +0 -0
  33. {robotcode_robot-0.97.0 → robotcode_robot-0.99.0}/src/robotcode/robot/utils/variables.py +0 -0
  34. {robotcode_robot-0.97.0 → robotcode_robot-0.99.0}/src/robotcode/robot/utils/visitor.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: robotcode-robot
3
- Version: 0.97.0
3
+ Version: 0.99.0
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
@@ -25,7 +25,7 @@ Classifier: Topic :: Utilities
25
25
  Classifier: Typing :: Typed
26
26
  Requires-Python: >=3.8
27
27
  Requires-Dist: platformdirs<4.4.0,>=3.2.0
28
- Requires-Dist: robotcode-core==0.97.0
28
+ Requires-Dist: robotcode-core==0.99.0
29
29
  Requires-Dist: robotframework>=4.1.0
30
30
  Requires-Dist: tomli>=1.1.0; python_version < '3.11'
31
31
  Description-Content-Type: text/markdown
@@ -30,7 +30,7 @@ dependencies = [
30
30
  "robotframework>=4.1.0",
31
31
  "tomli>=1.1.0; python_version < '3.11'",
32
32
  "platformdirs>=3.2.0,<4.4.0",
33
- "robotcode-core==0.97.0",
33
+ "robotcode-core==0.99.0",
34
34
  ]
35
35
  dynamic = ["version"]
36
36
 
@@ -0,0 +1 @@
1
+ __version__ = "0.99.0"
@@ -10,6 +10,7 @@ class Error:
10
10
  KEYWORD_NOT_FOUND = "KeywordNotFound"
11
11
  LIBRARY_CONTAINS_NO_KEYWORDS = "LibraryContainsNoKeywords"
12
12
  POSSIBLE_CIRCULAR_IMPORT = "PossibleCircularImport"
13
+ CIRCULAR_IMPORT = "CircularImport"
13
14
  RESOURCE_EMPTY = "ResourceEmpty"
14
15
  IMPORT_CONTAINS_ERRORS = "ImportContainsErrors"
15
16
  RECURSIVE_IMPORT = "RecursiveImport"
@@ -44,6 +44,7 @@ from robotcode.core.lsp.types import (
44
44
  from robotcode.core.text_document import TextDocument
45
45
  from robotcode.core.uri import Uri
46
46
  from robotcode.core.utils.logging import LoggingDescriptor
47
+ from robotcode.core.utils.path import same_file
47
48
 
48
49
  from ..utils.ast import (
49
50
  range_from_node,
@@ -1242,15 +1243,45 @@ class Namespace:
1242
1243
 
1243
1244
  source = self.imports_manager.find_resource(value.name, base_dir, variables=variables)
1244
1245
 
1245
- if source in self._resources_files:
1246
+ allread_imported_resource = next(
1247
+ (
1248
+ v
1249
+ for k, v in self._resources.items()
1250
+ if v.library_doc.source is not None and same_file(v.library_doc.source, source)
1251
+ ),
1252
+ None,
1253
+ )
1254
+ if allread_imported_resource is not None:
1246
1255
  self._logger.debug(lambda: f"Resource '{value.name}' already imported.", context_name="import")
1256
+ if top_level:
1257
+ self.append_diagnostics(
1258
+ range=value.range,
1259
+ message=f"Resource '{value.name}' already imported.",
1260
+ severity=DiagnosticSeverity.INFORMATION,
1261
+ source=DIAGNOSTICS_SOURCE_NAME,
1262
+ related_information=(
1263
+ [
1264
+ DiagnosticRelatedInformation(
1265
+ location=Location(
1266
+ uri=str(Uri.from_path(allread_imported_resource.import_source)),
1267
+ range=allread_imported_resource.import_range,
1268
+ ),
1269
+ message="",
1270
+ )
1271
+ ]
1272
+ if allread_imported_resource.import_source
1273
+ else None
1274
+ ),
1275
+ code=Error.RESOURCE_ALREADY_IMPORTED,
1276
+ )
1247
1277
  return None
1248
1278
 
1249
- if self.source == source:
1279
+ if same_file(self.source, source):
1250
1280
  if parent_import:
1251
1281
  self.append_diagnostics(
1252
1282
  range=parent_import.range,
1253
- message="Possible circular import.",
1283
+ message=f"Possible circular import detected, Resource file'{Path(self.source).name}' "
1284
+ "might reference itself directly or through other resource files",
1254
1285
  severity=DiagnosticSeverity.INFORMATION,
1255
1286
  source=DIAGNOSTICS_SOURCE_NAME,
1256
1287
  related_information=(
@@ -1268,6 +1299,15 @@ class Namespace:
1268
1299
  ),
1269
1300
  code=Error.POSSIBLE_CIRCULAR_IMPORT,
1270
1301
  )
1302
+ else:
1303
+ self.append_diagnostics(
1304
+ range=value.range,
1305
+ message=f"Circular import detected, Resource file '{Path(source).name}' "
1306
+ "is importing itself",
1307
+ severity=DiagnosticSeverity.INFORMATION,
1308
+ source=DIAGNOSTICS_SOURCE_NAME,
1309
+ code=Error.CIRCULAR_IMPORT,
1310
+ )
1271
1311
  else:
1272
1312
  result = self._get_resource_entry(
1273
1313
  value.name,
@@ -1453,7 +1493,7 @@ class Namespace:
1453
1493
  allread_imported_resource = self._resources_files.get(entry.library_doc.source, None)
1454
1494
 
1455
1495
  if allread_imported_resource is None and entry.library_doc.source != self.source:
1456
- self._resources[entry.import_name] = entry
1496
+ self._resources[entry.library_doc.source] = entry
1457
1497
  self._resources_files[entry.library_doc.source] = entry
1458
1498
  if entry.variables:
1459
1499
  variables = self.get_suite_variables()
@@ -1515,7 +1555,14 @@ class Namespace:
1515
1555
  (
1516
1556
  e
1517
1557
  for e in self._variables_imports.values()
1518
- if e.library_doc.source == entry.library_doc.source
1558
+ if (
1559
+ (
1560
+ e.library_doc.source is not None
1561
+ and entry.library_doc.source is not None
1562
+ and same_file(e.library_doc.source, entry.library_doc.source)
1563
+ )
1564
+ or (e.library_doc.source is None and entry.library_doc.source is None)
1565
+ )
1519
1566
  and e.alias == entry.alias
1520
1567
  and e.args == entry.args
1521
1568
  ),
@@ -1580,7 +1627,14 @@ class Namespace:
1580
1627
  (
1581
1628
  e
1582
1629
  for e in self._libraries.values()
1583
- if e.library_doc.source == entry.library_doc.source
1630
+ if (
1631
+ (
1632
+ e.library_doc.source is not None
1633
+ and entry.library_doc.source is not None
1634
+ and same_file(e.library_doc.source, entry.library_doc.source)
1635
+ )
1636
+ or (e.library_doc.source is None and entry.library_doc.source is None)
1637
+ )
1584
1638
  and e.library_doc.member_name == entry.library_doc.member_name
1585
1639
  and e.alias == entry.alias
1586
1640
  and e.args == entry.args
@@ -1 +0,0 @@
1
- __version__ = "0.97.0"