Style Guides, Robocop, Documentation, Naming, and Maintainability: Diagnostics, Failure Modes, and Production Practices
Diagnose style and maintainability failures without destroying first-failure evidence, hiding architecture defects behind formatter convergence, or using blanket suppressions as a troubleshooting shortcut.
Learning objectives
- Apply a fixed diagnostic sequence that separates parse/import errors from Robocop policy findings and runtime failures.
- Recognize deprecated standalone Robotidy workflows and migrate to modern Robocop formatter mode.
- Protect first-failure evidence before formatting, fixing, suppressing, or upgrading tools.
- Diagnose broad suppressions, generated-source churn, ambiguous names, and documentation drift.
- Explain why style performance cost is separate from Robot execution, external latency, Pabot scheduling, and CI/container startup.
Current compatibility baseline — verified 2026-09-01.
Robot Framework 7.4.2 is the stable course baseline
and requires Python 3.8+. This chapter pins
Robocop 9.0.0, released 2026-08-26, which requires
Python 3.10+ and Robot Framework 5+. The combined mandatory lab
therefore uses Python 3.10+. The Robot Framework
community Style Guide currently identifies itself as
0.10b. Modern Robocop has two modes:
robocop check for lint/static analysis and
robocop format for formatting. Standalone Robotidy is
not the recommended new workflow because its formatter functionality
was merged into Robocop 6+. Formatting is source normalization, not
proof of good architecture.
1. Diagnostic sequence: identify the failing layer before changing source
- Preserve first-failure artifacts. Copy console output, formatter diff, source snapshot, Robot result files, and version manifest.
- Confirm versions. Python, Robot Framework, Robocop, and any relevant plugin/library.
- Confirm executed path/selection/environment/test data. Make sure the command actually scanned the files you think it did.
- Validate parse/import graph. Use Robot dry-run; a formatter is not a parser repair mechanism.
- Inspect variable scope and keyword resolution if the issue is semantic, not merely style.
- Inspect library/external-system state only if the failing test touched it.
- Inspect timing/parallel/CI/container state only when causally relevant.
- Apply the least destructive correction and rerun the smallest controlled slice.
This ordering prevents a common failure pattern: someone sees a large Robocop output, runs formatting/fixes across the tree, and loses the exact source state that produced the original parser or runtime failure.
2. Intentionally broken example: a missing END is not a formatting defect
*** Test Cases ***
Broken Conditional
IF ${True}
Log start
Save this as a disposable broken.robot and run:
python -m robot --dryrun --outputdir evidence/broken broken.robot > evidence/broken-console.txt 2>&1
robocop check broken.robot > evidence/broken-robocop.txt 2>&1
robocop format --no-overwrite --diff broken.robot > evidence/broken-format.diff 2>&1
The first evidence is the parser/dry-run failure. Do not “repair” it
by blindly applying a formatter or broad auto-fix. The semantic
correction is to close the control structure with END,
then rerun dry-run, lint, and format preview.
*** Test Cases ***
Broken Conditional
IF ${True}
Log start
END
3. Failure mode: treating standalone Robotidy as the modern default
Robotidy’s formatter functionality was merged into Robocop 6, and
standalone Robotidy is no longer the recommended new workflow. A
legacy project may still contain commands such as
robotidy tests/ or old
# robotidy: off directives. Do not delete them blindly;
first capture the existing output/config, then migrate intentionally
to robocop format and current formatter disablers.
| Legacy clue | Modern direction | Migration evidence |
|---|---|---|
robotidy path |
robocop format path |
Preview diff under pinned Robocop. |
# robotidy: off |
# fmt: off or # robocop: fmt: off
|
Same small block remains intentionally unchanged. |
| Robotidy-only config | Robocop current TOML sections | Config migration/review + formatter diff. |
4. Failure mode: mass formatting without review
Current robocop format overwrites files by default.
Pointing it at an entire mature repository can create a huge diff,
including code owned by other teams or generated files. A large
mechanical rewrite is not automatically unsafe, but it needs
isolation and review.
Safer sequence:
robocop --version
robocop format --no-overwrite --diff suites resources > evidence/full-format-preview.diff
# review scope and exclusions
robocop format suites resources
robocop format --check suites resources
python -m robot --dryrun --outputdir evidence/dryrun suites
5. Failure mode: broad suppression creates false confidence
# DO NOT use this as a migration shortcut:
# robocop: off
*** Keywords ***
Legacy Everything
Log Every future finding in this file is hidden too
A blanket disabler removes both known debt and future diagnostics. The same problem occurs when an entire source tree is ignored merely to make CI green. Narrow the exception to a specific rule/file/line where practical and keep an exception register.
6. Failure mode: zero lint findings mistaken for good architecture
*** Keywords ***
Process Customer Lifecycle
[Documentation] Processes customer lifecycle.
[Arguments] ${customer} ${payment_token}
Validate Customer ${customer}
Charge Customer ${payment_token}
Delete Old Records ${customer}
Send Welcome Message ${customer}
This may be perfectly formatted and may satisfy configured lint rules. It still mixes validation, money movement, destructive cleanup, and notification in one boundary. The correct diagnostic is architectural: split responsibilities, define idempotency and approval boundaries, and test irreversible operations independently.
7. Failure mode: rule/formatter churn after a tool upgrade
Suppose CI upgrades Robocop and suddenly reports new findings or a new formatter diff. First compare tool manifests and configuration. Do not immediately change source or suppress the new rules. Reproduce with the old version if available, then preview the new version. Decide whether each change is a desired policy improvement, a formatter migration, or a rule to stage later.
python -m pip show robotframework-robocop > evidence/robocop-version.txt
robocop check suites resources > evidence/lint-new.txt
robocop format --no-overwrite --diff suites resources > evidence/format-new.diff
A dependency upgrade belongs in a dedicated review when possible. That keeps behavior changes attributable.
8. Failure mode: generated/vendor source is rewritten
If a formatter touches generated output, stop and inspect file-discovery configuration. Remember that directly supplied paths can override normal exclusion matching unless force-exclude is enabled. Protect generated/vendor directories with explicit exclusions and verify byte hashes before and after the style job.
9. Failure mode: names and docs are mechanically valid but ambiguous
Check Status, Validate State, and
Process Data are easy to type and hard to understand. A
linter cannot infer the domain entity or expected transition. Rename
based on observable behavior:
Order Should Be Ready For Dispatch or
Build Deployment Evidence. Then update documentation to
explain constraints rather than duplicate the call steps.
Duplicated prose is another drift risk. If five tests copy the same long setup explanation, the text can diverge. Put reusable contract documentation on the shared keyword/resource and let test documentation describe scenario-specific intent.
10. Performance: measure the layer that is actually slow
| Layer | Typical cost | Wrong conclusion |
|---|---|---|
| Parsing/import | Reading project and resolving imports | “Robot runtime is slow” when only static analysis is slow. |
| Robocop lint/format | Parsing + rules/formatters + project checks | Adding Pabot to a local style job will fix everything. |
| Robot keyword execution | User/library keyword work | Blaming lint for slow browser/API calls. |
| External systems | Network/browser/database latency | Increasing style timeouts. |
| Logging/output | Large output.xml/log writes | Suppressing style rules to reduce runtime logs. |
| CI/container startup | Environment provisioning | Changing formatter configuration to fix runner startup. |
Robocop 9 uses caching, but cache correctness and project configuration still matter. Keep style jobs local and deterministic; do not introduce parallel-worker state merely to optimize a small repository.
11. Production anti-pattern checklist
- Standalone Robotidy as the default modern formatter.
- Running formatter overwrite across a large repository without a preview or clean VCS baseline.
-
Using
# robocop: offor whole-directory ignores to silence migration debt. - Assuming “0 issues” means clean architecture.
- Floating Robocop versions independently across developer machines and CI.
- Formatting generated/vendor files that will be overwritten by their generator.
- Choosing generic keyword names that hide domain intent.
- Copying documentation that restates implementation and drifts from behavior.
Knowledge check
A Robot dry-run fails on a missing END. Should you start with robocop format --fix?
No. Preserve the parser failure, correct the control structure semantically, rerun dry-run, then use formatter/linter as separate quality gates.
Why is a whole-file # robocop: off dangerous?
It hides both the known issue and unrelated future diagnostics. A narrow rule-specific exception preserves most of the policy signal.
CI suddenly gets 40 new lint findings after only the Robocop pin changed. What is the first diagnostic hypothesis?
Tool-policy drift. Confirm old/new Robocop versions and config, reproduce/preview the new rule set, then decide whether to migrate source or stage the new findings.
A suite is perfectly formatted but has a keyword that charges money and deletes records. What layer owns the defect?
Semantic architecture and safety review, not formatting. Split responsibilities and define state/idempotency/approval contracts.
Summary and bridge
Reliable style governance preserves evidence, separates parser failures from static policy, treats formatter overwrites as source mutations, and refuses false-green suppressions. Lesson 5 consolidates the chapter into a checkpoint project with before/after hashes, style decisions, justified exceptions, Libdoc, CI-style exit codes, and an operator-verifiable cleanup boundary.
Current primary references
- Robocop migration to 6+ — Robotidy merge/deprecation and current disabler syntax.
- Robocop formatter — Overwrite, diff and check behavior.
- Robocop disablers — Rule/formatter-specific suppression syntax.
- Robot Framework Style Guide — Community maintainability conventions.
Keep the academy open
Support free, practical DevOps education.
Every lesson is designed to remain readable in a browser, downloadable from GitHub, and usable without a paid learning platform. Contributions help expand and maintain the curriculum.
0x716c4Ab160C4B66F31a28AE2448BfF68fc3a2ef0
Send only Ethereum/ERC-20 compatible assets to this
address.