sakamomo554101 / YouyakuAI

日本語用の要約を行うデモサービス
0 stars 0 forks source link

lintを設定し、指摘項目を修正する #37

Closed sakamomo554101 closed 2 years ago

sakamomo554101 commented 2 years ago

概要

lint(flake8とか)を設定し、指摘項目を修正する。

sakamomo554101 commented 2 years ago

これやるかぁ。パスのインポート周りが盛大にハマりそうなんだよなぁ・・

sakamomo554101 commented 2 years ago

対応内容

sakamomo554101 commented 2 years ago

formatterも入れよう

sakamomo554101 commented 2 years ago

https://qiita.com/sin9270/items/85e2dab4c0144c79987d

blackかyapfあたりかな。

sakamomo554101 commented 2 years ago

https://hesma2.hatenablog.com/entry/2021/01/18/080000 pyproject作るか

sakamomo554101 commented 2 years ago

試しにblackでチェックしたら、ほぼ修正対象に笑 まぁ、多くは改行な気はするな。

would reformat /Users/shotasakamoto/development/python/YouyakuAI/model_pipeline/components/data_generator/tests/test_main.py
would reformat /Users/shotasakamoto/development/python/YouyakuAI/model_pipeline/components/data_generator/src/data_generator.py
would reformat /Users/shotasakamoto/development/python/YouyakuAI/model_pipeline/build_all_components.py
would reformat /Users/shotasakamoto/development/python/YouyakuAI/model_pipeline/components/data_generator/src/nlp_util.py
would reformat /Users/shotasakamoto/development/python/YouyakuAI/model_pipeline/components/trainer/tests/test_main.py
would reformat /Users/shotasakamoto/development/python/YouyakuAI/model_pipeline/components/trainer/src/dataset.py
would reformat /Users/shotasakamoto/development/python/YouyakuAI/src/api_gateway/api_gateway_util.py
would reformat /Users/shotasakamoto/development/python/YouyakuAI/src/api_gateway/queue_helper.py
would reformat /Users/shotasakamoto/development/python/YouyakuAI/src/api_gateway/main.py
would reformat /Users/shotasakamoto/development/python/YouyakuAI/model_pipeline/components/trainer/src/trainer.py
would reformat /Users/shotasakamoto/development/python/YouyakuAI/model_pipeline/components/data_generator/src/dataset_util.py
would reformat /Users/shotasakamoto/development/python/YouyakuAI/src/dashboard/dashboard_util.py
would reformat /Users/shotasakamoto/development/python/YouyakuAI/model_pipeline/components/trainer/src/trainer_component.py
would reformat /Users/shotasakamoto/development/python/YouyakuAI/src/dashboard/api_client.py
would reformat /Users/shotasakamoto/development/python/YouyakuAI/model_pipeline/pipeline.py
would reformat /Users/shotasakamoto/development/python/YouyakuAI/src/api_gateway/api.py
would reformat /Users/shotasakamoto/development/python/YouyakuAI/src/db/bigquery_util.py
would reformat /Users/shotasakamoto/development/python/YouyakuAI/src/dashboard/app.py
would reformat /Users/shotasakamoto/development/python/YouyakuAI/src/log/custom_log.py
would reformat /Users/shotasakamoto/development/python/YouyakuAI/src/db/debug_db.py
would reformat /Users/shotasakamoto/development/python/YouyakuAI/src/queue_api/kafka_helper.py
would reformat /Users/shotasakamoto/development/python/YouyakuAI/src/queue_api/queue_factory.py
would reformat /Users/shotasakamoto/development/python/YouyakuAI/src/queue_api/queue_client.py
would reformat /Users/shotasakamoto/development/python/YouyakuAI/src/db/test/test_bq_db_wrapper.py
would reformat /Users/shotasakamoto/development/python/YouyakuAI/src/queue_api/kafka_client.py
would reformat /Users/shotasakamoto/development/python/YouyakuAI/src/db/test/test_db_wrapper.py
would reformat /Users/shotasakamoto/development/python/YouyakuAI/src/api_gateway/test/test_api.py
would reformat /Users/shotasakamoto/development/python/YouyakuAI/src/queue_api/test/test_queue_client.py
would reformat /Users/shotasakamoto/development/python/YouyakuAI/src/summarizer/nlp_util.py
would reformat /Users/shotasakamoto/development/python/YouyakuAI/src/summarizer/summarizer_util.py
would reformat /Users/shotasakamoto/development/python/YouyakuAI/src/summarizer/summarizer_model.py
would reformat /Users/shotasakamoto/development/python/YouyakuAI/src/summarizer/summarizer_process.py
would reformat /Users/shotasakamoto/development/python/YouyakuAI/src/summarizer/test/test_summarizer.py
would reformat /Users/shotasakamoto/development/python/YouyakuAI/src/db/db_wrapper.py
Oh no! 💥 💔 💥
34 files would be reformatted, 14 files would be left unchanged.
sakamomo554101 commented 2 years ago
sakamomo554101 commented 2 years ago

お、一番の懸念がimport周りだったけど、下記のように訂正してくれるなら、大丈夫そう。

from sqlalchemy_utils.functions.orm import table_name
-sys.path.append(os.path.join(os.path.dirname(__file__), '../log'))
+
+sys.path.append(os.path.join(os.path.dirname(__file__), "../log"))
 from custom_log import AbstractLogger
sakamomo554101 commented 2 years ago

テストもパスしたし、ローカルで試しにアプリ動作させても大丈夫そう。 あとは、開発環境構築手順を軽く書いておく