robotcode-analyze 2.6.2__tar.gz → 2.7.0__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.
Files changed (19) hide show
  1. {robotcode_analyze-2.6.2 → robotcode_analyze-2.7.0}/PKG-INFO +4 -4
  2. {robotcode_analyze-2.6.2 → robotcode_analyze-2.7.0}/pyproject.toml +3 -3
  3. robotcode_analyze-2.7.0/src/robotcode/analyze/__version__.py +1 -0
  4. {robotcode_analyze-2.6.2 → robotcode_analyze-2.7.0}/src/robotcode/analyze/cache/cli.py +27 -12
  5. robotcode_analyze-2.6.2/src/robotcode/analyze/__version__.py +0 -1
  6. {robotcode_analyze-2.6.2 → robotcode_analyze-2.7.0}/.gitignore +0 -0
  7. {robotcode_analyze-2.6.2 → robotcode_analyze-2.7.0}/README.md +0 -0
  8. {robotcode_analyze-2.6.2 → robotcode_analyze-2.7.0}/src/robotcode/analyze/__init__.py +0 -0
  9. {robotcode_analyze-2.6.2 → robotcode_analyze-2.7.0}/src/robotcode/analyze/cli.py +0 -0
  10. {robotcode_analyze-2.6.2 → robotcode_analyze-2.7.0}/src/robotcode/analyze/code/_models.py +0 -0
  11. {robotcode_analyze-2.6.2 → robotcode_analyze-2.7.0}/src/robotcode/analyze/code/_sarif.py +0 -0
  12. {robotcode_analyze-2.6.2 → robotcode_analyze-2.7.0}/src/robotcode/analyze/code/cli.py +0 -0
  13. {robotcode_analyze-2.6.2 → robotcode_analyze-2.7.0}/src/robotcode/analyze/code/code_analyzer.py +0 -0
  14. {robotcode_analyze-2.6.2 → robotcode_analyze-2.7.0}/src/robotcode/analyze/code/diagnostics_context.py +0 -0
  15. {robotcode_analyze-2.6.2 → robotcode_analyze-2.7.0}/src/robotcode/analyze/code/language_provider.py +0 -0
  16. {robotcode_analyze-2.6.2 → robotcode_analyze-2.7.0}/src/robotcode/analyze/code/robot_framework_language_provider.py +0 -0
  17. {robotcode_analyze-2.6.2 → robotcode_analyze-2.7.0}/src/robotcode/analyze/config.py +0 -0
  18. {robotcode_analyze-2.6.2 → robotcode_analyze-2.7.0}/src/robotcode/analyze/hooks.py +0 -0
  19. {robotcode_analyze-2.6.2 → robotcode_analyze-2.7.0}/src/robotcode/analyze/py.typed +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: robotcode-analyze
3
- Version: 2.6.2
3
+ Version: 2.7.0
4
4
  Summary: RobotCode analyze plugin for Robot Framework
5
5
  Project-URL: Homepage, https://robotcode.io
6
6
  Project-URL: Donate, https://opencollective.com/robotcode
@@ -25,9 +25,9 @@ Classifier: Programming Language :: Python :: Implementation :: PyPy
25
25
  Classifier: Topic :: Utilities
26
26
  Classifier: Typing :: Typed
27
27
  Requires-Python: >=3.10
28
- Requires-Dist: robotcode-plugin==2.6.2
29
- Requires-Dist: robotcode-robot==2.6.2
30
- Requires-Dist: robotcode==2.6.2
28
+ Requires-Dist: robotcode-plugin==2.7.0
29
+ Requires-Dist: robotcode-robot==2.7.0
30
+ Requires-Dist: robotcode==2.7.0
31
31
  Requires-Dist: robotframework>=5.0.0
32
32
  Description-Content-Type: text/markdown
33
33
 
@@ -28,9 +28,9 @@ classifiers = [
28
28
  ]
29
29
  dependencies = [
30
30
  "robotframework>=5.0.0",
31
- "robotcode-plugin==2.6.2",
32
- "robotcode-robot==2.6.2",
33
- "robotcode==2.6.2",
31
+ "robotcode-plugin==2.7.0",
32
+ "robotcode-robot==2.7.0",
33
+ "robotcode==2.7.0",
34
34
  ]
35
35
  dynamic = ["version"]
36
36
 
@@ -0,0 +1 @@
1
+ __version__ = "2.7.0"
@@ -1,3 +1,4 @@
1
+ from fnmatch import fnmatch
1
2
  from pathlib import Path
2
3
  from typing import Optional, Tuple
3
4
 
