Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Suggest `match` with `regexp` instead of `regexp-match`

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

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

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
45/100
issue の種類
機能追加
明瞭さ
明確に書かれている
活発さ
停滞
領域
tooling

調査の方向性

リンクされている drracket/browser/private/html.rkt の例と、提供されている resyntax/test のテストケースから始め、次に推奨機能の実装と regexp-match および match パターンに関する既存のテストを見つけてください。示されているテストがパスし、名前のない複数のキャプチャグループを含むケースや lambda ではない分岐が引き続き推奨されない状態になれば完了です。

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

説明

new lint

In this code, the use of cond and regexp-match can be expressed more cleanly using match with the regexp pattern. This probably shouldn't be rewritten unless 1) every non-else branch of the cond is using the lambda-based form and 2) all of the match patterns use define to name the extracted groups, if there are multiple groups. So this test case ought to pass:

#lang resyntax/test
require: resyntax/default-recommendations default-recommendations
header:
- #lang racket

test: "original code should be refactorable to new code"
--------------------
(define re #rx"^[ \t\n]*([0-9]+)[ \t\n]*,(.*)$")
(define (f str)
  (cond
    [(regexp-match re str)
     =>
     (lambda (m)
       (define a (cadr m))
       (define b (caddr m))
       (list a b))]
    [else 'else]))
====================
(define re #rx"^[ \t\n]*([0-9]+)[ \t\n]*,(.*)$")
(define (f str)
  (match str
    [(regexp re (list _ a b)) (list a b)]
    [else 'else]))
--------------------

There are some similar cases in DrRacket's codebase but refactoring all of them is questionable. The cases where there's multiple capture groups and none of them have named variables associated with them ought to be left alone.

主要言語
Racket
スター
70
フォーク
11
PR マージ指標
30日以内にマージされた PR はありません

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

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

jackfirth/resyntax のほかの issue

jackfirth/resyntax の issue をすべて見る

似ている issue

DevTools の issue をもっと見る

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

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