1*103e46e4SHarish Mahendrakar# ---------------------------------- 2*103e46e4SHarish Mahendrakar# Options affecting listfile parsing 3*103e46e4SHarish Mahendrakar# ---------------------------------- 4*103e46e4SHarish Mahendrakarwith section("parse"): 5*103e46e4SHarish Mahendrakar 6*103e46e4SHarish Mahendrakar # Specify structure for custom cmake functions 7*103e46e4SHarish Mahendrakar additional_commands = { 'foo': { 'flags': ['BAR', 'BAZ'], 8*103e46e4SHarish Mahendrakar 'kwargs': {'DEPENDS': '*', 'HEADERS': '*', 'SOURCES': '*'}}} 9*103e46e4SHarish Mahendrakar 10*103e46e4SHarish Mahendrakar # Override configurations per-command where available 11*103e46e4SHarish Mahendrakar override_spec = {} 12*103e46e4SHarish Mahendrakar 13*103e46e4SHarish Mahendrakar # Specify variable tags. 14*103e46e4SHarish Mahendrakar vartags = [] 15*103e46e4SHarish Mahendrakar 16*103e46e4SHarish Mahendrakar # Specify property tags. 17*103e46e4SHarish Mahendrakar proptags = [] 18*103e46e4SHarish Mahendrakar 19*103e46e4SHarish Mahendrakar# ----------------------------- 20*103e46e4SHarish Mahendrakar# Options affecting formatting. 21*103e46e4SHarish Mahendrakar# ----------------------------- 22*103e46e4SHarish Mahendrakarwith section("format"): 23*103e46e4SHarish Mahendrakar 24*103e46e4SHarish Mahendrakar # Disable formatting entirely, making cmake-format a no-op 25*103e46e4SHarish Mahendrakar disable = False 26*103e46e4SHarish Mahendrakar 27*103e46e4SHarish Mahendrakar # How wide to allow formatted cmake files 28*103e46e4SHarish Mahendrakar line_width = 80 29*103e46e4SHarish Mahendrakar 30*103e46e4SHarish Mahendrakar # How many spaces to tab for indent 31*103e46e4SHarish Mahendrakar tab_size = 2 32*103e46e4SHarish Mahendrakar 33*103e46e4SHarish Mahendrakar # If true, lines are indented using tab characters (utf-8 0x09) instead of 34*103e46e4SHarish Mahendrakar # <tab_size> space characters (utf-8 0x20). In cases where the layout would 35*103e46e4SHarish Mahendrakar # require a fractional tab character, the behavior of the fractional 36*103e46e4SHarish Mahendrakar # indentation is governed by <fractional_tab_policy> 37*103e46e4SHarish Mahendrakar use_tabchars = False 38*103e46e4SHarish Mahendrakar 39*103e46e4SHarish Mahendrakar # If <use_tabchars> is True, then the value of this variable indicates how 40*103e46e4SHarish Mahendrakar # fractional indentions are handled during whitespace replacement. If set to 41*103e46e4SHarish Mahendrakar # 'use-space', fractional indentation is left as spaces (utf-8 0x20). If set 42*103e46e4SHarish Mahendrakar # to `round-up` fractional indentation is replaced with a single tab character 43*103e46e4SHarish Mahendrakar # (utf-8 0x09) effectively shifting the column to the next tabstop 44*103e46e4SHarish Mahendrakar fractional_tab_policy = 'use-space' 45*103e46e4SHarish Mahendrakar 46*103e46e4SHarish Mahendrakar # If an argument group contains more than this many sub-groups (parg or kwarg 47*103e46e4SHarish Mahendrakar # groups) then force it to a vertical layout. 48*103e46e4SHarish Mahendrakar max_subgroups_hwrap = 2 49*103e46e4SHarish Mahendrakar 50*103e46e4SHarish Mahendrakar # If a positional argument group contains more than this many arguments, then 51*103e46e4SHarish Mahendrakar # force it to a vertical layout. 52*103e46e4SHarish Mahendrakar max_pargs_hwrap = 6 53*103e46e4SHarish Mahendrakar 54*103e46e4SHarish Mahendrakar # If a cmdline positional group consumes more than this many lines without 55*103e46e4SHarish Mahendrakar # nesting, then invalidate the layout (and nest) 56*103e46e4SHarish Mahendrakar max_rows_cmdline = 2 57*103e46e4SHarish Mahendrakar 58*103e46e4SHarish Mahendrakar # If true, separate flow control names from their parentheses with a space 59*103e46e4SHarish Mahendrakar separate_ctrl_name_with_space = False 60*103e46e4SHarish Mahendrakar 61*103e46e4SHarish Mahendrakar # If true, separate function names from parentheses with a space 62*103e46e4SHarish Mahendrakar separate_fn_name_with_space = False 63*103e46e4SHarish Mahendrakar 64*103e46e4SHarish Mahendrakar # If a statement is wrapped to more than one line, than dangle the closing 65*103e46e4SHarish Mahendrakar # parenthesis on its own line. 66*103e46e4SHarish Mahendrakar dangle_parens = False 67*103e46e4SHarish Mahendrakar 68*103e46e4SHarish Mahendrakar # If the trailing parenthesis must be 'dangled' on its on line, then align it 69*103e46e4SHarish Mahendrakar # to this reference: `prefix`: the start of the statement, `prefix-indent`: 70*103e46e4SHarish Mahendrakar # the start of the statement, plus one indentation level, `child`: align to 71*103e46e4SHarish Mahendrakar # the column of the arguments 72*103e46e4SHarish Mahendrakar dangle_align = 'prefix' 73*103e46e4SHarish Mahendrakar 74*103e46e4SHarish Mahendrakar # If the statement spelling length (including space and parenthesis) is 75*103e46e4SHarish Mahendrakar # smaller than this amount, then force reject nested layouts. 76*103e46e4SHarish Mahendrakar min_prefix_chars = 4 77*103e46e4SHarish Mahendrakar 78*103e46e4SHarish Mahendrakar # If the statement spelling length (including space and parenthesis) is larger 79*103e46e4SHarish Mahendrakar # than the tab width by more than this amount, then force reject un-nested 80*103e46e4SHarish Mahendrakar # layouts. 81*103e46e4SHarish Mahendrakar max_prefix_chars = 10 82*103e46e4SHarish Mahendrakar 83*103e46e4SHarish Mahendrakar # If a candidate layout is wrapped horizontally but it exceeds this many 84*103e46e4SHarish Mahendrakar # lines, then reject the layout. 85*103e46e4SHarish Mahendrakar max_lines_hwrap = 2 86*103e46e4SHarish Mahendrakar 87*103e46e4SHarish Mahendrakar # What style line endings to use in the output. 88*103e46e4SHarish Mahendrakar line_ending = 'unix' 89*103e46e4SHarish Mahendrakar 90*103e46e4SHarish Mahendrakar # Format command names consistently as 'lower' or 'upper' case 91*103e46e4SHarish Mahendrakar command_case = 'canonical' 92*103e46e4SHarish Mahendrakar 93*103e46e4SHarish Mahendrakar # Format keywords consistently as 'lower' or 'upper' case 94*103e46e4SHarish Mahendrakar keyword_case = 'unchanged' 95*103e46e4SHarish Mahendrakar 96*103e46e4SHarish Mahendrakar # A list of command names which should always be wrapped 97*103e46e4SHarish Mahendrakar always_wrap = [] 98*103e46e4SHarish Mahendrakar 99*103e46e4SHarish Mahendrakar # If true, the argument lists which are known to be sortable will be sorted 100*103e46e4SHarish Mahendrakar # lexicographicall 101*103e46e4SHarish Mahendrakar enable_sort = True 102*103e46e4SHarish Mahendrakar 103*103e46e4SHarish Mahendrakar # If true, the parsers may infer whether or not an argument list is sortable 104*103e46e4SHarish Mahendrakar # (without annotation). 105*103e46e4SHarish Mahendrakar autosort = False 106*103e46e4SHarish Mahendrakar 107*103e46e4SHarish Mahendrakar # By default, if cmake-format cannot successfully fit everything into the 108*103e46e4SHarish Mahendrakar # desired linewidth it will apply the last, most agressive attempt that it 109*103e46e4SHarish Mahendrakar # made. If this flag is True, however, cmake-format will print error, exit 110*103e46e4SHarish Mahendrakar # with non-zero status code, and write-out nothing 111*103e46e4SHarish Mahendrakar require_valid_layout = False 112*103e46e4SHarish Mahendrakar 113*103e46e4SHarish Mahendrakar # A dictionary mapping layout nodes to a list of wrap decisions. See the 114*103e46e4SHarish Mahendrakar # documentation for more information. 115*103e46e4SHarish Mahendrakar layout_passes = {} 116*103e46e4SHarish Mahendrakar 117*103e46e4SHarish Mahendrakar# ------------------------------------------------ 118*103e46e4SHarish Mahendrakar# Options affecting comment reflow and formatting. 119*103e46e4SHarish Mahendrakar# ------------------------------------------------ 120*103e46e4SHarish Mahendrakarwith section("markup"): 121*103e46e4SHarish Mahendrakar 122*103e46e4SHarish Mahendrakar # What character to use for bulleted lists 123*103e46e4SHarish Mahendrakar bullet_char = '*' 124*103e46e4SHarish Mahendrakar 125*103e46e4SHarish Mahendrakar # What character to use as punctuation after numerals in an enumerated list 126*103e46e4SHarish Mahendrakar enum_char = '.' 127*103e46e4SHarish Mahendrakar 128*103e46e4SHarish Mahendrakar # If comment markup is enabled, don't reflow the first comment block in each 129*103e46e4SHarish Mahendrakar # listfile. Use this to preserve formatting of your copyright/license 130*103e46e4SHarish Mahendrakar # statements. 131*103e46e4SHarish Mahendrakar first_comment_is_literal = True 132*103e46e4SHarish Mahendrakar 133*103e46e4SHarish Mahendrakar # If comment markup is enabled, don't reflow any comment block which matches 134*103e46e4SHarish Mahendrakar # this (regex) pattern. Default is `None` (disabled). 135*103e46e4SHarish Mahendrakar literal_comment_pattern = None 136*103e46e4SHarish Mahendrakar 137*103e46e4SHarish Mahendrakar # Regular expression to match preformat fences in comments default= 138*103e46e4SHarish Mahendrakar # ``r'^\s*([`~]{3}[`~]*)(.*)$'`` 139*103e46e4SHarish Mahendrakar fence_pattern = '^\\s*([`~]{3}[`~]*)(.*)$' 140*103e46e4SHarish Mahendrakar 141*103e46e4SHarish Mahendrakar # Regular expression to match rulers in comments default= 142*103e46e4SHarish Mahendrakar # ``r'^\s*[^\w\s]{3}.*[^\w\s]{3}$'`` 143*103e46e4SHarish Mahendrakar ruler_pattern = '^\\s*[^\\w\\s]{3}.*[^\\w\\s]{3}$' 144*103e46e4SHarish Mahendrakar 145*103e46e4SHarish Mahendrakar # If a comment line matches starts with this pattern then it is explicitly a 146*103e46e4SHarish Mahendrakar # trailing comment for the preceeding argument. Default is '#<' 147*103e46e4SHarish Mahendrakar explicit_trailing_pattern = '#<' 148*103e46e4SHarish Mahendrakar 149*103e46e4SHarish Mahendrakar # If a comment line starts with at least this many consecutive hash 150*103e46e4SHarish Mahendrakar # characters, then don't lstrip() them off. This allows for lazy hash rulers 151*103e46e4SHarish Mahendrakar # where the first hash char is not separated by space 152*103e46e4SHarish Mahendrakar hashruler_min_length = 10 153*103e46e4SHarish Mahendrakar 154*103e46e4SHarish Mahendrakar # If true, then insert a space between the first hash char and remaining hash 155*103e46e4SHarish Mahendrakar # chars in a hash ruler, and normalize its length to fill the column 156*103e46e4SHarish Mahendrakar canonicalize_hashrulers = True 157*103e46e4SHarish Mahendrakar 158*103e46e4SHarish Mahendrakar # enable comment markup parsing and reflow 159*103e46e4SHarish Mahendrakar enable_markup = True 160*103e46e4SHarish Mahendrakar 161*103e46e4SHarish Mahendrakar# ---------------------------- 162*103e46e4SHarish Mahendrakar# Options affecting the linter 163*103e46e4SHarish Mahendrakar# ---------------------------- 164*103e46e4SHarish Mahendrakarwith section("lint"): 165*103e46e4SHarish Mahendrakar 166*103e46e4SHarish Mahendrakar # a list of lint codes to disable 167*103e46e4SHarish Mahendrakar disabled_codes = [] 168*103e46e4SHarish Mahendrakar 169*103e46e4SHarish Mahendrakar # regular expression pattern describing valid function names 170*103e46e4SHarish Mahendrakar function_pattern = '[0-9a-z_]+' 171*103e46e4SHarish Mahendrakar 172*103e46e4SHarish Mahendrakar # regular expression pattern describing valid macro names 173*103e46e4SHarish Mahendrakar macro_pattern = '[0-9A-Z_]+' 174*103e46e4SHarish Mahendrakar 175*103e46e4SHarish Mahendrakar # regular expression pattern describing valid names for variables with global 176*103e46e4SHarish Mahendrakar # (cache) scope 177*103e46e4SHarish Mahendrakar global_var_pattern = '[A-Z][0-9A-Z_]+' 178*103e46e4SHarish Mahendrakar 179*103e46e4SHarish Mahendrakar # regular expression pattern describing valid names for variables with global 180*103e46e4SHarish Mahendrakar # scope (but internal semantic) 181*103e46e4SHarish Mahendrakar internal_var_pattern = '_[A-Z][0-9A-Z_]+' 182*103e46e4SHarish Mahendrakar 183*103e46e4SHarish Mahendrakar # regular expression pattern describing valid names for variables with local 184*103e46e4SHarish Mahendrakar # scope 185*103e46e4SHarish Mahendrakar local_var_pattern = '[a-z][a-z0-9_]+' 186*103e46e4SHarish Mahendrakar 187*103e46e4SHarish Mahendrakar # regular expression pattern describing valid names for privatedirectory 188*103e46e4SHarish Mahendrakar # variables 189*103e46e4SHarish Mahendrakar private_var_pattern = '_[0-9a-z_]+' 190*103e46e4SHarish Mahendrakar 191*103e46e4SHarish Mahendrakar # regular expression pattern describing valid names for public directory 192*103e46e4SHarish Mahendrakar # variables 193*103e46e4SHarish Mahendrakar public_var_pattern = '[A-Z][0-9A-Z_]+' 194*103e46e4SHarish Mahendrakar 195*103e46e4SHarish Mahendrakar # regular expression pattern describing valid names for function/macro 196*103e46e4SHarish Mahendrakar # arguments and loop variables. 197*103e46e4SHarish Mahendrakar argument_var_pattern = '[a-z][a-z0-9_]+' 198*103e46e4SHarish Mahendrakar 199*103e46e4SHarish Mahendrakar # regular expression pattern describing valid names for keywords used in 200*103e46e4SHarish Mahendrakar # functions or macros 201*103e46e4SHarish Mahendrakar keyword_pattern = '[A-Z][0-9A-Z_]+' 202*103e46e4SHarish Mahendrakar 203*103e46e4SHarish Mahendrakar # In the heuristic for C0201, how many conditionals to match within a loop in 204*103e46e4SHarish Mahendrakar # before considering the loop a parser. 205*103e46e4SHarish Mahendrakar max_conditionals_custom_parser = 2 206*103e46e4SHarish Mahendrakar 207*103e46e4SHarish Mahendrakar # Require at least this many newlines between statements 208*103e46e4SHarish Mahendrakar min_statement_spacing = 1 209*103e46e4SHarish Mahendrakar 210*103e46e4SHarish Mahendrakar # Require no more than this many newlines between statements 211*103e46e4SHarish Mahendrakar max_statement_spacing = 2 212*103e46e4SHarish Mahendrakar max_returns = 6 213*103e46e4SHarish Mahendrakar max_branches = 12 214*103e46e4SHarish Mahendrakar max_arguments = 5 215*103e46e4SHarish Mahendrakar max_localvars = 15 216*103e46e4SHarish Mahendrakar max_statements = 50 217*103e46e4SHarish Mahendrakar 218*103e46e4SHarish Mahendrakar# ------------------------------- 219*103e46e4SHarish Mahendrakar# Options affecting file encoding 220*103e46e4SHarish Mahendrakar# ------------------------------- 221*103e46e4SHarish Mahendrakarwith section("encode"): 222*103e46e4SHarish Mahendrakar 223*103e46e4SHarish Mahendrakar # If true, emit the unicode byte-order mark (BOM) at the start of the file 224*103e46e4SHarish Mahendrakar emit_byteorder_mark = False 225*103e46e4SHarish Mahendrakar 226*103e46e4SHarish Mahendrakar # Specify the encoding of the input file. Defaults to utf-8 227*103e46e4SHarish Mahendrakar input_encoding = 'utf-8' 228*103e46e4SHarish Mahendrakar 229*103e46e4SHarish Mahendrakar # Specify the encoding of the output file. Defaults to utf-8. Note that cmake 230*103e46e4SHarish Mahendrakar # only claims to support utf-8 so be careful when using anything else 231*103e46e4SHarish Mahendrakar output_encoding = 'utf-8' 232*103e46e4SHarish Mahendrakar 233*103e46e4SHarish Mahendrakar# ------------------------------------- 234*103e46e4SHarish Mahendrakar# Miscellaneous configurations options. 235*103e46e4SHarish Mahendrakar# ------------------------------------- 236*103e46e4SHarish Mahendrakarwith section("misc"): 237*103e46e4SHarish Mahendrakar 238*103e46e4SHarish Mahendrakar # A dictionary containing any per-command configuration overrides. Currently 239*103e46e4SHarish Mahendrakar # only `command_case` is supported. 240*103e46e4SHarish Mahendrakar per_command = {} 241