framgia / coding-standards Goto Github PK
View Code? Open in Web Editor NEWFramgia's coding standards
Framgia's coding standards
1行で収まるときには if や unless を後置にするという規約についてですが、後置にすることで80文字制限を越えてしまう場合にはどうしましょうか?普通の if文にしますか?
Please translate this.
#73
メソッドチェーンの途中で改行する場合、ドットを次の行に書いたほうが、処理が続いてる感が出て分かりやすいと思います。これも規約に盛り込みませんか?
"hogehoge".something_long_long_method(arg1)
.other_cool_long_method(arg2)
.another_awsome_long_method(arg3)
変数名、メソッド名はcamelCaseとsnake_caseとかどんな命名規則がいいですか?
Googleは
functionNamesLikeThis, variableNamesLikeThis, ClassNamesLikeThis, EnumNamesLikeThis, methodNamesLikeThis, CONSTANT_VALUES_LIKE_THIS, foo.namespaceNamesLikeThis.bar, and filenameslikethis.js
こんな感じです。
ベトナム語への翻訳をお願いします。
https://github.com/framgia/coding-standards/blob/master/ja/rails/standard.md#-6
Railsビューの規約に、<% %>
を書くときの規約を加えましょう。
例えば、以下のように書くときには、必ず%
の内隣に空白を入れるなど…
<% hogehoge %>
Please translate Framgia's Git flow.
https://github.com/framgia/coding-standards/blob/master/ja/git/flow.md
コールバックにメソッド名では無く、処理を設定する時には、ブロックでは無く、lambda で記述する。
before_filter{@users = User.all}
before_filter ->{@users = User.all}
Please translate this into Vietnamese.
https://github.com/framgia/coding-standards/pull/78/files
以下のように、仮引数が多くてdef文が一行80文字の制限を越えてしまう場合、例外的に仮引数を括弧で括るのを認めても良いと思います。
def apply_matching_rule category_select, subcategory_select, apply, tax_select, matching_rule
例えば以下のようにできます。
def apply_matching_rule(
category_select, subcategory_select, apply, tax_select, matching_rule)
もしくは
def apply_matching_rule(category_select, subcategory_select, apply,
tax_select, matching_rule)
There MUST NOT be a hard limit on line length; the soft limit MUST be 120 characters; lines SHOULD be 80 characters or less.
Không có hard limit về độ dài của một dòng; soft limit phải là 120 chữ. Một dòng nên có không quá 80 chữ.
Phải nói rõ là "chữ cái đơn" hoặc "ký tự", vì "chữ" = word .
一行の中に改行できそうな場所が複数ある場合における、改行位置の優先度についてです。
以下のようなコードがあり、これを2行に分けるとします。
@statements = sort_statements(params[:order], @statements, params[:type_order])
分けかたとしては以下の3通りが挙げられます。どれが望ましいですか?
@statements =
sort_statements(params[:order], @statements, params[:type_order])
@statements = sort_statements(
params[:order], @statements, params[:type_order])
@statements = sort_statements(params[:order],
@statements, params[:type_order])
個人的には一番上が一番読み易いですが、それだけだと対応できない場合があるので、優先度付けしましょう。
scopeの定義でラムダが長くなってしまうときに、一行80文字の制約を緩めますか?それとも改行させますか?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.