cmake_format package¶
Module contents¶
Language tools for cmake
Submodules¶
cmake_format.configuration module¶
-
class
cmakelang.configuration.
Configuration
(**kwargs)[source]¶ Bases:
cmakelang.config_util.ConfigObject
Various configuration options and parameters
-
encode
¶ Implements the descriptor interface for nested configuration objects.
-
format
¶ Implements the descriptor interface for nested configuration objects.
-
lint
¶ Implements the descriptor interface for nested configuration objects.
-
markup
¶ Implements the descriptor interface for nested configuration objects.
-
misc
¶ Implements the descriptor interface for nested configuration objects.
-
parse
¶ Implements the descriptor interface for nested configuration objects.
-
-
class
cmakelang.configuration.
EncodingConfig
(**kwargs)[source]¶ Bases:
cmakelang.config_util.ConfigObject
Options affecting file encoding
-
emit_byteorder_mark
= False¶
-
input_encoding
= 'utf-8'¶
-
output_encoding
= 'utf-8'¶
-
-
class
cmakelang.configuration.
FormattingConfig
(**kwargs)[source]¶ Bases:
cmakelang.config_util.ConfigObject
Options affecting formatting.
-
always_wrap
= []¶
-
autosort
= False¶
-
command_case
= 'canonical'¶
-
dangle_align
= 'prefix'¶
-
dangle_parens
= False¶
-
disable
= False¶
-
enable_sort
= True¶
-
fractional_tab_policy
= 'use-space'¶
-
keyword_case
= 'unchanged'¶
-
layout_passes
= {}¶
-
line_ending
= 'unix'¶
-
line_width
= 80¶
-
linewidth
¶
-
max_lines_hwrap
= 2¶
-
max_pargs_hwrap
= 6¶
-
max_prefix_chars
= 10¶
-
max_rows_cmdline
= 2¶
-
max_subgroups_hwrap
= 2¶
-
min_prefix_chars
= 4¶
-
require_valid_layout
= False¶
-
separate_ctrl_name_with_space
= False¶
-
separate_fn_name_with_space
= False¶
-
tab_size
= 2¶
-
use_tabchars
= False¶
-
-
class
cmakelang.configuration.
LinterConfig
(**kwargs)[source]¶ Bases:
cmakelang.config_util.ConfigObject
Options affecting the linter
-
argument_var_pattern
= '[a-z][a-z0-9_]+'¶
-
disabled_codes
= []¶
-
function_pattern
= '[0-9a-z_]+'¶
-
global_var_pattern
= '[A-Z][0-9A-Z_]+'¶
-
internal_var_pattern
= '_[A-Z][0-9A-Z_]+'¶
-
keyword_pattern
= '[A-Z][0-9A-Z_]+'¶
-
local_var_pattern
= '[a-z][a-z0-9_]+'¶
-
macro_pattern
= '[0-9A-Z_]+'¶
-
max_arguments
= 5¶
-
max_branches
= 12¶
-
max_conditionals_custom_parser
= 2¶
-
max_localvars
= 15¶
-
max_returns
= 6¶
-
max_statement_spacing
= 2¶
-
max_statements
= 50¶
-
min_statement_spacing
= 1¶
-
private_var_pattern
= '_[0-9a-z_]+'¶
-
public_var_pattern
= '[A-Z][0-9A-Z_]+'¶
-
-
class
cmakelang.configuration.
MarkupConfig
(**kwargs)[source]¶ Bases:
cmakelang.config_util.ConfigObject
Options affecting comment reflow and formatting.
-
bullet_char
= '*'¶
-
canonicalize_hashrulers
= True¶
-
enable_markup
= True¶
-
enum_char
= '.'¶
-
explicit_trailing_pattern
= '#<'¶
-
fence_pattern
= '^\\s*([`~]{3}[`~]*)(.*)$'¶
-
first_comment_is_literal
= False¶
-
hashruler_min_length
= 10¶
-
literal_comment_pattern
= None¶
-
ruler_pattern
= '^\\s*[^\\w\\s]{3}.*[^\\w\\s]{3}$'¶
-
cmake_format.common module¶
-
class
cmakelang.common.
EnumObject
(value)[source]¶ Bases:
object
Simple enumeration base. Design inspired by clang python bindings BaseEnumeration. Subclasses must provide class member _id_map.
-
name
¶ Get the enumeration name of this value.
-
-
exception
cmakelang.common.
FormatError
(msg=None)[source]¶ Bases:
Exception
Raised during format or format –check indicating that the program should exit with nonzero status code.
-
exception
cmakelang.common.
InternalError
(msg=None)[source]¶ Bases:
Exception
Raised when we encounter something we do not expect, indicating a problem with the code itself.
cmake_format.lexer module¶
cmake_format.markup module¶
Functions for parsing comments in markup
-
class
cmakelang.markup.
CommentType
(value)[source]¶ Bases:
cmakelang.common.EnumObject
-
BULLET_LIST
= CommentType.BULLET_LIST¶
-
ENUM_LIST
= CommentType.ENUM_LIST¶
-
FENCE
= CommentType.FENCE¶
-
NOTE
= CommentType.NOTE¶
-
PARAGRAPH
= CommentType.PARAGRAPH¶
-
RULER
= CommentType.RULER¶
-
SEPARATOR
= CommentType.SEPARATOR¶
-
VERBATIM
= CommentType.VERBATIM¶
-
-
cmakelang.markup.
format_item
(config, line_width, item)[source]¶ Return lines of formatted text based on the typeof markup
-
cmakelang.markup.
format_items
(config, line_width, items)[source]¶ Return lines of formatted text for the sequence of items within a comment block
cmake_format.parse module¶
-
class
cmakelang.parse.
MockEverything
[source]¶ Bases:
object
Dummy object which implements any interface by mocking all functions with an empty implementation that returns None