| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent d2ad9a2 commit f0c871b
4 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,111 @@ | |||
| 1 | + --- | ||
| 2 | + Language: Cpp | ||
| 3 | + # BasedOnStyle: Google | ||
| 4 | + AccessModifierOffset: -1 | ||
| 5 | + AlignAfterOpenBracket: Align | ||
| 6 | + AlignConsecutiveAssignments: false | ||
| 7 | + AlignConsecutiveDeclarations: false | ||
| 8 | + AlignEscapedNewlines: Right | ||
| 9 | + AlignOperands: true | ||
| 10 | + AlignTrailingComments: true | ||
| 11 | + AllowAllParametersOfDeclarationOnNextLine: true | ||
| 12 | + AllowShortBlocksOnASingleLine: false | ||
| 13 | + AllowShortCaseLabelsOnASingleLine: false | ||
| 14 | + AllowShortFunctionsOnASingleLine: Inline | ||
| 15 | + AllowShortIfStatementsOnASingleLine: true | ||
| 16 | + AllowShortLoopsOnASingleLine: true | ||
| 17 | + AlwaysBreakAfterDefinitionReturnType: None | ||
| 18 | + AlwaysBreakAfterReturnType: None | ||
| 19 | + AlwaysBreakBeforeMultilineStrings: false | ||
| 20 | + AlwaysBreakTemplateDeclarations: true | ||
| 21 | + BinPackArguments: false | ||
| 22 | + BinPackParameters: false | ||
| 23 | + BraceWrapping: | ||
| 24 | + AfterClass: false | ||
| 25 | + AfterControlStatement: false | ||
| 26 | + AfterEnum: false | ||
| 27 | + AfterFunction: false | ||
| 28 | + AfterNamespace: false | ||
| 29 | + AfterObjCDeclaration: false | ||
| 30 | + AfterStruct: false | ||
| 31 | + AfterUnion: false | ||
| 32 | + AfterExternBlock: false | ||
| 33 | + BeforeCatch: false | ||
| 34 | + BeforeElse: false | ||
| 35 | + IndentBraces: false | ||
| 36 | + SplitEmptyFunction: true | ||
| 37 | + SplitEmptyRecord: true | ||
| 38 | + SplitEmptyNamespace: true | ||
| 39 | + BreakBeforeBinaryOperators: None | ||
| 40 | + BreakBeforeBraces: Attach | ||
| 41 | + BreakBeforeInheritanceComma: false | ||
| 42 | + BreakBeforeTernaryOperators: true | ||
| 43 | + BreakConstructorInitializersBeforeComma: false | ||
| 44 | + BreakConstructorInitializers: BeforeColon | ||
| 45 | + BreakAfterJavaFieldAnnotations: false | ||
| 46 | + BreakStringLiterals: true | ||
| 47 | + ColumnLimit: 80 | ||
| 48 | + CommentPragmas: '^ IWYU pragma:' | ||
| 49 | + CompactNamespaces: false | ||
| 50 | + ConstructorInitializerAllOnOneLineOrOnePerLine: true | ||
| 51 | + ConstructorInitializerIndentWidth: 4 | ||
| 52 | + ContinuationIndentWidth: 4 | ||
| 53 | + Cpp11BracedListStyle: true | ||
| 54 | + DerivePointerAlignment: false | ||
| 55 | + DisableFormat: false | ||
| 56 | + ExperimentalAutoDetectBinPacking: false | ||
| 57 | + FixNamespaceComments: true | ||
| 58 | + ForEachMacros: | ||
| 59 | + - foreach | ||
| 60 | + - Q_FOREACH | ||
| 61 | + - BOOST_FOREACH | ||
| 62 | + IncludeBlocks: Preserve | ||
| 63 | + IncludeCategories: | ||
| 64 | + - Regex: '^<ext/.*\.h>' | ||
| 65 | + Priority: 2 | ||
| 66 | + - Regex: '^<.*\.h>' | ||
| 67 | + Priority: 1 | ||
| 68 | + - Regex: '^<.*' | ||
| 69 | + Priority: 2 | ||
| 70 | + - Regex: '.*' | ||
| 71 | + Priority: 3 | ||
| 72 | + IncludeIsMainRegex: '([-_](test|unittest))?$' | ||
| 73 | + IndentCaseLabels: true | ||
| 74 | + IndentPPDirectives: None | ||
| 75 | + IndentWidth: 2 | ||
| 76 | + IndentWrappedFunctionNames: false | ||
| 77 | + JavaScriptQuotes: Leave | ||
| 78 | + JavaScriptWrapImports: true | ||
| 79 | + KeepEmptyLinesAtTheStartOfBlocks: false | ||
| 80 | + MacroBlockBegin: '' | ||
| 81 | + MacroBlockEnd: '' | ||
| 82 | + MaxEmptyLinesToKeep: 1 | ||
| 83 | + NamespaceIndentation: None | ||
| 84 | + ObjCBlockIndentWidth: 2 | ||
| 85 | + ObjCSpaceAfterProperty: false | ||
| 86 | + ObjCSpaceBeforeProtocolList: false | ||
| 87 | + PenaltyBreakAssignment: 2 | ||
| 88 | + PenaltyBreakBeforeFirstCallParameter: 1 | ||
| 89 | + PenaltyBreakComment: 300 | ||
| 90 | + PenaltyBreakFirstLessLess: 120 | ||
| 91 | + PenaltyBreakString: 1000 | ||
| 92 | + PenaltyExcessCharacter: 1000000 | ||
| 93 | + PenaltyReturnTypeOnItsOwnLine: 200 | ||
| 94 | + PointerAlignment: Left | ||
| 95 | + ReflowComments: true | ||
| 96 | + SortIncludes: true | ||
| 97 | + SortUsingDeclarations: true | ||
| 98 | + SpaceAfterCStyleCast: false | ||
| 99 | + SpaceAfterTemplateKeyword: true | ||
| 100 | + SpaceBeforeAssignmentOperators: true | ||
| 101 | + SpaceBeforeParens: ControlStatements | ||
| 102 | + SpaceInEmptyParentheses: false | ||
| 103 | + SpacesBeforeTrailingComments: 2 | ||
| 104 | + SpacesInAngles: false | ||
| 105 | + SpacesInContainerLiterals: true | ||
| 106 | + SpacesInCStyleCastParentheses: false | ||
| 107 | + SpacesInParentheses: false | ||
| 108 | + SpacesInSquareBrackets: false | ||
| 109 | + Standard: Auto | ||
| 110 | + TabWidth: 8 | ||
| 111 | + UseTab: Never | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -4,6 +4,7 @@ | |||
| 4 | 4 | !test/fixtures/**/.* | |
| 5 | 5 | !tools/node_modules/**/.* | |
| 6 | 6 | !tools/doc/node_modules/**/.* | |
| 7 | + !.clang-format | ||
| 7 | 8 | !.editorconfig | |
| 8 | 9 | !.eslintignore | |
| 9 | 10 | !.eslintrc.js | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1169,6 +1169,33 @@ LINT_CPP_FILES = $(filter-out $(LINT_CPP_EXCLUDE), $(wildcard \ | |||
| 1169 | 1169 | # and the actual filename is generated so it won't match header guards | |
| 1170 | 1170 | ADDON_DOC_LINT_FLAGS=-whitespace/ending_newline,-build/header_guard | |
| 1171 | 1171 | ||
| 1172 | + format-cpp-build: | ||
| 1173 | + cd tools/clang-format && $(call available-node,$(run-npm-install)) | ||
| 1174 | + | ||
| 1175 | + format-cpp-clean: | ||
| 1176 | + $(RM) -r tools/clang-format/node_modules | ||
| 1177 | + | ||
| 1178 | + CLANG_FORMAT_START ?= HEAD | ||
| 1179 | + .PHONY: format-cpp | ||
| 1180 | + # To format staged changes: | ||
| 1181 | + # $ make format-cpp | ||
| 1182 | + # To format HEAD~1...HEAD (latest commit): | ||
| 1183 | + # $ CLANG_FORMAT_START=`git rev-parse HEAD~1` make format-cpp | ||
| 1184 | + # To format diff between master and current branch head (master...HEAD): | ||
| 1185 | + # $ CLANG_FORMAT_START=master make format-cpp | ||
| 1186 | + format-cpp: ## Format C++ diff from $CLANG_FORMAT_START to current changes | ||
| 1187 | + ifneq ("","$(wildcard tools/clang-format/node_modules/)") | ||
| 1188 | + @echo "Formatting C++ diff from $(CLANG_FORMAT_START).." | ||
| 1189 | + @$(PYTHON) tools/clang-format/node_modules/.bin/git-clang-format \ | ||
| 1190 | + --binary=tools/clang-format/node_modules/.bin/clang-format \ | ||
| 1191 | + --style=file \ | ||
| 1192 | + $(CLANG_FORMAT_START) -- \ | ||
| 1193 | + $(LINT_CPP_FILES) | ||
| 1194 | + else | ||
| 1195 | + @echo "clang-format is not installed." | ||
| 1196 | + @echo "To install (requires internet access) run: $ make format-cpp-build" | ||
| 1197 | + endif | ||
| 1198 | + | ||
| 1172 | 1199 | .PHONY: lint-cpp | |
| 1173 | 1200 | # Lints the C++ code with cpplint.py and check-imports.py. | |
| 1174 | 1201 | lint-cpp: tools/.cpplintstamp | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,9 @@ | |||
| 1 | + { | ||
| 2 | + "name": "node-core-clang-format", | ||
| 3 | + "version": "1.0.0", | ||
| 4 | + "description": "Formatting C++ files for Node.js core", | ||
| 5 | + "license": "MIT", | ||
| 6 | + "dependencies": { | ||
| 7 | + "clang-format": "1.2.3" | ||
| 8 | + } | ||
| 9 | + } | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments