Lint rules¶
This page lists the rules that trials lint checks in the declarations of every experiment. A script writes the page from the rule lists in the code, so it matches the code of this version.
How the lint runs¶
Each rule is one or more pytest tests. trials lint runs the general rules first and then the rules of the project's backend. trials lint --experiment <name> lints one experiment, and the rules over shared files still run. Other flags go to pytest, so trials lint -k <test name> runs the tests of one rule. trials validate runs the lint as one of its stages.
A rule id is L and a number. L4b is a second part of L4. The numbers are shared by both lists, so the ROS 2 rules fill the gaps in the general list.
General rules¶
These rules run for every project, from robofacts/robofacts/lint.py.
| Rule | What it checks | Test |
|---|---|---|
L1 |
level_values may only map declared levels. | test_level_values_map_declared_levels_only |
L3 |
an internal factor must be CONSUMED by some command template, else it is recorded in the metadata but never applied. |
test_internal_factors_are_actually_consumed |
L4 |
every {placeholder} in a command must be a declared factor (or {bag} in a verify step or the action: the runner hands both the trial's bag directory, which is how a flight script knows where to write its flight-time commanded_waypoints.json). | test_command_placeholders_are_declared_factors |
L4b |
the same for a campaign's own setup_steps (a reset step between repeated trials): {factor} or {arg_<launch argument>}, never {bag}, because setup runs before the trial has a bag. |
test_campaign_setup_step_placeholders_are_declared_factors |
L6 |
every experiment must declare verify_steps in runner.yaml, or say why it has none with no_verify_steps: <reason>. |
test_every_experiment_declares_a_verify_step |
L7 |
a command may not reference a script that does not exist. | test_commands_reference_scripts_that_exist |
L8 |
a campaign's preflight_checklist must exist and be coherent. | test_campaign_preflight_checklists_exist_and_validate |
L9 |
every record profile (and every record_profile factor level) must be a legal value of the metadata contract's enum. | test_every_record_profile_is_a_legal_metadata_level |
L10 |
every campaign must LOAD — or be refused only because it asks for a level the factor space declares blocked: — and must record every factor it sweeps as a coverage axis of the metadata contract (the invariant plan and run enforce). |
test_campaigns_load_or_only_ask_for_a_blocked_level |
L12 |
a factor of maps_to.kind: gate (levels that bind, shadow or disable the T-0 gate per trial) is allowed only in an experiment whose runner.yaml declares simulation: true. |
test_gate_factors_only_in_simulated_experiments |
L13 |
a factor of maps_to.kind: operator (a level the operator realizes by hand, such as the room's lighting) must declare a check (a preflight check with per-level arguments, added to every trial's T-0 gate) or an explicit unchecked: <reason>. |
test_operator_factors_declare_a_check_or_why_not |
L14 |
every runner.yaml declares simulation: true|false explicitly. |
test_runner_declares_its_domain |
L15 |
a campaign's spoken cues (voice_cues, voice_announce) are well formed (campaign_spec.voice_problems, also enforced by L10), every {placeholder} in their text is a declared factor, and no cue is planned at or after runner.yaml's action_timeout_s: the runner stops the timeline when the action ends, so such a cue would never be spoken, and the operator who waits for it would wait in vain. |
test_voice_cues_are_speakable |
Rules of the ROS 2 backend¶
These rules are facts about ROS 2. They run after the general rules for a project whose backend is ros2, from robofacts_ros2/robofacts_ros2/lint_ros2.py.
| Rule | What it checks | Test |
|---|---|---|
L2 |
a launch_arg factor must name an argument the launch file declares. | test_launch_arg_factors_name_real_launch_arguments |
L5 |
a campaign's pre-flight operator_steps must not start ROS processes: a trial's setup steps tear down the previous stack first (scripts/kill_ros.sh, which matches /opt/ros/ and any *_ws/install/, or an experiment's own stop script), so anything the operator starts beforehand is killed by the trial it was started for. | test_pre_flight_operator_steps_do_not_start_ros_processes |
L11 |
every record profile, and every explicit record_topics list, must record /rosout. | test_every_record_profile_records_rosouttest_explicit_record_topics_record_rosout |
L16 |
on a real robot (simulation: false), runner.yaml's explore: block may not open every parameter. |
test_explore_does_not_open_every_parameter_of_a_real_robot |
Counts¶
The general list has 12 rules and the part L4b. The ROS 2 list has 4 rules. Together they hold 17 rule ids and 18 tests.