/**
  * @file defaults/clang-format.libjsonnet
  * @namespace clang_format
  * @brief Default configuration for Clang format.
  * @sa [clang-format Style Options](https://clang.llvm.org/docs/ClangFormatStyleOptions.html)
 */
{
  /**
   * @brief Get Clang format configuration.
   * @param line_width Maximum line width.
   * @param tab_size Tab size.
   * @returns An object representing the Clang format configuration.
   * @pt int, int
   * @rv object
   */
  get(line_width=100, tab_size=4):: {
    AccessModifierOffset: -tab_size,
    AlignAfterOpenBracket: 'Align',
    AlignConsecutiveAssignments: false,
    AlignConsecutiveDeclarations: false,
    AlignEscapedNewlines: 'Right',
    AlignOperands: true,
    AlignTrailingComments: true,
    AllowAllParametersOfDeclarationOnNextLine: true,
    AllowShortBlocksOnASingleLine: false,
    AllowShortCaseLabelsOnASingleLine: false,
    AllowShortFunctionsOnASingleLine: 'None',
    AllowShortIfStatementsOnASingleLine: false,
    AllowShortLoopsOnASingleLine: false,
    AlwaysBreakAfterReturnType: 'None',
    AlwaysBreakBeforeMultilineStrings: false,
    AlwaysBreakTemplateDeclarations: true,
    BinPackArguments: false,
    BinPackParameters: false,
    BraceWrapping: {
      AfterClass: false,
      AfterControlStatement: false,
      AfterEnum: false,
      AfterFunction: false,
      AfterNamespace: false,
      AfterObjCDeclaration: false,
      AfterStruct: false,
      AfterUnion: false,
      BeforeCatch: false,
      BeforeElse: false,
      IndentBraces: false,
      SplitEmptyFunction: true,
      SplitEmptyNamespace: true,
      SplitEmptyRecord: true,
    },
    BreakAfterJavaFieldAnnotations: false,
    BreakBeforeBinaryOperators: 'None',
    BreakBeforeBraces: 'Attach',
    BreakBeforeInheritanceComma: false,
    BreakBeforeTernaryOperators: false,
    BreakConstructorInitializers: 'BeforeColon',
    BreakConstructorInitializersBeforeComma: false,
    BreakStringLiterals: true,
    ColumnLimit: line_width,
    CommentPragmas: '^ IWYU pragma:',
    CompactNamespaces: false,
    ConstructorInitializerAllOnOneLineOrOnePerLine: false,
    ConstructorInitializerIndentWidth: tab_size,
    ContinuationIndentWidth: tab_size,
    Cpp11BracedListStyle: true,
    DerivePointerAlignment: false,
    DisableFormat: false,
    ExperimentalAutoDetectBinPacking: false,
    FixNamespaceComments: true,
    IncludeCategories: [
      {
        Priority: 2,
        Regex: '^"(llvm|llvm-c|clang|clang-c)/',
      },
      {
        Priority: 3,
        Regex: '^(<|"(gtest|gmock|isl|json)/)',
      },
      {
        Priority: 1,
        Regex: '.*',
      },
    ],
    IncludeIsMainRegex: '(Test)?$',
    IndentCaseLabels: false,
    IndentWidth: tab_size,
    IndentWrappedFunctionNames: false,
    KeepEmptyLinesAtTheStartOfBlocks: true,
    MacroBlockBegin: '',
    MacroBlockEnd: '',
    MaxEmptyLinesToKeep: 1,
    NamespaceIndentation: 'None',
    PenaltyBreakAssignment: 2,
    PenaltyBreakBeforeFirstCallParameter: 19,
    PenaltyBreakComment: 300,
    PenaltyBreakFirstLessLess: 120,
    PenaltyBreakString: 1000,
    PenaltyExcessCharacter: 1000000,
    PenaltyReturnTypeOnItsOwnLine: 60,
    PointerAlignment: 'Right',
    ReflowComments: false,
    SortIncludes: true,
    SortUsingDeclarations: true,
    SpaceAfterCStyleCast: false,
    SpaceAfterTemplateKeyword: true,
    SpaceBeforeAssignmentOperators: true,
    SpaceBeforeParens: 'ControlStatements',
    SpaceInEmptyParentheses: false,
    SpacesBeforeTrailingComments: 1,
    SpacesInAngles: false,
    SpacesInCStyleCastParentheses: false,
    SpacesInContainerLiterals: true,
    SpacesInParentheses: false,
    SpacesInSquareBrackets: false,
    Standard: 'Auto',
    TabWidth: tab_size,
    UseTab: 'Never',
  },
}
