Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Principle:MarketSquare Robotframework browser Code Quality Enforcement

From Leeroopedia

Overview

The robotframework-browser project enforces code quality across three languages -- Python, TypeScript, and Robot Framework -- using automated linting, formatting, and type-checking tools. Both check mode (for CI validation) and fix mode (for developer convenience) are supported, ensuring that code quality standards are maintained consistently across the entire codebase.

Core Concept

In a polyglot project, code quality enforcement must cover all languages involved. A single inv lint command runs all quality checks in sequence, and individual language-specific tasks are available for targeted checking. The tools operate in two modes:

  • Check mode (default) -- Reports violations without modifying files; used in CI to gate merges
  • Fix mode (explicit) -- Automatically corrects violations where possible; used during development

Python Quality Tools

Python code quality is enforced by three complementary tools:

Ruff (Format + Lint)

Ruff is a fast Python linter and formatter (written in Rust) that replaces traditional tools like flake8, isort, and black:

  • ruff format -- Enforces consistent code formatting (indentation, line length, quote style, etc.)
    • In check mode: ruff format --check reports formatting violations
    • In fix mode: ruff format auto-formats files
  • ruff check -- Checks for code quality issues (unused imports, style violations, potential bugs)
    • In fix mode: ruff check --fix auto-fixes simple violations

Both commands use configuration from pyproject.toml and target:

  • Browser/ (main library source)
  • bootstrap.py (bootstrap script)
  • tasks.py (build tasks)
  • utest/ (unit tests)
  • browser_batteries/ (BrowserBatteries package)

Mypy (Type Checking)

Mypy performs static type checking on Python code:

  • Configured via Browser/mypy.ini
  • Targets Browser/, bootstrap.py, and browser_batteries/
  • Excludes the .venv/ directory
  • Catches type errors, missing return types, incompatible assignments, and other type-related issues

TypeScript Quality Tools

ESLint

ESLint checks TypeScript code in the Node.js portion of the project:

  • Runs via npm run lint
  • Targets .ts files in the node/ directory
  • Supports incremental linting: skips if no .ts files have changed since last lint (tracked via timestamp file)
  • Can be forced with --force flag

Robot Framework Quality Tools

Robocop

Robocop is a formatter for Robot Framework test files:

  • Runs with robocop format command
  • Configured via pyproject.toml
  • Targets the atest/ directory
  • In CI mode: adds --check --diff flags to report violations without modifying files
  • Excludes specific files that are intentionally non-standard (e.g., tidy-transformer test files)

Composite Lint Task

The lint task is a composite that depends on all three language-specific tasks:

lint
  ├── lint_python  (ruff format + ruff check + mypy)
  ├── lint_node    (eslint via npm run lint)
  └── lint_robot   (robocop format)

Running inv lint executes all three in dependency order.

CI Integration

In CI environments (detected via the GITHUB_WORKFLOW environment variable):

  • Ruff runs in check mode (no auto-fixing)
  • Robocop runs with --check --diff (reports violations and shows diffs)
  • ESLint runs normally (always in check mode)
  • Any failure causes the CI pipeline to fail

Domains

  • Code_Quality -- The primary purpose is maintaining code quality standards
  • Development_Tooling -- These are developer productivity tools integrated into the build system

Implemented By

Related Topics

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment