| 1 | # https://pypi.org/project/cmakelang |
| 2 | # https://github.com/cheshirekow/cmake_format |
| 3 | |
| 4 | # ---------------------- |
| 5 | # Options for formatting |
| 6 | # ---------------------- |
| 7 | |
| 8 | # How wide to allow formatted cmake files |
| 9 | # TODO: Reflow the CMake files to allow setting the maximum line width to 100. |
| 10 | line_width: 255 |
| 11 | |
| 12 | # How many spaces to tab for indent |
| 13 | tab_size: 2 |
| 14 | |
| 15 | # If true, lines are indented using tab characters (utf-8 0x09) instead of |
| 16 | # <tab_size> space characters (utf-8 0x20). In cases where the layout would |
| 17 | # require a fractional tab character, the behavior of the fractional |
| 18 | # indentation is governed by <fractional_tab_policy> |
| 19 | use_tabchars: false |
| 20 | |
| 21 | # If <use_tabchars> is True, then the value of this variable indicates how |
| 22 | # fractional indentions are handled during whitespace replacement. If set to |
| 23 | # 'use-space', fractional indentation is left as spaces (utf-8 0x20). If set |
| 24 | # to `round-up` fractional indentation is replaced with a single tab character |
| 25 | # (utf-8 0x09) effectively shifting the column to the next tabstop |
| 26 | fractional_tab_policy: "use-space" |
| 27 | |
| 28 | # Enable comment markup parsing and reflow |
| 29 | enable_markup: false |
| 30 | |
| 31 | # ------------------- |
| 32 | # Options for linting |
| 33 | # ------------------- |
| 34 | |
| 35 | # Lint codes to disable |
| 36 | disabled_codes: [ |
| 37 | # TODO: |
| 38 | # Reconcile the CMake variable names with the patterns below, then |
| 39 | # re-enable the "invalid variable name XXX" messages. |
| 40 | "C0103", |
| 41 | |
| 42 | # TODO: |
| 43 | # Add brief COMMENT arguments to the `add_custom_target` commands. |
| 44 | "C0113", |
| 45 | ] |
| 46 | |
| 47 | # Regular expression pattern describing valid function names |
| 48 | function_pattern: "[0-9a-z_]+" |
| 49 | |
| 50 | # Regular expression pattern describing valid macro names |
| 51 | macro_pattern: "[0-9A-Z_]+" |
| 52 | |
| 53 | # Regular expression pattern describing valid names for variables with global |
| 54 | # (cache) scope |
| 55 | global_var_pattern: "[A-Z][0-9A-Z_]+" |
| 56 | |
| 57 | # Regular expression pattern describing valid names for variables with global |
| 58 | # scope (but internal semantic) |
| 59 | internal_var_pattern: "_[A-Z][0-9A-Z_]+" |
| 60 | |
| 61 | # Regular expression pattern describing valid names for variables with local |
| 62 | # scope |
| 63 | local_var_pattern: "[a-z][a-z0-9_]+" |
| 64 | |
| 65 | # Regular expression pattern describing valid names for privatedirectory |
| 66 | # variables |
| 67 | private_var_pattern: "_[0-9a-z_]+" |
| 68 | |
| 69 | # Regular expression pattern describing valid names for public directory |
| 70 | # variables |
| 71 | public_var_pattern: "[A-Z][0-9A-Z_]+" |
| 72 | |
| 73 | # Regular expression pattern describing valid names for function/macro |
| 74 | # arguments and loop variables. |
| 75 | argument_var_pattern: "[a-z][a-z0-9_]+" |
| 76 | |
| 77 | # Regular expression pattern describing valid names for keywords used in |
| 78 | # functions or macros |
| 79 | keyword_pattern: "[A-Z][0-9A-Z_]+" |
| 80 | |
| 81 | # In the heuristic for C0201, how many conditionals to match within a loop in |
| 82 | # before considering the loop a parser |
| 83 | max_conditionals_custom_parser: 2 |
| 84 | |
| 85 | # Require at least this many newlines between statements; |
| 86 | # require no more than this many newlines between statements; |
| 87 | # etc. |
| 88 | min_statement_spacing: 1 |
| 89 | max_statement_spacing: 2 |
| 90 | max_returns: 6 |
| 91 | max_branches: 12 |
| 92 | max_arguments: 5 |
| 93 | max_localvars: 15 |
| 94 | max_statements: 50 |