robotcode-analyze 2.9.0.dev180__py3-none-any.whl → 2.9.0.dev197__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/analyze/__version__.py +1 -1
- robotcode/analyze/code/code_analyzer.py +6 -2
- robotcode/analyze/code/language_provider.py +24 -1
- robotcode/analyze/code/markdown_language_provider.py +27 -0
- robotcode/analyze/code/robot_framework_language_provider.py +5 -24
- {robotcode_analyze-2.9.0.dev180.dist-info → robotcode_analyze-2.9.0.dev197.dist-info}/METADATA +4 -4
- {robotcode_analyze-2.9.0.dev180.dist-info → robotcode_analyze-2.9.0.dev197.dist-info}/RECORD +9 -8
- {robotcode_analyze-2.9.0.dev180.dist-info → robotcode_analyze-2.9.0.dev197.dist-info}/WHEEL +0 -0
- {robotcode_analyze-2.9.0.dev180.dist-info → robotcode_analyze-2.9.0.dev197.dist-info}/entry_points.txt +0 -0
robotcode/analyze/__version__.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "2.9.0-dev.
|
|
1
|
+
__version__ = "2.9.0-dev.197"
|
|
@@ -13,6 +13,7 @@ from robotcode.robot.config.model import RobotBaseProfile
|
|
|
13
13
|
from robotcode.robot.diagnostics.workspace_config import WorkspaceAnalysisConfig
|
|
14
14
|
|
|
15
15
|
from .diagnostics_context import DiagnosticHandlers, DiagnosticsContext
|
|
16
|
+
from .markdown_language_provider import MarkdownLanguageProvider
|
|
16
17
|
from .robot_framework_language_provider import RobotFrameworkLanguageProvider
|
|
17
18
|
|
|
18
19
|
|
|
@@ -50,8 +51,11 @@ class CodeAnalyzer(DiagnosticsContext):
|
|
|
50
51
|
|
|
51
52
|
self._dispatcher = DiagnosticHandlers()
|
|
52
53
|
|
|
53
|
-
self.language_handler_types =
|
|
54
|
-
self.
|
|
54
|
+
self.language_handler_types = [RobotFrameworkLanguageProvider, MarkdownLanguageProvider]
|
|
55
|
+
for handler_type in self.language_handler_types:
|
|
56
|
+
self.workspace.documents.languages.extend(
|
|
57
|
+
handler_type.get_language_definitions(robot_profile, self.root_folder)
|
|
58
|
+
)
|
|
55
59
|
self.language_handlers = [cls(self) for cls in self.language_handler_types]
|
|
56
60
|
if app.config.verbose:
|
|
57
61
|
app.verbose(
|
|
@@ -3,8 +3,11 @@ from pathlib import Path
|
|
|
3
3
|
from typing import Callable, Iterable, List, Optional
|
|
4
4
|
|
|
5
5
|
from robotcode.analyze.code.diagnostics_context import DiagnosticsContext
|
|
6
|
+
from robotcode.core.ignore_spec import DEFAULT_SPEC_RULES, GIT_IGNORE_FILE, ROBOT_IGNORE_FILE, IgnoreSpec, iter_files
|
|
6
7
|
from robotcode.core.language import LanguageDefinition
|
|
7
8
|
from robotcode.core.workspace import WorkspaceFolder
|
|
9
|
+
from robotcode.robot.config.model import RobotBaseProfile
|
|
10
|
+
from robotcode.robot.diagnostics.workspace_config import WorkspaceConfig
|
|
8
11
|
|
|
9
12
|
|
|
10
13
|
class LanguageProvider(ABC):
|
|
@@ -15,7 +18,27 @@ class LanguageProvider(ABC):
|
|
|
15
18
|
|
|
16
19
|
@classmethod
|
|
17
20
|
@abstractmethod
|
|
18
|
-
def get_language_definitions(cls) -> List[LanguageDefinition]: ...
|
|
21
|
+
def get_language_definitions(cls, profile: RobotBaseProfile, root: Path) -> List[LanguageDefinition]: ...
|
|
19
22
|
|
|
20
23
|
@abstractmethod
|
|
21
24
|
def collect_workspace_folder_files(self, folder: WorkspaceFolder) -> Iterable[Path]: ...
|
|
25
|
+
|
|
26
|
+
def iter_workspace_folder_files(self, folder: WorkspaceFolder) -> Iterable[Path]:
|
|
27
|
+
"""The files of a workspace folder, without the excluded and ignored ones."""
|
|
28
|
+
config = self.diagnostics_context.workspace.get_configuration(WorkspaceConfig, folder.uri)
|
|
29
|
+
|
|
30
|
+
exclude_patterns = [
|
|
31
|
+
*self.diagnostics_context.analysis_config.exclude_patterns,
|
|
32
|
+
*(config.exclude_patterns or []),
|
|
33
|
+
]
|
|
34
|
+
return iter_files(
|
|
35
|
+
folder.uri.to_path(),
|
|
36
|
+
ignore_files=[ROBOT_IGNORE_FILE, GIT_IGNORE_FILE],
|
|
37
|
+
include_hidden=False,
|
|
38
|
+
parent_spec=IgnoreSpec.from_list(
|
|
39
|
+
[*DEFAULT_SPEC_RULES, *exclude_patterns],
|
|
40
|
+
folder.uri.to_path(),
|
|
41
|
+
),
|
|
42
|
+
verbose_callback=self.verbose_callback,
|
|
43
|
+
verbose_trace=False,
|
|
44
|
+
)
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
from pathlib import Path
|
|
2
|
+
from typing import Iterable, List
|
|
3
|
+
|
|
4
|
+
from robotcode.core.language import LanguageDefinition
|
|
5
|
+
from robotcode.core.workspace import WorkspaceFolder
|
|
6
|
+
from robotcode.robot.config.model import RobotBaseProfile
|
|
7
|
+
from robotcode.robot.document_formats import MARKDOWN_LANGUAGE_ID, markdown_extensions, markdown_language_definition
|
|
8
|
+
|
|
9
|
+
from .language_provider import LanguageProvider
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class MarkdownLanguageProvider(LanguageProvider):
|
|
13
|
+
"""The Markdown files Robot Framework parses; the Robot Framework provider analyses them like `.robot` files."""
|
|
14
|
+
|
|
15
|
+
@classmethod
|
|
16
|
+
def get_language_definitions(cls, profile: RobotBaseProfile, root: Path) -> List[LanguageDefinition]:
|
|
17
|
+
definition = markdown_language_definition(profile, root)
|
|
18
|
+
return [definition] if definition is not None else []
|
|
19
|
+
|
|
20
|
+
def collect_workspace_folder_files(self, folder: WorkspaceFolder) -> Iterable[Path]:
|
|
21
|
+
if not markdown_extensions(self.diagnostics_context.profile):
|
|
22
|
+
return []
|
|
23
|
+
|
|
24
|
+
documents = self.diagnostics_context.workspace.documents
|
|
25
|
+
return filter(
|
|
26
|
+
lambda f: documents.detect_language_id(f) == MARKDOWN_LANGUAGE_ID, self.iter_workspace_folder_files(folder)
|
|
27
|
+
)
|
|
@@ -7,12 +7,12 @@ from robot.utils import FileReader
|
|
|
7
7
|
|
|
8
8
|
from robotcode.analyze.code.diagnostics_context import DiagnosticsContext
|
|
9
9
|
from robotcode.core.filewatcher import FileWatcherManagerDummy
|
|
10
|
-
from robotcode.core.ignore_spec import DEFAULT_SPEC_RULES, GIT_IGNORE_FILE, ROBOT_IGNORE_FILE, IgnoreSpec, iter_files
|
|
11
10
|
from robotcode.core.language import LanguageDefinition, language_id
|
|
12
11
|
from robotcode.core.lsp.types import Diagnostic, DiagnosticSeverity, DiagnosticTag
|
|
13
12
|
from robotcode.core.text_document import TextDocument
|
|
14
13
|
from robotcode.core.uri import Uri
|
|
15
14
|
from robotcode.core.workspace import WorkspaceFolder
|
|
15
|
+
from robotcode.robot.config.model import RobotBaseProfile
|
|
16
16
|
from robotcode.robot.diagnostics.diagnostic_rules import is_variable_name_intentionally_unused
|
|
17
17
|
from robotcode.robot.diagnostics.document_cache_helper import DocumentsCacheHelper
|
|
18
18
|
from robotcode.robot.diagnostics.entities import (
|
|
@@ -20,7 +20,7 @@ from robotcode.robot.diagnostics.entities import (
|
|
|
20
20
|
VariableDefinitionType,
|
|
21
21
|
)
|
|
22
22
|
from robotcode.robot.diagnostics.namespace import DocumentType
|
|
23
|
-
from robotcode.robot.
|
|
23
|
+
from robotcode.robot.document_formats import MARKDOWN_LANGUAGE_ID
|
|
24
24
|
|
|
25
25
|
from .language_provider import LanguageProvider
|
|
26
26
|
|
|
@@ -38,7 +38,7 @@ class RobotFrameworkLanguageProvider(LanguageProvider):
|
|
|
38
38
|
SOURCE_NAME = "robotcode.diagnostics"
|
|
39
39
|
|
|
40
40
|
@classmethod
|
|
41
|
-
def get_language_definitions(cls) -> List[LanguageDefinition]:
|
|
41
|
+
def get_language_definitions(cls, profile: RobotBaseProfile, root: Path) -> List[LanguageDefinition]:
|
|
42
42
|
return [cls.LANGUAGE_DEFINITION]
|
|
43
43
|
|
|
44
44
|
def __init__(self, diagnostics_context: DiagnosticsContext) -> None:
|
|
@@ -84,34 +84,15 @@ class RobotFrameworkLanguageProvider(LanguageProvider):
|
|
|
84
84
|
if Path(f).is_dir() and f not in sys.path:
|
|
85
85
|
sys.path.insert(0, f)
|
|
86
86
|
|
|
87
|
-
@language_id("robotframework")
|
|
87
|
+
@language_id("robotframework", MARKDOWN_LANGUAGE_ID)
|
|
88
88
|
def on_read_document_text(self, sender: Any, uri: Uri) -> str:
|
|
89
89
|
with FileReader(uri.to_path()) as reader:
|
|
90
90
|
return str(reader.read())
|
|
91
91
|
|
|
92
92
|
def collect_workspace_folder_files(self, folder: WorkspaceFolder) -> Iterable[Path]:
|
|
93
|
-
config = self.diagnostics_context.workspace.get_configuration(WorkspaceConfig, folder.uri)
|
|
94
|
-
|
|
95
93
|
extensions = self.LANGUAGE_DEFINITION.extensions
|
|
96
94
|
|
|
97
|
-
|
|
98
|
-
*self.diagnostics_context.analysis_config.exclude_patterns,
|
|
99
|
-
*(config.exclude_patterns or []),
|
|
100
|
-
]
|
|
101
|
-
return filter(
|
|
102
|
-
lambda f: f.suffix.lower() in extensions,
|
|
103
|
-
iter_files(
|
|
104
|
-
folder.uri.to_path(),
|
|
105
|
-
ignore_files=[ROBOT_IGNORE_FILE, GIT_IGNORE_FILE],
|
|
106
|
-
include_hidden=False,
|
|
107
|
-
parent_spec=IgnoreSpec.from_list(
|
|
108
|
-
[*DEFAULT_SPEC_RULES, *exclude_patterns],
|
|
109
|
-
folder.uri.to_path(),
|
|
110
|
-
),
|
|
111
|
-
verbose_callback=self.verbose_callback,
|
|
112
|
-
verbose_trace=False,
|
|
113
|
-
),
|
|
114
|
-
)
|
|
95
|
+
return filter(lambda f: f.suffix.lower() in extensions, self.iter_workspace_folder_files(folder))
|
|
115
96
|
|
|
116
97
|
def analyze_folder(self, sender: Any, folder: WorkspaceFolder) -> Optional[List[Diagnostic]]:
|
|
117
98
|
imports_manager = self._document_cache.get_imports_manager_for_workspace_folder(folder)
|
{robotcode_analyze-2.9.0.dev180.dist-info → robotcode_analyze-2.9.0.dev197.dist-info}/METADATA
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: robotcode-analyze
|
|
3
|
-
Version: 2.9.0-dev.
|
|
3
|
+
Version: 2.9.0-dev.197
|
|
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
|
|
@@ -26,9 +26,9 @@ Classifier: Programming Language :: Python :: Implementation :: PyPy
|
|
|
26
26
|
Classifier: Topic :: Utilities
|
|
27
27
|
Classifier: Typing :: Typed
|
|
28
28
|
Requires-Python: >=3.10
|
|
29
|
-
Requires-Dist: robotcode-plugin==2.9.0-dev.
|
|
30
|
-
Requires-Dist: robotcode-robot==2.9.0-dev.
|
|
31
|
-
Requires-Dist: robotcode==2.9.0-dev.
|
|
29
|
+
Requires-Dist: robotcode-plugin==2.9.0-dev.197
|
|
30
|
+
Requires-Dist: robotcode-robot==2.9.0-dev.197
|
|
31
|
+
Requires-Dist: robotcode==2.9.0-dev.197
|
|
32
32
|
Requires-Dist: robotframework>=5.0.0
|
|
33
33
|
Description-Content-Type: text/markdown
|
|
34
34
|
|
{robotcode_analyze-2.9.0.dev180.dist-info → robotcode_analyze-2.9.0.dev197.dist-info}/RECORD
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
robotcode/analyze/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
-
robotcode/analyze/__version__.py,sha256=
|
|
2
|
+
robotcode/analyze/__version__.py,sha256=TuhAPY5tWcB-O8yUsip8A5BqXPAkWXdXI0Yu5xcu0h8,30
|
|
3
3
|
robotcode/analyze/cli.py,sha256=MxGeNvscB-I_h00dag3N2Gmbv-frfuYAUAxfkRo26ys,774
|
|
4
4
|
robotcode/analyze/config.py,sha256=F9_k3-flt2LjJvmENst8F8OHubYCTR65kZQkQE5kdKU,17996
|
|
5
5
|
robotcode/analyze/dump_model.py,sha256=yIGs2s-9aR8rni_1FME9_gC6FeJh0yA9d3BLIahLWOI,5399
|
|
@@ -9,11 +9,12 @@ robotcode/analyze/cache/cli.py,sha256=-iLof0eCba529fI7joECnqyL8LrYS0EOoe_ExM9QKz
|
|
|
9
9
|
robotcode/analyze/code/_models.py,sha256=-MO9BGNqrgv2dkEqPGcO6suvANUew0NPXJu5g1CmQS0,1043
|
|
10
10
|
robotcode/analyze/code/_sarif.py,sha256=OjS5X3fvDQxwsE2nZROSrfEgpQNhhbcuV2Um4UP_OCI,2434
|
|
11
11
|
robotcode/analyze/code/cli.py,sha256=WZEmstA0bvBKCXjaq-Q0qhAQt4Oscga6eCu4vRAxmTU,38056
|
|
12
|
-
robotcode/analyze/code/code_analyzer.py,sha256=
|
|
12
|
+
robotcode/analyze/code/code_analyzer.py,sha256=lDtpjdDNJBuZiaV4fJ_-Infu_4fJrXRWWTa7fvx27uE,7544
|
|
13
13
|
robotcode/analyze/code/diagnostics_context.py,sha256=9JZjexOaCBXKZQFn4eUjwiKr1kGhRiZuD2f9czrSSS0,2411
|
|
14
|
-
robotcode/analyze/code/language_provider.py,sha256=
|
|
15
|
-
robotcode/analyze/code/
|
|
16
|
-
|
|
17
|
-
robotcode_analyze-2.9.0.
|
|
18
|
-
robotcode_analyze-2.9.0.
|
|
19
|
-
robotcode_analyze-2.9.0.
|
|
14
|
+
robotcode/analyze/code/language_provider.py,sha256=wRPV3Rmzmu68EkZwRb7i4BF9geRLmtrUOAABERaDBVI,1879
|
|
15
|
+
robotcode/analyze/code/markdown_language_provider.py,sha256=GUhyr7N4A5tCl2JTtxYELn5s3woIWWb_OrYaAGuQ8BY,1213
|
|
16
|
+
robotcode/analyze/code/robot_framework_language_provider.py,sha256=a2Smad0kKlUhJ6DxyObAy0pLBN4XInwRpyhknwXO_lk,7849
|
|
17
|
+
robotcode_analyze-2.9.0.dev197.dist-info/METADATA,sha256=d7kXx7ssrpvOC46sYj4Xynd0CswIv16SiQclIMcCyu4,2953
|
|
18
|
+
robotcode_analyze-2.9.0.dev197.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
|
|
19
|
+
robotcode_analyze-2.9.0.dev197.dist-info/entry_points.txt,sha256=tnZjhZ4BA_m0ZhDzh2TguYSOq4ywFVyFLetV10BAExI,46
|
|
20
|
+
robotcode_analyze-2.9.0.dev197.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|