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

Define standard code formats and apply them to current code #32

Open
muojp opened this issue Sep 30, 2013 · 8 comments
Open

Define standard code formats and apply them to current code #32

muojp opened this issue Sep 30, 2013 · 8 comments

Comments

@muojp
Copy link
Contributor

muojp commented Sep 30, 2013

draft:

Java

Apply AOSP rule XML (with some changes; lineSplit=120, format_comments=false)

C++

  • base style: ANSI C++
  • tabs are treated as 4 spaces (still hard tabs, not soft ones)
  • not strict too much (as you know, strict C++ style guide could impact productivity)

notes:

  • For avoiding huge conflicts, we need to consider well about timing to apply.
  • Code written in the future should also obey the same rule.

We welcome for comments.

pointed out by.. many people (incl. @repeatedly )

@muojp
Copy link
Contributor Author

muojp commented Sep 30, 2013

English/日本語 would be ok on this thread.

@futoase
Copy link
Contributor

futoase commented Oct 1, 2013

Awesome 😄

@futoase
Copy link
Contributor

futoase commented Oct 8, 2013

Define standard code formats and apply them to current code

Luaの場合はどうしましょう?

What's this code format of Lua?

see https://github.com/KLab/PlaygroundOSS/tree/master/Tutorial

Try this product use of https://github.com/LuaDist/luapretty or http://lua-users.org/wiki/SourceCodeFormatter ?

@muojp
Copy link
Contributor Author

muojp commented Oct 8, 2013

In my opinion, we could skip lua code in formatting, because they have lots of "spaces for explanation" such as:

    pSimpleItem = UI_SimpleItem(    nil,                            -- arg[1]:      親となるUIタスクポインタ
                                    7000,                           -- arg[2]:      表示プライオリティ
                                    x, y,                           -- arg[3,4]:    表示位置
                                    "asset://itemimage.png.imag"    -- arg[5]:      表示assetのパス
                                )

I bet applying code formatter on these code result in ugly styling :(

@muojp
Copy link
Contributor Author

muojp commented Oct 8, 2013

http://lua-users.org/wiki/LuaStyleGuide

Indentation - Indenting often uses two spaces. This is followed in Programming in Lua, the Lua Reference Manual, Beginning Lua Programming, and the Lua users wiki. (Why this is the case, I don't know, but perhaps it is because Lua statements can tend to be deeply nested, even in a LISP or functional manner, or perhaps it is affected by the fact that the code in these examples is small and pedagogical.) You'll see other common conventions (e.g. 3-4 spaces or tabs).

2 sp is preferred, also 3 sp / 4 sp are applied, and hard tab is also applied. aggghagghghg

@muojp
Copy link
Contributor Author

muojp commented Oct 8, 2013

"Simply applying 2 sp and modifying comments on line endings to make explanations look better" seems a practical option to me.

@futoase
Copy link
Contributor

futoase commented Oct 8, 2013

I bet applying code formatter on these code result in ugly styling :(

I understand.

2 sp is preferred, also 3 sp / 4 sp are applied, and hard tab is also applied.

2 space there better?

@futoase
Copy link
Contributor

futoase commented Oct 8, 2013

"Simply applying 2 sp and modifying comments on line endings to make explanations look better" seems a practical option to me.

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants