You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. Dismiss alert
「ここで改行するほうがキレイで良いと思います」 『いや、私はこちらのほうがキレイ良いと思います』 コードレビューでこういう議論をしたことはありませんか? 大切なことだとは思いますが、生産性にはあまり直結しません。議論を避けるために書き方を決めるほうが良いでしょう (個々の問題について逐次議論するのがエネルギーを無駄にしてしまいます。一度決めて、再利用するようにしたいものです)。 今日はそのために使える black というツールを紹介します (「私はflake8を使ってるから結構です」と思われるかもしれませんが、少し違う話なので読んでみてください)。 blackを使おう Pythonのコードを自動でフォーマットしてくれる black を紹介します。 github.com blackはPythonのコードフォーマッターで、自動的にPythonプログラムの書き方を修正してくれます。 PEP8 と
SQL、書いてますか? こと大規模データ処理の分野においてはSQLはもはや標準インターフェイスであり、 分析やらバッチやらに関わっている皆様は日々大量のSQLクエリーを生産していることと思います。 そこでちょっと気になるのが、 SQLのコーディングスタイルってどうするのが一般的なんだっけ……? という点です。 イマドキはSQLなんてO/R mapperに吐かせることが多いからなのか、 それともコードを広い範囲で共有することがそもそもないからか、 SQLのコーディングスタイルについて見聞きすることは他のプログラミング言語に比べるとだいぶ少なく、 いまいち決定版と言えるスタイルがないなと感じています。 そんなわけで本日は、SQLのコーディングスタイルについての意識を活発化させるべく、 クックパッドでわたし(青木)が使っているコーディングスタイルから特徴的な点を紹介したいと思います。 特に、分析
はじめに 本文書はSQLのスタイルガイドです。 PythonやRubyのようなプログラミング言語には有名なスタイルガイドがあり、共通のレイアウトルールに沿ったインデントや命名規則に則ったコードが生み出されています。 一方、SQLには知名度のある統一されたスタイルガイドがありません。 そのため、思いのままに書かれたSQLが散見されます。 もちろん、SQLを使ってアドホックな分析を行う場合は、必ずしもルールに沿う必要はなく、効率よく書いても良いと思います。 しかし、Webサービスやバッチの中に組み込むようなもの、つまり自分以外の誰かに読まれるSQLは、多くのプログラミング言語同様に何らかのスタイルガイドに沿うことで多くのメリットを享受できると思います。 クエリが構造化され、可読性が高まる バグの発見や修正が容易になる 改行位置やインデントなどのフォーマットの悩みが解消される スタイルガイドを共
意外とまだあんまり知られていないような気がしたので、このブログにも書いておく。 PEP8 と pep8 と pycodestyle Python には PEP8 という有名なコーディングスタイルガイドラインがある。 www.python.org そして、そのコーディングスタイルに沿ったコードになっているのかをチェックするツールとして pep8 というパッケージがあった。 pypi.python.org 過去形にするのは半分正しくなくて、上記のように今もある。 ただ、これは後方互換のために残されているだけで、もうバージョンアップはされないだろう。 今後は代わりに pycodestyle というパッケージを使うことになる。 pypi.python.org これは単にパッケージとコマンドの名前が変わっただけ。 とはいえ、こちらはバージョンアップが続くので最新の PEP8 に追従していくしチェック
概要 pep8 が pycodestyle というパッケージ名に変わってた Guido氏の提案が事の発端。 https://github.com/PyCQA/pycodestyle/issues/466 pycodelint という案も出てたが、pylint と区別がつかないので却下になってた 同時に pep257 も pydocstyle という名前に変わった https://github.com/PyCQA/pydocstyle/issues/172 自分の周りの影響範囲を軽く調べてみた。 追記(2018/02/27) ツール(ライブラリ)の pep8 の名前が pycodestyle という名前に変わったというだけで、PEP8 そのものには何も変更はないので気をつけてください。 pep8がスタイルガイドのPEP8と一緒だと混同しやすいのでツールは名前を変えようという話です。 pep2
PythonにはPEP8 (日本語訳)という 公式のコーディングスタイルあります。 どうせならちゃんとコーディングスタイルに沿った綺麗なコードが書きたいですよね。 ということでvimでPythonコードがPEP8に従っているか自動的にチェック、修正するようにします。 PEP8のチェック PEP8に従っているかチェックするにはpep8という、そのままの名前のツールを使います。 pep8 - Python style guide checker おまけとしてpyflakesという、文法チェックや未使用なimportや変数を教えてくれる便利なツールも入れときます。 pyflakes - passive checker of Python programs インストールはpipで。 ちなみに、pep8とpyflakesを合体したような、flake8というツールもあります。 flake8 - the
日頃より、アレスネットをご愛顧いただきまして誠にありがとうございます。 「ホームページサービス」のサービス提供は2016年1月31日をもちまして終了させていただきました。 これまで長らくご利用いただき、誠にありがとうございました。 今後も、皆様によりよいサービスをご提供させていただけるよう、サービス品質向上に努めて参りますので、何卒、ご理解いただけますようお願 い申し上げます。 <アレスネットをご契約のお客様へ> 後継サービスとして「userwebサービス」を提供させていただいております。 詳しくは、以下のリンクをご参照ください。 ▼「userwebサービス」のご案内 http://www.ejworks.info/userhp/alles/index.html 今後ともアレスネットをご愛顧いただけますようお願い申し上げます。 株式会社イージェーワークス アレスネット カスタマーサポート
Overview General Do Avoid Naming conventions General Tables Columns Aliasing or correlations Stored procedures Uniform suffixes Query syntax Reserved words White space Indentation Preferred formalisms Create syntax Choosing data types Specifying default values Constraints and keys Designs to avoid Appendix Reserved keyword reference Column data types SQL style guide Overview You can use this set o
先週、 Hacker News上で興味深い議論が行われました 。テーマは Linux Kernelのコーディングスタイル についてです。 議論の中で私は、 コーディングで垂直方向にそろえるインデントをとるべきか というささやかな聖戦を仕掛けました。私は全面的に賛成です。理由を説明しましょう。 垂直方向にそろえるインデントをとるとは? 簡単な例を挙げてみます。 int robert_age = 32; int annalouise_age = 25; int bob_age = 250; int dorothy_age = 56; ちょっと見ただけで、「bob_age」がおかしいと分かるでしょう。また、目視であちこち探さなくても、全ての値が整数であることが簡単に確認できます。 この考え方は 一般的に 共有 されているわけではありません。ですので、なぜ 多くの 人たち がこれを有効なスタイルガ
This webpage was generated by the domain owner using Sedo Domain Parking. Disclaimer: Sedo maintains no relationship with third party advertisers. Reference to any specific service or trade mark is not controlled by Sedo nor does it constitute or imply its association, endorsement or recommendation.
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く