Lint and format with Robocop
Chapter lab: Team tooling
This chapter works in a prepared project. Download it before the first task; it unpacks into its own folder.
Download ch25-team-tooling.zip
Or fetch and unpack it from a terminal in VS Code:
curl -fsSLO https://manykarim.github.io/robotframework-essentials-web/labs/ch25-team-tooling.zip && unzip -q ch25-team-tooling.zip && rm ch25-team-tooling.zipInvoke-WebRequest https://manykarim.github.io/robotframework-essentials-web/labs/ch25-team-tooling.zip -OutFile ch25-team-tooling.zip; Expand-Archive ch25-team-tooling.zip -DestinationPath .; Remove-Item ch25-team-tooling.zipOpen the folder in VS Code with code rfe-ch25-team-tooling (or File → Open Folder…) and accept the recommended RobotCode and Python extensions. Then set it up:
uv syncpython3 -m venv .venvsource .venv/bin/activatepip install -r requirements.txtpython -m venv .venv.venv\Scripts\Activate.ps1pip install -r requirements.txtKeep the environment active in every terminal where you run lesson commands.
poetry install --no-rootPython 3.13 or newer is required; uv installs it when it is missing.
Open in browserNo setup? Try the lab right here: its files, an editor and a terminal, running in your browser.
What's inside
Directoryrfe-ch25-team-tooling/
Directory.vscode/
- extensions.json
Directorychecks/
- alpha.robot
- beta.robot
- unformatted.robot
- .gitignore
- .python-version
- LAB.md
- pyproject.toml
- README.md
- requirements.txt
- uv.lock
Two tools keep a team’s suites healthy, and both ship in one package — Robocop.
robocop checklints: it flags style and correctness issues — unclear names, missing documentation, inconsistent spacing, suspicious patterns. Reading its findings is how you learn a team’s conventions.robocop formatformats: it rewrites files to a consistent layout — standard indentation, cell spacing, casing — so nobody argues about style in review.
Task 1 — Lint the suites
Section titled “Task 1 — Lint the suites”Run the linter over checks/:
uv run robocop check checksrobocop check checkspoetry run robocop check checksRobocop prints each issue with a rule id you can look up:
A real project tunes which rules apply; for now, just read what it surfaces.
Done when
you ran robocop check.
Task 2 — Format the messy suite
Section titled “Task 2 — Format the messy suite”The bundled checks/unformatted.robot is deliberately cramped — two-space
indentation, single-spaced cells. Let Robocop fix it:
uv run robocop format checks/unformatted.robotrobocop format checks/unformatted.robotpoetry run robocop format checks/unformatted.robotOpen the file: it is now standard four-space, cleanly separated — the same formatting the rest of the course uses.
Done when
checks/unformatted.robot is consistently formatted.
Check your understanding
Quick recall. Your first answer stays in this browser; the quiz never blocks your progress.
robocop checkdoes what?It is the linter;
robocop formatis the formatter. Both ship in the Robocop package.Show the answer
Answer: lints — flags style and correctness issues — It is the linter;
robocop formatis the formatter. Both ship in the Robocop package.Why format with a tool?
A formatter enforces one consistent style automatically.
Show the answer
Answer: so layout is consistent and not argued over in review — A formatter enforces one consistent style automatically.
Key terms
- robocop checkcommand
- Lint Robot Framework files for style and correctness issues.
- robocop formatcommand
- Rewrite files to a consistent standard format.