Justification YAML validation accepts locations without lines and boolean integers

Open Beginner friendly
#99 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 2 days

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
74/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
python

Research direction

Start with score_coverage/justify.py, especially validate_yaml and resolve_location_lines, then inspect the validation tests for justification YAML. Check how locations without line selectors and boolean values are handled, and whether validation continues after a missing or invalid id. Done means malformed examples are rejected and all findings for an entry are reported.

Written by the indexing model from the issue text.

Description

bug

Found while reviewing the user manual against the implementation at fe013fe (score_coverage/justify.py).

The justification YAML is validated before it is applied, but some malformed input passes:

  • A location without any line selector, or with only line_start or only line_end, is accepted. resolve_location_lines returns no lines for it, so the entry silently justifies nothing.
  • version: true is accepted, because bool is an int in Python. The same holds for boolean values of line, line_start, line_end and in lines.
  • An entry without id, or with a non-string id, reports only that finding; its other fields are not checked.
Reproduction
version: true
justifications:
  - id: a-b
    category: other
    platforms: [linux]
    reason: x
    locations:
      - file: a.cpp
        line_start: 3

justify.validate_yaml accepts this document. resolve_location_lines({'file': 'a.cpp', 'line_start': 3}) returns [].

Expected behavior

Reject a location that does not select at least one line, reject booleans where an integer is required, and report all findings of an entry.

Dominant language
Python
Stars
0
Forks
4
Avg merge
1d 16h
Merged PRs (30d)
16

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from eclipse-score/coverage_tool

All issues in eclipse-score/coverage_tool

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.