embsim: an unknown --board should list the boards and suggest the closest

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

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

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

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
88/100
issue の種類
機能追加
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
c
領域
cli, embedded-iot

調査の方向性

tools/embsim/main.c の未知のボードに関するエラーと、tools/embsim/boards.c の boards[] テーブルおよび board_find() から始めてください。tests/golden/embsim*.sh と tests/golden/embsim/ にある既存のテスト規約を確認し、その後 EmbSim の対象テストを実行してください。microbt のようなタイプミスには microbit が提案され、意味のない名前では候補を提案せずにボード一覧が表示され、終了ステータスとエラーの先頭行が変わらなければ完了です。

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

説明

enhancement good first issue

Context. EmbSim knows many boards (see embsim --help), but a wrong name only says no:

$ ./embsim --board microbt fw.elf
embsim: unknown board 'microbt'

It should list the boards and suggest the closest, for example did you mean 'microbit'?.

Where.

  • tools/embsim/main.c, line 221: the error. The name is tried as a board (board_find), then as a part from a device pack (board_part).
  • tools/embsim/boards.c: line 217 has boards[], the table of every board; line 516 has board_find().
  • Tests: the EmbSim tests live in tests/golden/embsim*.sh and tests/golden/embsim/. Add a small one rather than extending a board's own test.

Steps.

  1. On an unknown name, print the board names from boards[], and the closest one if it is within a few edits. EmbSim is a separate program, so a small edit-distance function in tools/embsim is fine.
  2. Keep the exit status and the first line as they are; add lines after it.
  3. Add a test with a typo and with a nonsense name.

Done when --board microbt suggests microbit, a nonsense name lists the boards without a suggestion, and the test passes. Do not run tests/golden/boards.sh for this: it talks to real boards on serial ports.

Before you start: the contributor's guide has the rules. A new test counts only after it has failed against the code before your change, and a commit subject reads area: summary. Questions are welcome in the comments or in Discussions.

主要言語
C
スター
1
フォーク
2
平均マージ
20時間 55分
マージ済み PR(30日)
73

環境構築

はじめの一歩

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

EmbLinkOs/EmbCC のほかの issue

EmbLinkOs/EmbCC の issue をすべて見る

似ている issue

C の issue をもっと見る

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

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