Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
clang-format: DontAlignAfterOpenBracket only for pydrake (#10118)
- Loading branch information
1 parent
785463d
commit 98d71e3
Showing
15 changed files
with
112 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
# -*- yaml -*- | ||
|
||
# This portion of the file contains settings that are local to the | ||
# //bindings/... code, rather than all of Drake. | ||
|
||
# When a function signature's parameters or a function call's arguments need to | ||
# wrap onto another line, indent by four spaces -- do not whitespace castle all | ||
# the way over to the open-paren. | ||
AlignAfterOpenBracket: DontAlign | ||
|
||
# ----------------------------------------------------------------------------- | ||
# The contents of the root dotfile should be exactly copied below this point. | ||
# ----------------------------------------------------------------------------- | ||
# -*- yaml -*- | ||
|
||
# This file determines clang-format's style settings; for details, refer to | ||
# http://clang.llvm.org/docs/ClangFormatStyleOptions.html | ||
|
||
BasedOnStyle: Google | ||
|
||
Language: Cpp | ||
|
||
# Force pointers to the type for C++. | ||
DerivePointerAlignment: false | ||
PointerAlignment: Left | ||
|
||
# Specify the #include statement order. This implements the order mandated by | ||
# the Google C++ Style Guide: related header, C headers, C++ headers, library | ||
# headers, and finally the project headers. | ||
# | ||
# To obtain updated lists of system headers used in the below expressions, see: | ||
# http://stackoverflow.com/questions/2027991/list-of-standard-header-files-in-c-and-c/2029106#2029106. | ||
IncludeCategories: | ||
# Spacers used by drake/tools/formatter.py. | ||
- Regex: '^<clang-format-priority-15>$' | ||
Priority: 15 | ||
- Regex: '^<clang-format-priority-25>$' | ||
Priority: 25 | ||
- Regex: '^<clang-format-priority-35>$' | ||
Priority: 35 | ||
- Regex: '^<clang-format-priority-45>$' | ||
Priority: 45 | ||
# C system headers. | ||
- Regex: '^[<"](aio|arpa/inet|assert|complex|cpio|ctype|curses|dirent|dlfcn|errno|fcntl|fenv|float|fmtmsg|fnmatch|ftw|glob|grp|iconv|inttypes|iso646|langinfo|libgen|limits|locale|math|monetary|mqueue|ndbm|netdb|net/if|netinet/in|netinet/tcp|nl_types|poll|pthread|pwd|regex|sched|search|semaphore|setjmp|signal|spawn|stdalign|stdarg|stdatomic|stdbool|stddef|stdint|stdio|stdlib|stdnoreturn|string|strings|stropts|sys/ipc|syslog|sys/mman|sys/msg|sys/resource|sys/select|sys/sem|sys/shm|sys/socket|sys/stat|sys/statvfs|sys/time|sys/times|sys/types|sys/uio|sys/un|sys/utsname|sys/wait|tar|term|termios|tgmath|threads|time|trace|uchar|ulimit|uncntrl|unistd|utime|utmpx|wchar|wctype|wordexp)\.h[">]$' | ||
Priority: 20 | ||
# C++ system headers (as of C++14). | ||
- Regex: '^[<"](algorithm|array|atomic|bitset|cassert|ccomplex|cctype|cerrno|cfenv|cfloat|chrono|cinttypes|ciso646|climits|clocale|cmath|codecvt|complex|condition_variable|csetjmp|csignal|cstdalign|cstdarg|cstdbool|cstddef|cstdint|cstdio|cstdlib|cstring|ctgmath|ctime|cuchar|cwchar|cwctype|deque|exception|forward_list|fstream|functional|future|initializer_list|iomanip|ios|iosfwd|iostream|istream|iterator|limits|list|locale|map|memory|mutex|new|numeric|ostream|queue|random|ratio|regex|scoped_allocator|set|shared_mutex|sstream|stack|stdexcept|streambuf|string|strstream|system_error|thread|tuple|type_traits|typeindex|typeinfo|unordered_map|unordered_set|utility|valarray|vector)[">]$' | ||
Priority: 30 | ||
# Other libraries' h files (with angles). | ||
- Regex: '^<' | ||
Priority: 40 | ||
# Your project's h files. | ||
- Regex: '^"drake' | ||
Priority: 50 | ||
# Other libraries' h files (with quotes). | ||
- Regex: '^"' | ||
Priority: 41 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import unittest | ||
|
||
|
||
class TestDotfile(unittest.TestCase): | ||
def setUp(self): | ||
self.maxDiff = None | ||
|
||
def test_dotfile_consistency(self): | ||
# Drake's bindings/pydrake/.clang-format file should be a prologue atop | ||
# the root .clang-format file. | ||
with open(".clang-format") as f: | ||
root_contents = f.readlines() | ||
with open("bindings/pydrake/.clang-format") as f: | ||
bindings_contents = f.readlines() | ||
|
||
# The bindings file should be longer. | ||
self.assertGreater(len(bindings_contents), len(root_contents)) | ||
offset = len(bindings_contents) - len(root_contents) | ||
assert offset > 0 | ||
|
||
# Every line in root should appear in bindings. | ||
self.assertMultiLineEqual( | ||
"".join(root_contents), | ||
"".join(bindings_contents[offset:])) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters