Skip to content

Instantly share code, notes, and snippets.

@kristopherjohnson
Last active February 18, 2020 13:51
Show Gist options
  • Select an option

  • Save kristopherjohnson/5b2c4a1c725bcbf7a38e to your computer and use it in GitHub Desktop.

Select an option

Save kristopherjohnson/5b2c4a1c725bcbf7a38e to your computer and use it in GitHub Desktop.

Revisions

  1. kristopherjohnson revised this gist Jan 9, 2015. 1 changed file with 6 additions and 3 deletions.
    9 changes: 6 additions & 3 deletions .clang-format
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,10 @@
    BasedOnStyle: Webkit
    BreakBeforeBraces: Allman
    BreakConstructorInitializersBeforeComma: false
    ConstructorInitializerAllOnOneLineOrOnePerLine: true
    Cpp11BracedListStyle: true
    IndentCaseLabels: true
    MaxEmptyLinesToKeep: 2
    PointerBindsToType: false
    BreakBeforeBraces: Allman
    Cpp11BracedListStyle: true

    SpacesBeforeTrailingComments: 2
    Standard: Cpp11
  2. kristopherjohnson revised this gist Jan 9, 2015. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions .clang-format
    Original file line number Diff line number Diff line change
    @@ -2,3 +2,6 @@ BasedOnStyle: Webkit
    IndentCaseLabels: true
    MaxEmptyLinesToKeep: 2
    PointerBindsToType: false
    BreakBeforeBraces: Allman
    Cpp11BracedListStyle: true

  3. kristopherjohnson revised this gist Aug 16, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion format.sh
    Original file line number Diff line number Diff line change
    @@ -14,7 +14,7 @@
    # - If you use Xcode, install the ClangFormat-Xcode plugin. See instructions at
    # <https://github.com/travisjeffery/ClangFormat-Xcode/>.
    # After installation, the executable can be found at
    # ~/Library/Application Support/Alcatraz/Plug-ins/ClangFormat/bin/clang-format.
    # $HOME/Library/Application Support/Alcatraz/Plug-ins/ClangFormat/bin/clang-format.
    #
    # - Download an LLVM release from <http://llvm.org/releases/download.html>.
    # For OS X, use the pre-built binaries for "Darwin".
  4. kristopherjohnson revised this gist Aug 16, 2014. 1 changed file with 4 additions and 1 deletion.
    5 changes: 4 additions & 1 deletion format.sh
    Original file line number Diff line number Diff line change
    @@ -21,9 +21,12 @@
    #
    # - Build the LLVM tools from source. See the documentation at <http://llvm.org>.

    # Change this if your clang-format executable is somewhere else
    CLANG_FORMAT="$HOME/Library/Application Support/Alcatraz/Plug-ins/ClangFormat/bin/clang-format"

    for DIRECTORY in MyApp MyAppTests MyLibrary MyLibraryTests
    do
    echo "Formatting code under $DIRECTORY/"
    find "$DIRECTORY" \( -name '*.h' -or -name '*.m' -or -name '*.mm' \) -print0 | xargs -0 clang-format -i
    find "$DIRECTORY" \( -name '*.h' -or -name '*.m' -or -name '*.mm' \) -print0 | xargs -0 "$CLANG_FORMAT" -i
    done

  5. kristopherjohnson revised this gist Aug 16, 2014. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion format.sh
    Original file line number Diff line number Diff line change
    @@ -21,7 +21,8 @@
    #
    # - Build the LLVM tools from source. See the documentation at <http://llvm.org>.

    for DIRECTORY in MMQA MMQATests; do
    for DIRECTORY in MyApp MyAppTests MyLibrary MyLibraryTests
    do
    echo "Formatting code under $DIRECTORY/"
    find "$DIRECTORY" \( -name '*.h' -or -name '*.m' -or -name '*.mm' \) -print0 | xargs -0 clang-format -i
    done
  6. kristopherjohnson revised this gist Aug 16, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion format.sh
    Original file line number Diff line number Diff line change
    @@ -23,6 +23,6 @@

    for DIRECTORY in MMQA MMQATests; do
    echo "Formatting code under $DIRECTORY/"
    find "$DIRECTORY" \( -name '*.h' -or -name '*.m' -or -name '*.mm' \) -print0 | xargs -0 clang-format -style=file -i
    find "$DIRECTORY" \( -name '*.h' -or -name '*.m' -or -name '*.mm' \) -print0 | xargs -0 clang-format -i
    done

  7. kristopherjohnson revised this gist Aug 16, 2014. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions format.sh
    Original file line number Diff line number Diff line change
    @@ -21,8 +21,8 @@
    #
    # - Build the LLVM tools from source. See the documentation at <http://llvm.org>.

    for DIRECTORY in MyApp MyAppTests MyLibrary MyLibraryTests
    do
    for DIRECTORY in MMQA MMQATests; do
    echo "Formatting code under $DIRECTORY/"
    find "$DIRECTORY" -name '*.h' -o -name '*.m' -o -name '*.mm' -print0 | xargs -0 clang-format -style=file -i
    find "$DIRECTORY" \( -name '*.h' -or -name '*.m' -or -name '*.mm' \) -print0 | xargs -0 clang-format -style=file -i
    done

  8. kristopherjohnson revised this gist Aug 16, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion format.sh
    Original file line number Diff line number Diff line change
    @@ -24,5 +24,5 @@
    for DIRECTORY in MyApp MyAppTests MyLibrary MyLibraryTests
    do
    echo "Formatting code under $DIRECTORY/"
    find "$DIRECTORY" -name '*.h' -o -name '*.m' -print0 | xargs -0 clang-format -style=file -i
    find "$DIRECTORY" -name '*.h' -o -name '*.m' -o -name '*.mm' -print0 | xargs -0 clang-format -style=file -i
    done
  9. kristopherjohnson revised this gist Aug 16, 2014. 1 changed file with 2 additions and 11 deletions.
    13 changes: 2 additions & 11 deletions .clang-format
    Original file line number Diff line number Diff line change
    @@ -1,13 +1,4 @@
    BasedOnStyle: Chromium
    AlignTrailingComments: true
    BreakBeforeBraces: Stroustrup
    ColumnLimit: 0
    IndentWidth: 4
    KeepEmptyLinesAtTheStartOfBlocks: false
    BasedOnStyle: Webkit
    IndentCaseLabels: true
    MaxEmptyLinesToKeep: 2
    ObjCSpaceAfterProperty: true
    ObjCSpaceBeforeProtocolList: true
    PointerBindsToType: false
    SpacesBeforeTrailingComments: 1
    TabWidth: 8
    UseTab: Never
  10. kristopherjohnson revised this gist Aug 16, 2014. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions format.sh
    Original file line number Diff line number Diff line change
    @@ -5,6 +5,9 @@
    #
    # The file .clang-format in this directory specifies the formatting parameters.
    #
    # Files are changed in-place, so make sure you don't have anything open in an
    # editor, and you may want to commit before formatting in case of awryness.
    #
    # Note that clang-format is not included with OS X or Xcode; you must
    # install it yourself. There are multiple ways to do this:
    #
  11. kristopherjohnson revised this gist Aug 16, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion format.sh
    Original file line number Diff line number Diff line change
    @@ -18,7 +18,7 @@
    #
    # - Build the LLVM tools from source. See the documentation at <http://llvm.org>.

    for DIRECTORY in MyProject MyProjecTests MyLibrary
    for DIRECTORY in MyApp MyAppTests MyLibrary MyLibraryTests
    do
    echo "Formatting code under $DIRECTORY/"
    find "$DIRECTORY" -name '*.h' -o -name '*.m' -print0 | xargs -0 clang-format -style=file -i
  12. kristopherjohnson revised this gist Aug 16, 2014. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion format.sh
    Original file line number Diff line number Diff line change
    @@ -18,7 +18,8 @@
    #
    # - Build the LLVM tools from source. See the documentation at <http://llvm.org>.

    for DIRECTORY in MyProject MyProjecTests MyLibrary; do
    for DIRECTORY in MyProject MyProjecTests MyLibrary
    do
    echo "Formatting code under $DIRECTORY/"
    find "$DIRECTORY" -name '*.h' -o -name '*.m' -print0 | xargs -0 clang-format -style=file -i
    done
  13. kristopherjohnson revised this gist Aug 16, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion format.sh
    Original file line number Diff line number Diff line change
    @@ -20,5 +20,5 @@

    for DIRECTORY in MyProject MyProjecTests MyLibrary; do
    echo "Formatting code under $DIRECTORY/"
    find $DIRECTORY -name '*.h' -o -name '*.m' -print0 | xargs -0 clang-format -style=file -i
    find "$DIRECTORY" -name '*.h' -o -name '*.m' -print0 | xargs -0 clang-format -style=file -i
    done
  14. kristopherjohnson created this gist Aug 15, 2014.
    13 changes: 13 additions & 0 deletions .clang-format
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,13 @@
    BasedOnStyle: Chromium
    AlignTrailingComments: true
    BreakBeforeBraces: Stroustrup
    ColumnLimit: 0
    IndentWidth: 4
    KeepEmptyLinesAtTheStartOfBlocks: false
    MaxEmptyLinesToKeep: 2
    ObjCSpaceAfterProperty: true
    ObjCSpaceBeforeProtocolList: true
    PointerBindsToType: false
    SpacesBeforeTrailingComments: 1
    TabWidth: 8
    UseTab: Never
    24 changes: 24 additions & 0 deletions format.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,24 @@
    #!/bin/bash

    # This script reformats source files using the clang-format utility.
    # Set the list of source directories on the "for" line below.
    #
    # The file .clang-format in this directory specifies the formatting parameters.
    #
    # Note that clang-format is not included with OS X or Xcode; you must
    # install it yourself. There are multiple ways to do this:
    #
    # - If you use Xcode, install the ClangFormat-Xcode plugin. See instructions at
    # <https://github.com/travisjeffery/ClangFormat-Xcode/>.
    # After installation, the executable can be found at
    # ~/Library/Application Support/Alcatraz/Plug-ins/ClangFormat/bin/clang-format.
    #
    # - Download an LLVM release from <http://llvm.org/releases/download.html>.
    # For OS X, use the pre-built binaries for "Darwin".
    #
    # - Build the LLVM tools from source. See the documentation at <http://llvm.org>.

    for DIRECTORY in MyProject MyProjecTests MyLibrary; do
    echo "Formatting code under $DIRECTORY/"
    find $DIRECTORY -name '*.h' -o -name '*.m' -print0 | xargs -0 clang-format -style=file -i
    done