@@ -80,6 +81,25 @@ def _format_bytes(n: int) -> str:
80
81
  return f"{n / (1024 * 1024):.1f} MB"
81
82
 
82
83
 
84
+ def _display_name(entry_name: str) -> str:
85
+ # Namespace entry names contain a newline separating source path and
86
+ # document type; keep the table/line output single-line.
87
+ return entry_name.replace("\n", " · ")
88
+
89
+
90
+ def _entry_matches(entry_name: str, patterns: Tuple[str, ...]) -> bool:
91
+ """Whether an entry name matches any of the glob patterns.
92
+
93
+ Namespace entry names carry a "\\n<document type>" suffix; patterns are
94
+ matched against the full name and against the bare source path, so path
95
+ globs like '*/suite.robot' keep working for namespace entries.
96
+ """
97
+ if not patterns:
98
+ return True
99
+ source = entry_name.split("\n", 1)[0]
100
+ return any(fnmatch(entry_name, p) or fnmatch(source, p) for p in patterns)
101
+
102
+
83
103
  @click.group(
84
104
  name="cache",
85
105
  add_help_option=True,
@@ -234,8 +254,6 @@ def cache_list(app: Application, sections: Tuple[str, ...], patterns: Tuple[str,
234
254
  Use --section to filter by specific cache sections.
235
255
  Use --pattern to filter entries by glob pattern.
236
256
  """
237
- from fnmatch import fnmatch
238
-
239
257
  _, db = _resolve_cache(app, paths)
240
258
 
241
259
  if db is None:
@@ -246,16 +264,11 @@ def cache_list(app: Application, sections: Tuple[str, ...], patterns: Tuple[str,
246
264
  selected = _parse_sections(sections)
247
265
  target_sections = selected if selected else tuple(CacheSection)
248
266
 
249
- def _matches(name: str) -> bool:
250
- if not patterns:
251
- return True
252
- return any(fnmatch(name, p) for p in patterns)
253
-
254
267
  if app.config.output_format is None or app.config.output_format == OutputFormat.TEXT:
255
268
  if app.colored and app.has_rich:
256
269
  lines: list[str] = []
257
270
  for section in target_sections:
258
- entries = [e for e in db.list_entries(section) if _matches(e.entry_name)]
271
+ entries = [e for e in db.list_entries(section) if _entry_matches(e.entry_name, patterns)]
259
272
  if not entries:
260
273
  continue
261
274
  lines.append(f"### {section.name.lower()} ({len(entries)} entries)")
@@ -266,7 +279,7 @@ def cache_list(app: Application, sections: Tuple[str, ...], patterns: Tuple[str,
266
279
  size = _format_bytes(entry.meta_bytes + entry.data_bytes)
267
280
  created = entry.created_at or "—"
268
281
  modified = entry.modified_at or "—"
269
- lines.append(f"| {entry.entry_name} | {size} | {created} | {modified} |")
282
+ lines.append(f"| {_display_name(entry.entry_name)} | {size} | {created} | {modified} |")
270
283
  lines.append("")
271
284
  if lines:
272
285
  app.echo_as_markdown("\n".join(lines))
@@ -275,7 +288,7 @@ def cache_list(app: Application, sections: Tuple[str, ...], patterns: Tuple[str,
275
288
  else:
276
289
  found = False
277
290
  for section in target_sections:
278
- entries = [e for e in db.list_entries(section) if _matches(e.entry_name)]
291
+ entries = [e for e in db.list_entries(section) if _entry_matches(e.entry_name, patterns)]
279
292
  if not entries:
280
293
  continue
281
294
  found = True
@@ -284,14 +297,16 @@ def cache_list(app: Application, sections: Tuple[str, ...], patterns: Tuple[str,
284
297
  size = _format_bytes(entry.meta_bytes + entry.data_bytes)
285
298
  created = entry.created_at or "—"
286
299
  modified = entry.modified_at or "—"
287
- app.echo(f" {entry.entry_name} size={size} created={created} modified={modified}")
300
+ app.echo(
301
+ f" {_display_name(entry.entry_name)} size={size} created={created} modified={modified}"
302
+ )
288
303
  app.echo("")
289
304
  if not found:
290
305
  app.echo("No entries found.")
291
306
  else:
292
307
  result: dict[str, list[dict[str, object]]] = {}
293
308
  for section in target_sections:
294
- entries = [e for e in db.list_entries(section) if _matches(e.entry_name)]
309
+ entries = [e for e in db.list_entries(section) if _entry_matches(e.entry_name, patterns)]
295
310
  if entries:
296
311
  result[section.name.lower()] = [
297
312
  {
@@ -1 +0,0 @@
1
- __version__ = "2.6.2"