Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

エラーメッセージの改善 #21

Closed
azu opened this issue Mar 4, 2019 · 4 comments
Closed

エラーメッセージの改善 #21

azu opened this issue Mar 4, 2019 · 4 comments
Labels
help wanted Extra attention is needed Status: PR Welcome Welcome to Pull Request

Comments

@azu
Copy link
Member

azu commented Mar 4, 2019

箇条書き: "である"調 と "ですます"調 が混在
=> "ます" がですます調
Total:
である  : 1
ですます: 2

イマイチ意図がわかりにくい。
何を直したらこのエラーが消えるかを明示する

@KEINOS
Copy link
Contributor

KEINOS commented Apr 21, 2020

どちらが対象であるかを明示した方がいいかと思います。

箇条書き: "である"調 と "ですます"調 が混在
=> 箇条書きは "ですます"調 に統一してください。
Total:
である  : 1
ですます: 2

@azu azu added help wanted Extra attention is needed Status: PR Welcome Welcome to Pull Request labels Apr 21, 2020
@azu
Copy link
Member Author

azu commented Apr 21, 2020

outputMessage(token) {
const overType = this.getOverType();
if (overType === "である") {
// である優先 => 最後の"ですます"を表示
return `"である"調 と "ですます"調 が混在
=> "${token.value}" がですます調
Total:
である : ${this.dearuCount}
ですます: ${this.desumasuCount}
`;
} else if (overType === "ですます") {
// ですます優先 => 最後の"である"を表示
return `"である"調 と "ですます"調 が混在
=> "${token.value}" がである調
Total:
である : ${this.dearuCount}
ですます: ${this.desumasuCount}
`;
}

preferを指定している場合と指定していない場合でメッセージは別々にした方がいいとは思います。

  • preferが指定してある場合は、「統一してください」でよさそうです
  • preferが指定してない場合は、利用してる数で優先する書き方を出してるだけなので、事実だけを表示したほうが良い気がします。

このプロジェクトのCode of Conductはこちらにあるので参照してください。

https://github.com/textlint-ja/textlint-ja/blob/master/CODE_OF_CONDUCT.md

@KEINOS
Copy link
Contributor

KEINOS commented Apr 22, 2020

確かに prefer 指定がないのに「統一」はおかしいですね。また、「箇条書きは〜に統一してください」の「箇条書き」も、引っ張ってくるのも修正箇所が多そうなので、以下のような文面ではどうでしょう?これであれば、私も PR のお手伝いできるかも。

箇条書き: "である"調 と "ですます"調 が混在
=> "ですます"調 の文体に、次の "である"調 の箇所があります: "であるかは、" 
Total:
である  : 1
ですます: 2
本文: "である"調 と "ですます"調 が混在
=> "である"調 の文体に、次の "ですます"調 の箇所があります: "です" 
Total:
である  : 3
ですます: 1

本当は、できれば -f pretty-error 時にも表示される該当行と文字位置も出せればより親切だと思うのですが、オブジェクトのどのプロパティを引っ張ってくればいいのかわかりません。

箇条書き: "である"調 と "ですます"調 が混在
=> "ですます"調 の文体に、次の "である"調 の箇所があります: "であるかは、" (3行目19文字目)
Total:
である  : 1
ですます: 2
本文: "である"調 と "ですます"調 が混在
=> "である"調 の文体に、次の "ですます"調 の箇所があります: "です"  (4行目20文字目)
Total:
である  : 3
ですます: 1

KEINOS added a commit to KEINOS/Fork_textlint-rule-no-mix-dearu-desumasu that referenced this issue Apr 22, 2020
KEINOS added a commit to KEINOS/Fork_textlint-rule-no-mix-dearu-desumasu that referenced this issue Apr 22, 2020
エラー時何調の文体を期待しているか明確にした。
「〜が〜調」→「〜調の文体に、次の〜調の箇所があります: 〜」
textlint-ja#21
@azu
Copy link
Member Author

azu commented Apr 24, 2020

行数の表示はformatter側の仕事なのでルール側では出さなくていい気がしますね。
(データとして行数などは入ってるので、メッセージとして入れてしまうと2重になるため)

@azu azu closed this as completed in a310688 Apr 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed Status: PR Welcome Welcome to Pull Request
Projects
None yet
Development

No branches or pull requests

2 participants