Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ cd intellij-client
hatch run test

# Test specific environment
hatch run devel.py312-rf73:test
hatch run devel.py3.12-rf73:test

# Coverage reporting
hatch run cov
Expand Down
13 changes: 8 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ You can also check available environments with: `hatch env show`

1. **Create a branch:** `git checkout -b feature/your-feature-name`
2. **Make your changes** following the project's coding standards
3. **Run tests:** `hatch run devel.py312-rf73:test` (single combination for faster development)
3. **Run tests:** `hatch run devel.py3.12-rf73:test` (single combination for faster development)
4. **Run linting:** `hatch run lint:all` (or use the VS Code task)
5. **Fix linting issues:** `hatch run lint:style` for formatting
6. **Commit your changes** with a descriptive commit message
Expand Down Expand Up @@ -297,20 +297,23 @@ hatch run test.rf41:test # Robot Framework 4.1.x

# Run tests in specific development environments (single combination)
hatch run devel:test # ⚠️ Runs ALL matrix combinations (Python 3.10-3.14 × RF 4.1-7.3)
hatch run devel.py311-rf70:test # Python 3.11 with Robot Framework 7.0.x (single combination)
hatch run devel.py312-rf73:test # Python 3.12 with Robot Framework 7.3.x (single combination)
hatch run devel.py313-rf73:test # Python 3.13 with Robot Framework 7.3.x (single combination)
hatch run devel.py3.11-rf70:test # Python 3.11 with Robot Framework 7.0.x (single combination)
hatch run devel.py3.12-rf73:test # Python 3.12 with Robot Framework 7.3.x (single combination)
hatch run devel.py3.13-rf73:test # Python 3.13 with Robot Framework 7.3.x (single combination)

# Test against development versions of Robot Framework
hatch run rfbeta:test # Robot Framework beta/RC versions
hatch run rfmaster:test # Robot Framework master branch
hatch run rfdevel:test # Local Robot Framework development version

# Test with Robocop development version
hatch run robocopmain:test # Robocop main branch
```

**⚠️ Important Matrix Behavior:**
- `hatch run test` executes tests for **all combinations** in the matrix (48 combinations: 6 Python versions × 8 RF versions)
- `hatch run devel:test` also runs **all matrix combinations**
- For faster development, use specific combinations like `hatch run devel.py312-rf73:test`
- For faster development, use specific combinations like `hatch run devel.py3.12-rf73:test`
- For CI/full testing, use the matrix commands

**Available Environment Matrix:**
Expand Down
8 changes: 7 additions & 1 deletion hatch.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,13 @@ extra-dependencies = ["robotframework==7.2rc1"]
[envs.rfmaster]
python = "3.12"
extra-dependencies = [
"robotframework @ git+https://github.com/robotframework/robotframework.git",
"robotframework @ git+https://github.com/robotframework/robotframework.git"
]

[envs.robocopmain]
python = "3.12"
extra-dependencies = [
"robotframework-robocop @ git+https://github.com/MarketSquare/robotframework-robocop.git"
]

[envs.rfdevel]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,17 +83,26 @@ def format_robocop(

config_manager = self.parent.robocop_helper.get_config_manager(workspace_folder)

source = document.uri.to_path()
config = config_manager.get_config_for_source_file(document.uri.to_path())

if range is not None:
config.formatter.start_line = range.start.line + 1
config.formatter.end_line = range.end.line + 1

# TODO: not cached, we load all formatters everytime - but it's small cost
runner = RobocopFormatter(config_manager)
runner.config = config

model = self.parent.documents_cache.get_model(document, False)
_, _, new, _ = runner.format_until_stable(model)
if get_robot_version() >= (8, 0):
from robocop.source_file import SourceFile

# overwrite _model to stop Robocop from loading it
source_file = SourceFile(path=source, config=config, _model=model)
_, _, new, _ = runner.format_until_stable(source_file)
else:
_, _, new, _ = runner.format_until_stable(model)

if new.text == document.text():
return None
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,15 @@ def get_config(self, document: TextDocument) -> Optional[RoboCopConfig]:

return self.parent.workspace.get_configuration(RoboCopConfig, folder.uri)

def get_linter(self, workspace_folder: WorkspaceFolder) -> "RobocopLinter":
linter = self._robocop_linters.get(workspace_folder, None)

if linter is None:
config_manager = self.parent.robocop_helper.get_config_manager(workspace_folder)
linter = RobocopLinter(config_manager)
self._robocop_linters[workspace_folder] = linter
return linter

@language_id("robotframework")
@_logger.call
def collect_diagnostics(
Expand All @@ -69,23 +78,21 @@ def collect_diagnostics(
@_logger.call
def collect(self, document: TextDocument, workspace_folder: WorkspaceFolder) -> List[Diagnostic]:
from robocop.linter.rules import RuleSeverity
from robocop.linter.runner import RobocopLinter

linter = self._robocop_linters.get(workspace_folder, None)

if linter is None:
config_manager = self.parent.robocop_helper.get_config_manager(workspace_folder)

config = config_manager.get_config_for_source_file(document.uri.to_path())

linter = RobocopLinter(config_manager)
self._robocop_linters[workspace_folder] = linter
linter = self.get_linter(workspace_folder)

source = document.uri.to_path()

config = linter.config_manager.get_config_for_source_file(source)
model = self.parent.documents_cache.get_model(document, False)
diagnostics = linter.run_check(model, source, config)

if self.parent.robocop_helper.robocop_version >= (8, 0):
from robocop.source_file import SourceFile

# overwrite _model to stop Robocop from loading it
source_file = SourceFile(path=source, config=config, _model=model)
diagnostics = linter.run_check(source_file)
else:
diagnostics = linter.run_check(model, source, config)

return [
Diagnostic(
Expand Down