Skip to content

Conversation

@lemonadern
Copy link
Collaborator

@lemonadern lemonadern commented Oct 31, 2025

Summary

  • Linter で 実装予定の CST ルールのうち、未実装であったルールを2つ追加実装しました
  • 追加したルール
    1. no-not-in: NOT IN の検出
    2. no-wildcard-projection: ワイルドカード * による列指定の検出

1. no-not-in: NOT IN の検出

原則not in(select~)は使用せずに、not exists (select~)を使用する。
NOT IN句は、内部的にソートマージの結合をすることでテーブルをフルスキャンする場合があるため、性能が悪化する可能性がある。
コーディング規約

  • in_expr を起点に実行され、その前にあるトークンの並びが IN_P, NOT_LA と続いた場合に検出します。

2. no-wildcard-projection: ワイルドカード * による列指定の検出

検索

(中略)

  • 全列ワイルドカード「*」の使用はせず、カラム名を明記する

コーディング規約

  • target_el を起点に、 *tbl.* というケースの列指定を検出します。
  • 関数などで現れるアスタリスク(e.g. count(*) )は対象外です

@lemonadern lemonadern marked this pull request as ready for review October 31, 2025 09:39
@lemonadern lemonadern force-pushed the feat/linter-cst-rules branch 2 times, most recently from 90d75c5 to 15a0781 Compare November 4, 2025 06:42
@lemonadern lemonadern changed the title feat: no-not-in rule feat(linter rule): no-not-in, no-wildcard-projection Nov 4, 2025
@lemonadern lemonadern force-pushed the feat/linter-cst-rules branch from 15a0781 to 6198551 Compare November 4, 2025 06:54
@tanzaku tanzaku merged commit 1531731 into feat/linter Nov 13, 2025
8 checks passed
@tanzaku tanzaku deleted the feat/linter-cst-rules branch November 13, 2025 05:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants