Justification YAML validation accepts locations without lines and boolean integers

オープン 初心者向け
#99 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 2 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
74/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
python

調査の方向性

まず score_coverage/justify.py、特に validate_yaml と resolve_location_lines を確認し、次に justification YAML の検証テストを調べてください。行セレクターのない位置とブール値がどのように扱われるか、また id が欠落または無効な場合に検証が続行されるかを確認してください。不正な例が拒否され、エントリーに関するすべての指摘が報告されれば完了です。

索引モデルが issue の本文から書いたものです。

説明

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.

主要言語
Python
スター
0
フォーク
4
平均マージ
1日 16時間
マージ済み PR(30日)
16

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

eclipse-score/coverage_tool のほかの issue

eclipse-score/coverage_tool の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。