Skip to content

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

Open

Description

@muojp

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 )

Activity

  1. muojp commented on Sep 30, 2013

    @muojp
    ContributorAuthor

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

  2. futoase commented on Oct 1, 2013

    @futoase
    Contributor

    Awesome 😄

  3. futoase commented on Oct 8, 2013

    @futoase
    Contributor

    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 ?

  4. muojp commented on Oct 8, 2013

    @muojp
    ContributorAuthor

    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 :(

  5. muojp commented on Oct 8, 2013

    @muojp
    ContributorAuthor

    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

  6. muojp commented on Oct 8, 2013

    @muojp
    ContributorAuthor

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

  7. futoase commented on Oct 8, 2013

    @futoase
    Contributor

    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?

  8. futoase commented on Oct 8, 2013

    @futoase
    Contributor

    "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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions