robotcode 2.9.0.dev124__py3-none-any.whl → 2.9.0.dev180__py3-none-any.whl

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/cli/__init__.py CHANGED
@@ -2,6 +2,7 @@ import json
2
2
  import logging
3
3
  import logging.config
4
4
  import os
5
+ import traceback
5
6
  from pathlib import Path
6
7
  from typing import IO, Any, List, Literal, Mapping, Optional
7
8
 
@@ -18,7 +19,7 @@ from robotcode.plugin import (
18
19
  )
19
20
  from robotcode.plugin._agent_detection import is_running_in_ai_agent
20
21
  from robotcode.plugin.click_helper.aliases import AliasedGroup
21
- from robotcode.plugin.click_helper.exit_codes import has_robot_exit_codes
22
+ from robotcode.plugin.click_helper.exit_codes import has_errors_exit_with_128, has_robot_exit_codes
22
23
  from robotcode.plugin.click_helper.types import EnumChoice
23
24
  from robotcode.plugin.click_helper.wrappable import WRAPPER_APPLIED_ENV, invoked_command_is_wrappable, is_wrappable
24
25
  from robotcode.plugin.manager import PluginManager
@@ -122,6 +123,17 @@ class RobotDataError(RobotCodeError):
122
123
  self.exit_code = 252 # type: ignore[misc]
123
124
 
124
125
 
126
+ class FindingsCommandError(RobotCodeError):
127
+ """An error robotcode reports itself for a command marked `errors_exit_with_128`.
128
+
129
+ Exits with 128 instead of Click's 1 or 2, which such a command uses for what it found.
130
+ """
131
+
132
+ def __init__(self, error: click.ClickException, app: Application) -> None:
133
+ super().__init__(error, app)
134
+ self.exit_code = 128 # type: ignore[misc]
135
+
136
+
125
137
  class RobotCodeGroup(AliasedGroup):
126
138
  """The root command group.
127
139
 
@@ -131,7 +143,9 @@ class RobotCodeGroup(AliasedGroup):
131
143
  exit code 1 or 2, such as a broken configuration, a wrapper that doesn't start or an
132
144
  invalid option - exits with Robot Framework's 252 instead. Robot Framework's own exit
133
145
  codes never arrive as Click errors, so they pass through unchanged, and so does any
134
- other code.
146
+ other code. Every Click error and every unexpected exception of a command marked
147
+ `errors_exit_with_128` exits with 128, because the command uses its lower exit codes
148
+ for what it found; the exception's traceback is written as before.
135
149
 
136
150
  Every Click error of a command or of the group's own options is written as
137
151
  `[ ERROR ] <message>`, with the `Application` of the command. An error that comes
@@ -163,14 +177,25 @@ class RobotCodeGroup(AliasedGroup):
163
177
  return super().invoke(ctx)
164
178
  except click.ClickException as e:
165
179
  app = ctx.find_object(Application) or _application_for(ctx.params)
166
- if e.exit_code in (1, 2) and self._passes_on_robot_exit_codes(ctx):
180
+ cmd = self._invoked_command(ctx)
181
+ if cmd is not None and has_errors_exit_with_128(cmd):
182
+ raise FindingsCommandError(e, app) from e
183
+ if e.exit_code in (1, 2) and cmd is not None and (is_wrappable(cmd) or has_robot_exit_codes(cmd)):
167
184
  raise RobotDataError(e, app) from e
168
185
  raise RobotCodeError(e, app) from e
169
-
170
- def _passes_on_robot_exit_codes(self, ctx: click.Context) -> bool:
186
+ except (click.exceptions.Exit, click.Abort):
187
+ raise
188
+ except Exception:
189
+ cmd = self._invoked_command(ctx)
190
+ if cmd is None or not has_errors_exit_with_128(cmd):
191
+ raise
192
+ # written as Python writes an exception that nobody catches
193
+ traceback.print_exc()
194
+ ctx.exit(128)
195
+
196
+ def _invoked_command(self, ctx: click.Context) -> Optional[click.Command]:
171
197
  name = ctx.invoked_subcommand
172
- cmd = self.get_command(ctx, name) if name else None
173
- return cmd is not None and (is_wrappable(cmd) or has_robot_exit_codes(cmd))
198
+ return self.get_command(ctx, name) if name else None
174
199
 
175
200
 
176
201
  @click.group(
@@ -236,8 +261,8 @@ class RobotCodeGroup(AliasedGroup):
236
261
  default=None,
237
262
  help=(
238
263
  "Enable or disable colored output. Color codes are written only to a terminal; set `FORCE_COLOR` to get"
239
- " them in a pipe. Default (no flag): auto-detect — colors only when stdout is a TTY, disabled if `NO_COLOR`"
240
- " is set, forced if `FORCE_COLOR` is set."
264
+ " them in a pipe. Default (no flag): auto-detect (colors only when stdout is a TTY, disabled if `NO_COLOR`"
265
+ " is set, forced if `FORCE_COLOR` is set)."
241
266
  ),
242
267
  show_envvar=True,
243
268
  )
@@ -1 +1 @@
1
- __version__ = "2.9.0-dev.124"
1
+ __version__ = "2.9.0-dev.180"
@@ -141,9 +141,9 @@ def files(app: Application, paths: List[Path], user: bool = False) -> None:
141
141
 
142
142
  messages = []
143
143
  if discovered_by == DiscoverdBy.NOT_FOUND:
144
- messages += ["Cannot detect root folder. 😥"]
144
+ messages += ["Cannot detect root folder."]
145
145
  elif not config_files:
146
- messages += ["Cannot find any configuration file. 😥"]
146
+ messages += ["Cannot find any configuration file."]
147
147
  if messages:
148
148
  result["messages"] = messages
149
149
 
@@ -185,7 +185,7 @@ def root(app: Application, paths: Tuple[Path, ...]) -> None:
185
185
  )
186
186
 
187
187
  if root_folder is None and (app.config.output_format is None or app.config.output_format == OutputFormat.TEXT):
188
- raise click.ClickException("Cannot detect root folder. 😥")
188
+ raise click.ClickException("Cannot detect root folder.")
189
189
 
190
190
  result: Dict[str, Any] = {
191
191
  "root": {
@@ -196,7 +196,7 @@ def root(app: Application, paths: Tuple[Path, ...]) -> None:
196
196
 
197
197
  messages = []
198
198
  if discovered_by == DiscoverdBy.NOT_FOUND:
199
- messages += ["Cannot detect root folder. 😥"]
199
+ messages += ["Cannot detect root folder."]
200
200
 
201
201
  if messages:
202
202
  result["messages"] = messages
@@ -127,9 +127,9 @@ def list(app: Application, paths: List[Path], show_hidden: bool = False, sort_by
127
127
 
128
128
  messages = []
129
129
  if discovered_by == DiscoverdBy.NOT_FOUND:
130
- messages += ["Cannot detect root folder. 😥"]
130
+ messages += ["Cannot detect root folder."]
131
131
  elif not config_files:
132
- messages += ["Cannot find any configuration file. 😥"]
132
+ messages += ["Cannot find any configuration file."]
133
133
  elif not config.profiles:
134
134
  messages += ["No profiles defined."]
135
135
  if messages:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: robotcode
3
- Version: 2.9.0-dev.124
3
+ Version: 2.9.0-dev.180
4
4
  Summary: Command line interface for RobotCode
5
5
  Project-URL: Homepage, https://robotcode.io
6
6
  Project-URL: Donate, https://opencollective.com/robotcode
@@ -34,35 +34,35 @@ Classifier: Topic :: Text Editors :: Integrated Development Environments (IDE)
34
34
  Classifier: Topic :: Utilities
35
35
  Classifier: Typing :: Typed
36
36
  Requires-Python: >=3.10
37
- Requires-Dist: robotcode-core==2.9.0-dev.124
38
- Requires-Dist: robotcode-plugin==2.9.0-dev.124
39
- Requires-Dist: robotcode-robot==2.9.0-dev.124
37
+ Requires-Dist: robotcode-core==2.9.0-dev.180
38
+ Requires-Dist: robotcode-plugin==2.9.0-dev.180
39
+ Requires-Dist: robotcode-robot==2.9.0-dev.180
40
40
  Provides-Extra: all
41
41
  Requires-Dist: docutils; extra == 'all'
42
42
  Requires-Dist: pyyaml>=5.4; extra == 'all'
43
- Requires-Dist: robotcode-analyze==2.9.0-dev.124; extra == 'all'
44
- Requires-Dist: robotcode-debugger==2.9.0-dev.124; extra == 'all'
45
- Requires-Dist: robotcode-language-server==2.9.0-dev.124; extra == 'all'
46
- Requires-Dist: robotcode-repl-server==2.9.0-dev.124; extra == 'all'
47
- Requires-Dist: robotcode-repl==2.9.0-dev.124; extra == 'all'
48
- Requires-Dist: robotcode-runner==2.9.0-dev.124; extra == 'all'
43
+ Requires-Dist: robotcode-analyze==2.9.0-dev.180; extra == 'all'
44
+ Requires-Dist: robotcode-debugger==2.9.0-dev.180; extra == 'all'
45
+ Requires-Dist: robotcode-language-server==2.9.0-dev.180; extra == 'all'
46
+ Requires-Dist: robotcode-repl-server==2.9.0-dev.180; extra == 'all'
47
+ Requires-Dist: robotcode-repl==2.9.0-dev.180; extra == 'all'
48
+ Requires-Dist: robotcode-runner==2.9.0-dev.180; extra == 'all'
49
49
  Requires-Dist: robotframework-robocop>=6.0.0; extra == 'all'
50
50
  Provides-Extra: analyze
51
- Requires-Dist: robotcode-analyze==2.9.0-dev.124; extra == 'analyze'
51
+ Requires-Dist: robotcode-analyze==2.9.0-dev.180; extra == 'analyze'
52
52
  Provides-Extra: debugger
53
- Requires-Dist: robotcode-debugger==2.9.0-dev.124; extra == 'debugger'
53
+ Requires-Dist: robotcode-debugger==2.9.0-dev.180; extra == 'debugger'
54
54
  Provides-Extra: languageserver
55
- Requires-Dist: robotcode-language-server==2.9.0-dev.124; extra == 'languageserver'
55
+ Requires-Dist: robotcode-language-server==2.9.0-dev.180; extra == 'languageserver'
56
56
  Provides-Extra: lint
57
57
  Requires-Dist: robotframework-robocop>=2.0.0; extra == 'lint'
58
58
  Provides-Extra: repl
59
- Requires-Dist: robotcode-repl==2.9.0-dev.124; extra == 'repl'
59
+ Requires-Dist: robotcode-repl==2.9.0-dev.180; extra == 'repl'
60
60
  Provides-Extra: replserver
61
- Requires-Dist: robotcode-repl-server==2.9.0-dev.124; extra == 'replserver'
61
+ Requires-Dist: robotcode-repl-server==2.9.0-dev.180; extra == 'replserver'
62
62
  Provides-Extra: rest
63
63
  Requires-Dist: docutils; extra == 'rest'
64
64
  Provides-Extra: runner
65
- Requires-Dist: robotcode-runner==2.9.0-dev.124; extra == 'runner'
65
+ Requires-Dist: robotcode-runner==2.9.0-dev.180; extra == 'runner'
66
66
  Provides-Extra: yaml
67
67
  Requires-Dist: pyyaml>=5.4; extra == 'yaml'
68
68
  Description-Content-Type: text/markdown
@@ -146,7 +146,7 @@ For the complete feature reference, see the [official documentation](https://rob
146
146
  RobotCode's CI tests only these combinations, to keep the effort low. Other combinations may work, but using them is your own responsibility. For example, Robot Framework versions before 7.5 may not work with Python 3.15.
147
147
 
148
148
  **Editor / IDE — any LSP-capable editor works.** For the dedicated extensions you need one of:
149
- - Visual Studio Code 1.127.0 or newer
149
+ - Visual Studio Code 1.131.0 or newer
150
150
  - PyCharm / IntelliJ IDEA 2026.1 or newer
151
151
 
152
152
  Other editors (Neovim, Sublime Text, Helix, Emacs, …) connect to the language server via the `languageserver` extra from PyPI — see [Command Line and Other Editors](#command-line-and-other-editors) below.
@@ -0,0 +1,12 @@
1
+ robotcode/cli/__init__.py,sha256=53X6XQi_a570eDK3-LxjshROpPVpz0sR5spLVY7dMKc,17550
2
+ robotcode/cli/__main__.py,sha256=hX3nwROMTnsYGT1KS0rXUYrslu9sFzctYdAh66Rcckw,153
3
+ robotcode/cli/__version__.py,sha256=39yWLbn8Xd-rhIKA3f_deOqSMNKc9u8vdFKv8xFpYNk,30
4
+ robotcode/cli/py.typed,sha256=bWew9mHgMy8LqMu7RuqQXFXLBxh2CRx0dUbSx-3wE48,27
5
+ robotcode/cli/commands/__init__.py,sha256=XJHRt_YwMO2Ni2EfL2aj4jkJXMVG6NGFTpzvSVgIRnQ,92
6
+ robotcode/cli/commands/config.py,sha256=2B7Z5dnfHQ2eqKcgVpZF8_7YOpgLG6RmxscD9HKi0uE,10505
7
+ robotcode/cli/commands/profiles.py,sha256=uUZ0xzlQOZVNyVKAh17O70Q6GVAf9ijyuME6ezLd4qE,6798
8
+ robotcode-2.9.0.dev180.dist-info/METADATA,sha256=naHp4bh8whDlgT1lShbfawx_sGYfvyT5FQ6tWqGS2bM,15607
9
+ robotcode-2.9.0.dev180.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
10
+ robotcode-2.9.0.dev180.dist-info/entry_points.txt,sha256=Pb4DKVVdJb5PboVl48njwk3DkKQHBJOL1A8KkpemqA8,58
11
+ robotcode-2.9.0.dev180.dist-info/licenses/LICENSE.txt,sha256=B05uMshqTA74s-0ltyHKI6yoPfJ3zYgQbvcXfDVGFf8,10280
12
+ robotcode-2.9.0.dev180.dist-info/RECORD,,
@@ -1,12 +0,0 @@
1
- robotcode/cli/__init__.py,sha256=pJ9qw0tY7Zh8OKFTtMKhFuFSnAGx7_QMx5r-s3d32U4,16394
2
- robotcode/cli/__main__.py,sha256=hX3nwROMTnsYGT1KS0rXUYrslu9sFzctYdAh66Rcckw,153
3
- robotcode/cli/__version__.py,sha256=kB2HCucrVBrLij9hB2UXa9rwCOmEfmeDk12kUWayuAU,30
4
- robotcode/cli/py.typed,sha256=bWew9mHgMy8LqMu7RuqQXFXLBxh2CRx0dUbSx-3wE48,27
5
- robotcode/cli/commands/__init__.py,sha256=XJHRt_YwMO2Ni2EfL2aj4jkJXMVG6NGFTpzvSVgIRnQ,92
6
- robotcode/cli/commands/config.py,sha256=jcXJs1sPlW4aTjiIMfongc6wmmBIuUaj6qCB5-_9WRE,10525
7
- robotcode/cli/commands/profiles.py,sha256=tZ8K5KoPkbol4PwTyR3Qleb09CjvrFJaQVbY36MGVGE,6808
8
- robotcode-2.9.0.dev124.dist-info/METADATA,sha256=ogo6GeKy1ZonG2Bxl7ugwC0XXA3XA-Gbglla-Dm7FjA,15607
9
- robotcode-2.9.0.dev124.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
10
- robotcode-2.9.0.dev124.dist-info/entry_points.txt,sha256=Pb4DKVVdJb5PboVl48njwk3DkKQHBJOL1A8KkpemqA8,58
11
- robotcode-2.9.0.dev124.dist-info/licenses/LICENSE.txt,sha256=B05uMshqTA74s-0ltyHKI6yoPfJ3zYgQbvcXfDVGFf8,10280
12
- robotcode-2.9.0.dev124.dist-info/RECORD,,