diff --git a/.vscode/launch.json b/.vscode/launch.json index 120ed123..f1e946e2 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -64,10 +64,10 @@ // "-i", // "-v", "CMD_LINE_VAR:cmd_line_var", // "E:\\source\\uvtestprj\\tests\\first.robotrepl" - "analyze", - "code", + // "analyze", + // "code", // "tests" - // "repl", + "repl", // "-v", // "asd:asd" diff --git a/docs/03_reference/cli.md b/docs/03_reference/cli.md index a36afa8a..4fb08651 100644 --- a/docs/03_reference/cli.md +++ b/docs/03_reference/cli.md @@ -317,6 +317,26 @@ robotcode analyze code [OPTIONS] [PATHS]... Specifies the diagnostics codes to ignore. +- `-me, --modifiers-error CODE` + + Specifies the diagnostics codes to treat as errors. + + +- `-mw, --modifiers-warning CODE` + + Specifies the diagnostics codes to treat as warning. + + +- `-mI, --modifiers-information CODE` + + Specifies the diagnostics codes to treat as information. + + +- `-mh, --modifiers-hint CODE` + + Specifies the diagnostics codes to treat as hint. + + - `--help` Show this message and exit. @@ -624,12 +644,12 @@ robotcode debug [OPTIONS] [ROBOT_OPTIONS_AND_ARGS]... - `--tcp [
:]` - Run in `tcp` server mode and listen at the given port. (Equivalent to `--mode tcp --port `) *NOTE:* This option is mutually exclusive with options: port, pipe-server, mode, pipe-name. + Run in `tcp` server mode and listen at the given port. (Equivalent to `--mode tcp --port `) *NOTE:* This option is mutually exclusive with options: mode, port, pipe-server, pipe-name. - `--pipe-server NAME` - Run in `pipe-server` mode and listen at the given pipe name. (Equivalent to `--mode pipe-server --pipe-name `) *NOTE:* This option is mutually exclusive with options: bind, mode, port, tcp, pipe-name. + Run in `pipe-server` mode and listen at the given pipe name. (Equivalent to `--mode pipe-server --pipe-name `) *NOTE:* This option is mutually exclusive with options: bind, mode, tcp, port, pipe-name. - `--mode [tcp|pipe-server]` @@ -649,7 +669,7 @@ robotcode debug [OPTIONS] [ROBOT_OPTIONS_AND_ARGS]... - `--pipe-name NAME` - The pipe to listen on or connect to. (Only valid in `pipe` and `pipe-server` mode) *NOTE:* This option is mutually exclusive with options: tcp, bind, pipe-server, port. [env var: ROBOTCODE_PIPE_NAME] + The pipe to listen on or connect to. (Only valid in `pipe` and `pipe-server` mode) *NOTE:* This option is mutually exclusive with options: bind, tcp, port, pipe-server. [env var: ROBOTCODE_PIPE_NAME] - `--version` @@ -676,47 +696,47 @@ robotcode debug-launch [OPTIONS] **Options:** - `--stdio` - Run in `stdio` mode. (Equivalent to `--mode stdio`) *NOTE:* This option is mutually exclusive with options: bind, socket, pipe, mode, port, tcp, pipe-server, pipe-name. [env var: ROBOTCODE_STDIO] + Run in `stdio` mode. (Equivalent to `--mode stdio`) *NOTE:* This option is mutually exclusive with options: bind, socket, pipe, mode, tcp, port, pipe-server, pipe-name. [env var: ROBOTCODE_STDIO] - `--tcp [
:]` - Run in `tcp` server mode and listen at the given port. (Equivalent to `--mode tcp --port `) *NOTE:* This option is mutually exclusive with options: socket, pipe, mode, port, stdio, pipe-server, pipe-name. + Run in `tcp` server mode and listen at the given port. (Equivalent to `--mode tcp --port `) *NOTE:* This option is mutually exclusive with options: socket, pipe, mode, port, pipe-server, pipe-name, stdio. - `--socket [
:]` - Run in `socket` mode and connect to the given port. (Equivalent to `--mode socket --port `) *NOTE:* This option is mutually exclusive with options: pipe, mode, port, tcp, stdio, pipe-server, pipe-name. + Run in `socket` mode and connect to the given port. (Equivalent to `--mode socket --port `) *NOTE:* This option is mutually exclusive with options: pipe, mode, tcp, port, pipe-server, pipe-name, stdio. - `--pipe NAME` - Run in `pipe` mode and connect to the given pipe name. (Equivalent to `--mode pipe --pipe-name `) *NOTE:* This option is mutually exclusive with options: bind, socket, mode, port, tcp, stdio, pipe-server, pipe-name. + Run in `pipe` mode and connect to the given pipe name. (Equivalent to `--mode pipe --pipe-name `) *NOTE:* This option is mutually exclusive with options: bind, socket, mode, tcp, port, pipe-server, pipe-name, stdio. - `--pipe-server NAME` - Run in `pipe-server` mode and listen at the given pipe name. (Equivalent to `--mode pipe-server --pipe-name `) *NOTE:* This option is mutually exclusive with options: bind, socket, pipe, mode, port, tcp, stdio, pipe-name. + Run in `pipe-server` mode and listen at the given pipe name. (Equivalent to `--mode pipe-server --pipe-name `) *NOTE:* This option is mutually exclusive with options: bind, socket, pipe, mode, tcp, port, pipe-name, stdio. - `--mode [stdio|tcp|socket|pipe|pipe-server]` - The mode to use for the debug launch server. *NOTE:* This option is mutually exclusive with options: socket, tcp, stdio, pipe-server, pipe. [env var: ROBOTCODE_MODE; default: stdio] + The mode to use for the debug launch server. *NOTE:* This option is mutually exclusive with options: socket, pipe, tcp, pipe-server, stdio. [env var: ROBOTCODE_MODE; default: stdio] - `--port PORT` - The port to listen on or connect to. (Only valid for `tcp` and `socket mode`) *NOTE:* This option is mutually exclusive with options: pipe-server, pipe-name, pipe. [env var: ROBOTCODE_PORT; default: 6611; 1<=x<=65535] + The port to listen on or connect to. (Only valid for `tcp` and `socket mode`) *NOTE:* This option is mutually exclusive with options: pipe-name, pipe-server, pipe. [env var: ROBOTCODE_PORT; default: 6611; 1<=x<=65535] - `--bind ADDRESS` - Specify alternate bind address. If no address is specified `localhost` is used. (Only valid for tcp and socket mode) *NOTE:* This option is mutually exclusive with options: pipe-server, pipe-name, pipe. [env var: ROBOTCODE_BIND; default: 127.0.0.1] + Specify alternate bind address. If no address is specified `localhost` is used. (Only valid for tcp and socket mode) *NOTE:* This option is mutually exclusive with options: pipe-name, pipe-server, pipe. [env var: ROBOTCODE_BIND; default: 127.0.0.1] - `--pipe-name NAME` - The pipe to listen on or connect to. (Only valid in `pipe` and `pipe-server` mode) *NOTE:* This option is mutually exclusive with options: bind, socket, port, tcp, stdio, pipe-server, pipe. [env var: ROBOTCODE_PIPE_NAME] + The pipe to listen on or connect to. (Only valid in `pipe` and `pipe-server` mode) *NOTE:* This option is mutually exclusive with options: bind, socket, pipe, tcp, port, pipe-server, stdio. [env var: ROBOTCODE_PIPE_NAME] - `--version` @@ -1146,27 +1166,27 @@ robotcode language-server [OPTIONS] [PATHS]... **Options:** - `--stdio` - Run in `stdio` mode. (Equivalent to `--mode stdio`) *NOTE:* This option is mutually exclusive with options: bind, socket, pipe, mode, port, tcp, pipe-name. [env var: ROBOTCODE_STDIO] + Run in `stdio` mode. (Equivalent to `--mode stdio`) *NOTE:* This option is mutually exclusive with options: bind, socket, pipe, mode, tcp, port, pipe-name. [env var: ROBOTCODE_STDIO] - `--tcp [
:]` - Run in `tcp` server mode and listen at the given port. (Equivalent to `--mode tcp --port `) *NOTE:* This option is mutually exclusive with options: socket, pipe, mode, port, stdio, pipe-name. + Run in `tcp` server mode and listen at the given port. (Equivalent to `--mode tcp --port `) *NOTE:* This option is mutually exclusive with options: socket, pipe, mode, port, pipe-name, stdio. - `--socket [
:]` - Run in `socket` mode and connect to the given port. (Equivalent to `--mode socket --port `) *NOTE:* This option is mutually exclusive with options: pipe, mode, port, tcp, stdio, pipe-name. + Run in `socket` mode and connect to the given port. (Equivalent to `--mode socket --port `) *NOTE:* This option is mutually exclusive with options: pipe, mode, tcp, port, pipe-name, stdio. - `--pipe NAME` - Run in `pipe` mode and connect to the given pipe name. (Equivalent to `--mode pipe --pipe-name `) *NOTE:* This option is mutually exclusive with options: bind, socket, mode, port, tcp, stdio, pipe-name. + Run in `pipe` mode and connect to the given pipe name. (Equivalent to `--mode pipe --pipe-name `) *NOTE:* This option is mutually exclusive with options: bind, socket, mode, tcp, port, pipe-name, stdio. -- `--mode [tcp|stdio|socket|pipe]` +- `--mode [stdio|tcp|socket|pipe]` - The mode to use for the debug launch server. *NOTE:* This option is mutually exclusive with options: tcp, stdio, socket, pipe. [env var: ROBOTCODE_MODE; default: stdio] + The mode to use for the debug launch server. *NOTE:* This option is mutually exclusive with options: stdio, tcp, socket, pipe. [env var: ROBOTCODE_MODE; default: stdio] - `--port PORT` @@ -1181,7 +1201,7 @@ robotcode language-server [OPTIONS] [PATHS]... - `--pipe-name NAME` - The pipe to listen on or connect to. (Only valid in `pipe` and `pipe-server` mode) *NOTE:* This option is mutually exclusive with options: bind, socket, port, tcp, stdio, pipe. [env var: ROBOTCODE_PIPE_NAME] + The pipe to listen on or connect to. (Only valid in `pipe` and `pipe-server` mode) *NOTE:* This option is mutually exclusive with options: bind, socket, pipe, tcp, port, stdio. [env var: ROBOTCODE_PIPE_NAME] - `--version` diff --git a/docs/03_reference/config.md b/docs/03_reference/config.md index ed5893e3..af48f636 100644 --- a/docs/03_reference/config.md +++ b/docs/03_reference/config.md @@ -2732,7 +2732,7 @@ extend-information = ["MultipleKeywords"] Type: `list[str] | None` -Specifies the error codes to treat as errors. +Specifies the diagnostics codes to treat as errors. Examples: @@ -2745,7 +2745,7 @@ error = ["VariableNotFound", "multiple-keywords"] Type: `list[str] | None` -Extend the error codes to treat as errors. +Extend the diagnostics codes to treat as errors. Examples: @@ -2758,7 +2758,7 @@ extend_error = ["VariableNotFound", "multiple-keywords"] Type: `list[str] | None` -Extend the error codes to treat as hint. +Extend the diagnostics codes to treat as hint. Examples: @@ -2771,7 +2771,7 @@ extend_hint = ["VariableNotFound", "multiple-keywords"] Type: `list[str] | None` -Extend the error codes to ignore. +Extend the diagnostics codes to ignore. Examples: @@ -2784,7 +2784,7 @@ extend_ignore = ["VariableNotFound", "multiple-keywords"] Type: `list[str] | None` -Extend the error codes to treat as information. +Extend the diagnostics codes to treat as information. Examples: @@ -2797,7 +2797,7 @@ extend_information = ["VariableNotFound", "multiple-keywords"] Type: `list[str] | None` -Extend the error codes to treat as warnings. +Extend the diagnostics codes to treat as warning. Examples: @@ -2810,7 +2810,7 @@ extend_warning = ["VariableNotFound", "multiple-keywords"] Type: `list[str] | None` -Specifies the error codes to treat as hint. +Specifies the diagnostics codes to treat as hint. Examples: @@ -2823,7 +2823,7 @@ hint = ["VariableNotFound", "multiple-keywords"] Type: `list[str] | None` -Specifies the error codes to ignore. +Specifies the diagnostics codes to ignore. Examples: @@ -2836,7 +2836,7 @@ ignore = ["VariableNotFound", "multiple-keywords"] Type: `list[str] | None` -Specifies the error codes to treat as information. +Specifies the diagnostics codes to treat as information. Examples: @@ -2849,7 +2849,7 @@ information = ["VariableNotFound", "multiple-keywords"] Type: `list[str] | None` -Specifies the error codes to treat as warning. +Specifies the diagnostics codes to treat as warning. Examples: @@ -2889,7 +2889,7 @@ information = ["MultipleKeywords"] Type: `list[str] | None` -Specifies the error codes to treat as errors. +Specifies the diagnostics codes to treat as errors. Examples: @@ -2902,7 +2902,7 @@ error = ["VariableNotFound", "multiple-keywords"] Type: `list[str] | None` -Extend the error codes to treat as errors. +Extend the diagnostics codes to treat as errors. Examples: @@ -2915,7 +2915,7 @@ extend_error = ["VariableNotFound", "multiple-keywords"] Type: `list[str] | None` -Extend the error codes to treat as hint. +Extend the diagnostics codes to treat as hint. Examples: @@ -2928,7 +2928,7 @@ extend_hint = ["VariableNotFound", "multiple-keywords"] Type: `list[str] | None` -Extend the error codes to ignore. +Extend the diagnostics codes to ignore. Examples: @@ -2941,7 +2941,7 @@ extend_ignore = ["VariableNotFound", "multiple-keywords"] Type: `list[str] | None` -Extend the error codes to treat as information. +Extend the diagnostics codes to treat as information. Examples: @@ -2954,7 +2954,7 @@ extend_information = ["VariableNotFound", "multiple-keywords"] Type: `list[str] | None` -Extend the error codes to treat as warnings. +Extend the diagnostics codes to treat as warning. Examples: @@ -2967,7 +2967,7 @@ extend_warning = ["VariableNotFound", "multiple-keywords"] Type: `list[str] | None` -Specifies the error codes to treat as hint. +Specifies the diagnostics codes to treat as hint. Examples: @@ -2980,7 +2980,7 @@ hint = ["VariableNotFound", "multiple-keywords"] Type: `list[str] | None` -Specifies the error codes to ignore. +Specifies the diagnostics codes to ignore. Examples: @@ -2993,7 +2993,7 @@ ignore = ["VariableNotFound", "multiple-keywords"] Type: `list[str] | None` -Specifies the error codes to treat as information. +Specifies the diagnostics codes to treat as information. Examples: @@ -3006,7 +3006,7 @@ information = ["VariableNotFound", "multiple-keywords"] Type: `list[str] | None` -Specifies the error codes to treat as warning. +Specifies the diagnostics codes to treat as warning. Examples: diff --git a/etc/robot.toml.json b/etc/robot.toml.json index 13a9ad35..f0f13ec6 100644 --- a/etc/robot.toml.json +++ b/etc/robot.toml.json @@ -361,7 +361,7 @@ "properties": { "error": { "default": null, - "description": "\nSpecifies the error codes to treat as errors.\n\nExamples:\n\n```toml\n[tool.robotcode-analyze.modifiers]\nerror = [\"VariableNotFound\", \"multiple-keywords\"]\n```\n", + "description": "\nSpecifies the diagnostics codes to treat as errors.\n\nExamples:\n\n```toml\n[tool.robotcode-analyze.modifiers]\nerror = [\"VariableNotFound\", \"multiple-keywords\"]\n```\n", "items": { "type": "string" }, @@ -373,7 +373,7 @@ }, "extend-error": { "default": null, - "description": "\nExtend the error codes to treat as errors.\n\nExamples:\n\n```toml\n[tool.robotcode-analyze.modifiers]\nextend_error = [\"VariableNotFound\", \"multiple-keywords\"]\n```\n", + "description": "\nExtend the diagnostics codes to treat as errors.\n\nExamples:\n\n```toml\n[tool.robotcode-analyze.modifiers]\nextend_error = [\"VariableNotFound\", \"multiple-keywords\"]\n```\n", "items": { "type": "string" }, @@ -385,7 +385,7 @@ }, "extend-hint": { "default": null, - "description": "\nExtend the error codes to treat as hint.\n\nExamples:\n\n```toml\n[tool.robotcode-analyze.modifiers]\nextend_hint = [\"VariableNotFound\", \"multiple-keywords\"]\n```\n", + "description": "\nExtend the diagnostics codes to treat as hint.\n\nExamples:\n\n```toml\n[tool.robotcode-analyze.modifiers]\nextend_hint = [\"VariableNotFound\", \"multiple-keywords\"]\n```\n", "items": { "type": "string" }, @@ -397,7 +397,7 @@ }, "extend-ignore": { "default": null, - "description": "\nExtend the error codes to ignore.\n\nExamples:\n\n```toml\n[tool.robotcode-analyze.modifiers]\nextend_ignore = [\"VariableNotFound\", \"multiple-keywords\"]\n```\n", + "description": "\nExtend the diagnostics codes to ignore.\n\nExamples:\n\n```toml\n[tool.robotcode-analyze.modifiers]\nextend_ignore = [\"VariableNotFound\", \"multiple-keywords\"]\n```\n", "items": { "type": "string" }, @@ -409,7 +409,7 @@ }, "extend-information": { "default": null, - "description": "\nExtend the error codes to treat as information.\n\nExamples:\n\n```toml\n[tool.robotcode-analyze.modifiers]\nextend_information = [\"VariableNotFound\", \"multiple-keywords\"]\n```\n", + "description": "\nExtend the diagnostics codes to treat as information.\n\nExamples:\n\n```toml\n[tool.robotcode-analyze.modifiers]\nextend_information = [\"VariableNotFound\", \"multiple-keywords\"]\n```\n", "items": { "type": "string" }, @@ -421,7 +421,7 @@ }, "extend-warning": { "default": null, - "description": "\nExtend the error codes to treat as warnings.\n\nExamples:\n\n```toml\n[tool.robotcode-analyze.modifiers]\nextend_warning = [\"VariableNotFound\", \"multiple-keywords\"]\n```\n", + "description": "\nExtend the diagnostics codes to treat as warning.\n\nExamples:\n\n```toml\n[tool.robotcode-analyze.modifiers]\nextend_warning = [\"VariableNotFound\", \"multiple-keywords\"]\n```\n", "items": { "type": "string" }, @@ -433,7 +433,7 @@ }, "hint": { "default": null, - "description": "\nSpecifies the error codes to treat as hint.\n\nExamples:\n\n```toml\n[tool.robotcode-analyze.modifiers]\nhint = [\"VariableNotFound\", \"multiple-keywords\"]\n```\n", + "description": "\nSpecifies the diagnostics codes to treat as hint.\n\nExamples:\n\n```toml\n[tool.robotcode-analyze.modifiers]\nhint = [\"VariableNotFound\", \"multiple-keywords\"]\n```\n", "items": { "type": "string" }, @@ -445,7 +445,7 @@ }, "ignore": { "default": null, - "description": "Specifies the error codes to ignore.\n\nExamples:\n\n```toml\n[tool.robotcode-analyze.modifiers]\nignore = [\"VariableNotFound\", \"multiple-keywords\"]\n```\n", + "description": "Specifies the diagnostics codes to ignore.\n\nExamples:\n\n```toml\n[tool.robotcode-analyze.modifiers]\nignore = [\"VariableNotFound\", \"multiple-keywords\"]\n```\n", "items": { "type": "string" }, @@ -457,7 +457,7 @@ }, "information": { "default": null, - "description": "\nSpecifies the error codes to treat as information.\n\nExamples:\n\n```toml\n[tool.robotcode-analyze.modifiers]\ninformation = [\"VariableNotFound\", \"multiple-keywords\"]\n```\n", + "description": "\nSpecifies the diagnostics codes to treat as information.\n\nExamples:\n\n```toml\n[tool.robotcode-analyze.modifiers]\ninformation = [\"VariableNotFound\", \"multiple-keywords\"]\n```\n", "items": { "type": "string" }, @@ -469,7 +469,7 @@ }, "warning": { "default": null, - "description": "\nSpecifies the error codes to treat as warning.\n\nExamples:\n\n```toml\n[tool.robotcode-analyze.modifiers]\nwarning = [\"VariableNotFound\", \"multiple-keywords\"]\n```\n", + "description": "\nSpecifies the diagnostics codes to treat as warning.\n\nExamples:\n\n```toml\n[tool.robotcode-analyze.modifiers]\nwarning = [\"VariableNotFound\", \"multiple-keywords\"]\n```\n", "items": { "type": "string" }, diff --git a/packages/analyze/src/robotcode/analyze/cli.py b/packages/analyze/src/robotcode/analyze/cli.py index 28ed8926..cd0b275b 100644 --- a/packages/analyze/src/robotcode/analyze/cli.py +++ b/packages/analyze/src/robotcode/analyze/cli.py @@ -4,7 +4,6 @@ import click -from robotcode.analyze.config import AnalyzeConfig from robotcode.core.lsp.types import Diagnostic, DiagnosticSeverity from robotcode.core.text_document import TextDocument from robotcode.core.uri import Uri @@ -18,6 +17,7 @@ from .__version__ import __version__ from .code_analyzer import CodeAnalyzer, DocumentDiagnosticReport, FolderDiagnosticReport +from .config import AnalyzeConfig, ModifiersConfig @click.group( @@ -105,6 +105,46 @@ def __str__(self) -> str: help="Additional locations where to search test libraries" " and other extensions when they are imported. see `robot --pythonpath` option.", ) +@click.option( + "-mi", + "--modifiers-ignore", + metavar="CODE", + type=str, + multiple=True, + help="Specifies the diagnostics codes to ignore.", +) +@click.option( + "-me", + "--modifiers-error", + metavar="CODE", + type=str, + multiple=True, + help="Specifies the diagnostics codes to treat as errors.", +) +@click.option( + "-mw", + "--modifiers-warning", + metavar="CODE", + type=str, + multiple=True, + help="Specifies the diagnostics codes to treat as warning.", +) +@click.option( + "-mI", + "--modifiers-information", + metavar="CODE", + type=str, + multiple=True, + help="Specifies the diagnostics codes to treat as information.", +) +@click.option( + "-mh", + "--modifiers-hint", + metavar="CODE", + type=str, + multiple=True, + help="Specifies the diagnostics codes to treat as hint.", +) @click.argument( "paths", nargs=-1, type=click.Path(exists=True, dir_okay=True, file_okay=True, readable=True, path_type=Path) ) @@ -115,12 +155,27 @@ def code( variable: Tuple[str, ...], variablefile: Tuple[str, ...], pythonpath: Tuple[str, ...], + modifiers_ignore: Tuple[str, ...], + modifiers_error: Tuple[str, ...], + modifiers_warning: Tuple[str, ...], + modifiers_information: Tuple[str, ...], + modifiers_hint: Tuple[str, ...], paths: Tuple[Path], ) -> None: """\ Performs static code analysis to detect syntax errors, missing keywords or variables, missing arguments, and more on the given *PATHS*. *PATHS* can be files or directories. If no PATHS are given, the current directory is used. + + \b + Examples: + ``` + robotcode analyze code + robotcode analyze code --filter **/*.robot + robotcode analyze code tests/acceptance/first.robot + robotcode analyze code -mi DuplicateKeyword tests/acceptance/first.robot + robotcode --format json analyze code + ``` """ config_files, root_folder, _ = get_config_files( @@ -162,6 +217,34 @@ def code( for vf in variablefile: robot_profile.variable_files.append(vf) + if analyzer_config.modifiers is None: + analyzer_config.modifiers = ModifiersConfig() + + if modifiers_ignore: + if analyzer_config.modifiers.ignore is None: + analyzer_config.modifiers.ignore = [] + analyzer_config.modifiers.ignore.extend(modifiers_ignore) + + if modifiers_error: + if analyzer_config.modifiers.error is None: + analyzer_config.modifiers.error = [] + analyzer_config.modifiers.error.extend(modifiers_error) + + if modifiers_warning: + if analyzer_config.modifiers.warning is None: + analyzer_config.modifiers.warning = [] + analyzer_config.modifiers.warning.extend(modifiers_warning) + + if modifiers_information: + if analyzer_config.modifiers.information is None: + analyzer_config.modifiers.information = [] + analyzer_config.modifiers.information.extend(modifiers_information) + + if modifiers_hint: + if analyzer_config.modifiers.hint is None: + analyzer_config.modifiers.hint = [] + analyzer_config.modifiers.hint.extend(modifiers_hint) + statistics = Statistic() for e in CodeAnalyzer( app=app, @@ -223,7 +306,7 @@ def _print_diagnostics( + (f"{item.range.start.line + 1}:{item.range.start.character + 1}: " if print_range else " ") ) if folder_path and folder_path != root_folder - else " " + else "" ) + click.style(f"[{severity.name[0]}] {item.code}", fg=SEVERITY_COLORS[severity]) + f": {indent(item.message, prefix=' ').strip()}", diff --git a/packages/analyze/src/robotcode/analyze/code_analyzer.py b/packages/analyze/src/robotcode/analyze/code_analyzer.py index 06e3f0b5..a6b7201d 100644 --- a/packages/analyze/src/robotcode/analyze/code_analyzer.py +++ b/packages/analyze/src/robotcode/analyze/code_analyzer.py @@ -122,7 +122,7 @@ def run( if item is None: continue elif isinstance(item, BaseException): - self.app.error(f"Error analyzing {document.uri.to_path()}: {item}") + self.app.error(f"Error collecting diagnostics for {document.uri.to_path()}: {item}") else: diagnostics.extend(item) if diagnostics: diff --git a/packages/analyze/src/robotcode/analyze/config.py b/packages/analyze/src/robotcode/analyze/config.py index 0055c107..3e0d8fca 100644 --- a/packages/analyze/src/robotcode/analyze/config.py +++ b/packages/analyze/src/robotcode/analyze/config.py @@ -17,7 +17,7 @@ class ModifiersConfig(BaseOptions): ignore: Optional[List[str]] = field( description="""\ - Specifies the error codes to ignore. + Specifies the diagnostics codes to ignore. Examples: @@ -29,7 +29,7 @@ class ModifiersConfig(BaseOptions): ) extend_ignore: Optional[List[str]] = field( description=""" - Extend the error codes to ignore. + Extend the diagnostics codes to ignore. Examples: @@ -41,7 +41,7 @@ class ModifiersConfig(BaseOptions): ) error: Optional[List[str]] = field( description=""" - Specifies the error codes to treat as errors. + Specifies the diagnostics codes to treat as errors. Examples: @@ -53,7 +53,7 @@ class ModifiersConfig(BaseOptions): ) extend_error: Optional[List[str]] = field( description=""" - Extend the error codes to treat as errors. + Extend the diagnostics codes to treat as errors. Examples: @@ -65,7 +65,7 @@ class ModifiersConfig(BaseOptions): ) warning: Optional[List[str]] = field( description=""" - Specifies the error codes to treat as warning. + Specifies the diagnostics codes to treat as warning. Examples: @@ -77,7 +77,7 @@ class ModifiersConfig(BaseOptions): ) extend_warning: Optional[List[str]] = field( description=""" - Extend the error codes to treat as warnings. + Extend the diagnostics codes to treat as warning. Examples: @@ -89,7 +89,7 @@ class ModifiersConfig(BaseOptions): ) information: Optional[List[str]] = field( description=""" - Specifies the error codes to treat as information. + Specifies the diagnostics codes to treat as information. Examples: @@ -101,7 +101,7 @@ class ModifiersConfig(BaseOptions): ) extend_information: Optional[List[str]] = field( description=""" - Extend the error codes to treat as information. + Extend the diagnostics codes to treat as information. Examples: @@ -113,7 +113,7 @@ class ModifiersConfig(BaseOptions): ) hint: Optional[List[str]] = field( description=""" - Specifies the error codes to treat as hint. + Specifies the diagnostics codes to treat as hint. Examples: @@ -125,7 +125,7 @@ class ModifiersConfig(BaseOptions): ) extend_hint: Optional[List[str]] = field( description=""" - Extend the error codes to treat as hint. + Extend the diagnostics codes to treat as hint. Examples: diff --git a/robot.toml b/robot.toml index bbf2303e..70496e57 100644 --- a/robot.toml +++ b/robot.toml @@ -3,15 +3,3 @@ python-path = [ "tests/robotcode/language_server/robotframework/parts/data/resources", ] paths = "tests/robotcode/language_server/robotframework/parts/data" -#log-level = "TRACE:TRACE" - -[variables] -a_robot_toml_variable = "a_robot_toml_value" - -[tool.robotcode-analyze] - - -[tool.robotcode-analyze.modifiers] -warning = ["KeywordNotFound"] -#warning = ["user"] -extend-hint = ["a_second_hint"] diff --git a/tests/robotcode/language_server/robotframework/parts/data/.robot.toml b/tests/robotcode/language_server/robotframework/parts/data/.robot.toml index d8a724c4..ea17bea9 100644 --- a/tests/robotcode/language_server/robotframework/parts/data/.robot.toml +++ b/tests/robotcode/language_server/robotframework/parts/data/.robot.toml @@ -1,14 +1,7 @@ -#default-profiles = "firefox" - - -#extends-args = ["--profile", "default"] -#[extra-profiles.abc] [extend-profiles.firefox] description = "The overridden firefox profile" extend-python-path = ["./python"] -#extra-python-path = ["./python1"] output-dir = "output" -[tool.robotcode-analyze] -extend-select = ["None"] -ignore = ["Nonono"] \ No newline at end of file +[tool.robotcode-analyze.extend-modifiers] +extend-warning = ["VariableNotFound"] diff --git a/tests/robotcode/language_server/robotframework/parts/data/robot.toml b/tests/robotcode/language_server/robotframework/parts/data/robot.toml index 7f444c74..6439955a 100644 --- a/tests/robotcode/language_server/robotframework/parts/data/robot.toml +++ b/tests/robotcode/language_server/robotframework/parts/data/robot.toml @@ -69,3 +69,7 @@ enabled = { if = "environ.get('DISABLED_PROFILE') in ['true', '1']" } [profiles.test1.extend-variables] API_URL = "https://api.test1.company.com" APP_URL = "https://app.test1.company.com" + + +[tool.robotcode-analyze.modifiers] +warning = ["KeywordNotFound"]