-
Notifications
You must be signed in to change notification settings - Fork 0
Conversation
c84b3c0
to
6fc535f
Compare
テストが落ちていますね。 この手の問題があるので、PRを出す前には一通りのチェック(lint/type-check/test)は
|
bee_slack_app/service/review.py
Outdated
limit: int, | ||
limit: Optional[int], | ||
keys: list[ReviewItemKey], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
limit を空(None)でも受けられるようにしたい場合、空で呼ぶ時には指定しなくても良いように
デフォルト引数にしてしまうのが良いと思います。
次のkeysも同様で、指定なしで呼ぶ時には、空(Noneや空のlist)を渡すよりは、引数をつけない
という形にした方が良いです。
多分こんな感じで書けるはず。
limit: Optional[int] = None,
keys: list[ReviewItemKey] = [],
参考:
こうすることで、今回は呼び出す側(homeのViewControllde)からはlimitやkeysのことを意識せずに
呼べるのでコードがスッキリします。
例えば、homeのコードだけを見た人は、「なんでlimitとかkeysとか渡してるの?」となるので。
多分呼ぶ側はこうなるかな。
reviews = get_reviews(logger=getLogger())
homeからすると、limitもkeysも知らなくていことなので、わざわざ空の値を用意して入れるのではなく
最初から引数として渡さない方が良いかなと思います。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@takuya-okamoto-esm 対応しました。
reviews = get_reviews(logger=getLogger(), limit=None, keys=[]) | ||
|
||
if reviews is None: | ||
review_count_all = 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
命名規則は半分趣味の問題ですが。
一般的に、変数名は名詞にするのが良い感じになりやすいですね。
その場合「すべての」という修飾は単語の前に持ってきた方が英語っぽいので
例えば岡本だったら total_review_count
とかにするかなあ、と思います。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
変数名を見直しました。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
変数名を見直しました。
失礼、 |
close #222