Fix ruff and ty linting issues across codebase#9
Merged
Conversation
Contributor
Am1n3e
commented
Feb 2, 2026
- Add stricter ruff rules (ANN, TCH, ARG, PT, D1, C90, PLR)
- Configure ty rules for type checking
- Add GitHub Actions lint workflow
- Fix type annotations and missing return types
- Sort all exports alphabetically
- Remove unused import
fee44af to
dd64c39
Compare
There was a problem hiding this comment.
Pull request overview
This PR tightens linting and type-checking (Ruff + ty), adds a CI lint workflow, and updates the codebase with type hints, docstrings, and minor refactors to satisfy the new rules. Most changes are non-functional and focus on consistency, explicitness, and making types and public APIs clearer.
Changes:
- Configure
tyfor stricter static type checking and significantly expand Ruff rules (annotations, complexity, docstrings, and style) inpyproject.toml. - Add a GitHub Actions workflow to run Ruff linting/format checks and
tytype checks on pushes and pull requests. - Widespread addition of type hints, refined docstrings, minor refactors to simplify control flow, and reordering of
__all__exports and imports for clarity and lint compliance across core, API, types, and evaluation modules.
Reviewed changes
Copilot reviewed 48 out of 49 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/webarena_verified/types/tracing.py | Adds docstrings and type hints to network trace models, centralizes imports, and clarifies response/post data handling. |
| src/webarena_verified/types/task.py | Extends typing (e.g., _missing_ uses Any and Self), tweaks docstring wording, and wraps a long __repr__ string. |
| src/webarena_verified/types/eval.py | Documents eval result models more thoroughly, adjusts assertion logic messages, and refines factory methods with type hints and clearer asserts. |
| src/webarena_verified/types/config.py | Wraps long docstrings, adds a validator docstring, and simplifies branches by removing redundant else blocks. |
| src/webarena_verified/types/agent_response.py | Reflows long docstrings for Status and FinalAgentResponse fields to satisfy line-length and style linting. |
| src/webarena_verified/types/init.py | Reorders __all__ to an alphabetical, grouped export order for clarity. |
| src/webarena_verified/environments/site_handler.py | Imports Any for **kwargs typing, removes unnecessary type-ignores, and refines protocol signatures. |
| src/webarena_verified/environments/patches/shopping/p01_contact_form.py | Simplifies a success/failure branch by dropping redundant else. |
| src/webarena_verified/environments/patches/reddit/p02_configure_http_client.py | Similar simplification of verification failure branch (no functional change). |
| src/webarena_verified/environments/patches/reddit/p01_remove_rate_limits.py | Simplifies control flow in annotation removal and verification logging. |
| src/webarena_verified/environments/init.py | Imports SiteInstanceHandler and updates __all__ to re-export environment utilities (currently includes a non-existent EnvCtrlClient, which is problematic). |
| src/webarena_verified/core/utils/network_event_utils.py | Keeps lazy imports but annotates them with Ruff noqa for circular import handling. |
| src/webarena_verified/core/utils/logging/logging_helper.py | Adds Generator typing for the file logging context manager and return type hints. |
| src/webarena_verified/core/utils/logging/init.py | Types setup_webarena_verified_logging, and reorders __all__ to group exported logging helpers. |
| src/webarena_verified/core/utils/jsonpath_utils.py | Adds type hints, simplifies branching (separate if chains), and clarifies deserialization helper behavior. |
| src/webarena_verified/core/utils/immutable_obj_helper.py | Simplifies control flow in (de)serialization helpers and types JSON encoder/decoder __init__ variadics. |
| src/webarena_verified/core/utils/init.py | Reorders __all__ to group logger utilities and JSONPath helpers coherently. |
| src/webarena_verified/core/evaluation/value_normalizer.py | Tightens kwargs typing, renames locals for clarity, documents object/array normalization, and simplifies branching. |
| src/webarena_verified/core/evaluation/value_comparator.py | Simplifies conditionals in array and recursive comparison paths without changing behavior. |
| src/webarena_verified/core/evaluation/evaluators/network_event_evaluator.py | Adds type checking imports, annotates normalization helpers, simplifies branches, and makes SerializableMappingProxyType imports type-only. |
| src/webarena_verified/core/evaluation/evaluators/base.py | Documents and types core evaluator hooks, adjusts abstract method signatures, and simplifies normalized-value reporting. |
| src/webarena_verified/core/evaluation/evaluators/agent_response_evaluator.py | Refines return types, ensures normalization returns MappingProxyType, and clarifies kwargs typing for comparisons. |
| src/webarena_verified/core/evaluation/evaluators/init.py | Reorders __all__ to start with the registry then core evaluator classes. |
| src/webarena_verified/core/evaluation/data_types/url.py | Adds Callable typing for URL helpers, documents deepcopy and base-path matching, and slightly refactors SSH normalization and constructor signatures. |
| src/webarena_verified/core/evaluation/data_types/month.py | Simplifies range-check branches and removes superfluous else/pass while preserving error semantics. |
| src/webarena_verified/core/evaluation/data_types/markdown_string.py | Collapses trailing-whitespace stripping into a single return expression. |
| src/webarena_verified/core/evaluation/data_types/full_address.py | Moves re/us imports to module scope and simplifies ZIP length validation branches. |
| src/webarena_verified/core/evaluation/data_types/empty.py | Normalization now returns None implicitly via bare return and simplifies string cleanup. |
| src/webarena_verified/core/evaluation/data_types/duration.py | Imports pydantic core schema tools at top, types __get_pydantic_core_schema__, adjusts casts, and simplifies normalization string cleanup. |
| src/webarena_verified/core/evaluation/data_types/distance.py | Removes an unused pass in numeric parsing error-handling. |
| src/webarena_verified/core/evaluation/data_types/coordinates.py | Imports deepcopy at top, types __init__, and refines error reporting for missing lat/lon keys. |
| src/webarena_verified/core/evaluation/data_types/boolean.py | Simplifies boolean string normalization branches and exception paths. |
| src/webarena_verified/core/evaluation/data_types/base64_string.py | Collapses trailing whitespace stripping into a single return. |
| src/webarena_verified/core/evaluation/data_types/base.py | Types constructor’s callback, adjusts docstring comments for Ruff, refactors hashing/__repr__ branching, and simplifies string normalization. |
| src/webarena_verified/core/evaluation/data_types/init.py | Reorders exported normalized type classes, placing URL first and grouping similar types. |
| src/webarena_verified/core/init.py | Reorders __all__ to list logging_helper before setup_webarena_verified_logging. |
| src/webarena_verified/api/webarena_verified.py | Promotes some internal imports to module scope, adds type hints to methods, refines docstrings, and simplifies configuration loading logic with clearer branching. |
| src/webarena_verified/api/internal/subsets_manager.py | Typing of __init__ updated to return None. |
| src/webarena_verified/api/internal/submission_handler.py | Types __init__ and simplifies submission creation by returning _package_tasks directly. |
| src/webarena_verified/api/internal/patch_manager.py | Types __init__ and clarifies docstring for injected patch executor. |
| src/webarena_verified/api/internal/evaluator.py | Types __init__, simplifies return paths in evaluation, and streamlines agent_response and network_trace parsing logic. |
| src/webarena_verified/api/internal/data_reader.py | Documents and types the data reader, adding property docstrings for tasks and task map. |
| src/webarena_verified/api/internal/init.py | Reorders __all__ to list patch/subset managers before reader/evaluator. |
| src/webarena_verified/main.py | Adds type hints for CLI helpers, reflows long help text examples, imports glob at top-level, and slightly refactors agent-response transformation for clarity. |
| src/webarena_verified/init.py | Reorders __all__ to export WebArenaVerified before logger. |
| pyproject.toml | Configures ty rules, expands Ruff rule set and per-file ignores, adds complexity limits, and documents linting conventions. |
| examples/agents/utils.py | Ensures env_config is initialized before the loop and uses an explicit is None check for missing environment configs. |
| .gitignore | Tweaks the downloads/ ignore pattern and adds an ignore for a generated Gatus config file. |
| .github/workflows/lint.yml | Adds a new GitHub Actions workflow for Ruff linting/format checking and ty type checking on pushes/PRs (currently references a non-standard runs-on label). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Add stricter ruff rules (ANN, TCH, ARG, PT, D1, C90, PLR) - Configure ty rules for type checking - Add GitHub Actions lint workflow - Fix type annotations and missing return types - Sort __all__ exports alphabetically - Remove unused import
dd64c39 to
e1f4209
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.