您的位置:首页 > 科技 > 能源 > 东营招标信息网官网首页_视觉设计师工资一般多少_seo自动刷外链工具_百度数据指数

东营招标信息网官网首页_视觉设计师工资一般多少_seo自动刷外链工具_百度数据指数

2024/11/18 10:41:01 来源:https://blog.csdn.net/CUBE_lotus/article/details/143246435  浏览:    关键词:东营招标信息网官网首页_视觉设计师工资一般多少_seo自动刷外链工具_百度数据指数
东营招标信息网官网首页_视觉设计师工资一般多少_seo自动刷外链工具_百度数据指数

(cmake-format) CMake 格式化工具

文章目录

  • (cmake-format) CMake 格式化工具
  • 🧮介绍
  • 🧮安装
  • 🧮使用
    • 🗳️选项 options
    • 🗳️样式配置 config
  • ⭐END
    • 🌟help
    • 🌟.cmake-format.py
    • 🌟交流方式

🧮介绍

cheshirekow/cmake_format: Source code formatter for cmake listfiles.

cmake-formatcmakelang 下的一个子项目:

The cmakelang project provides Quality Assurance (QA) tools for cmake:

  • cmake-annotate can generate pretty HTML from your listfiles
  • cmake-format can format your listfiles nicely so that they don’t look like crap.
  • cmake-lint can check your listfiles for problems
  • ctest-to can parse a ctest output tree and translate it into a more structured format (either JSON or XML).

在这里插入图片描述

很可惜该项目已经两年没更新了

🧮安装

# 查询包
pip_search cmake-format# 安装
pip install cmake-format# 卸载
pip uninstall cmake-format

在这里插入图片描述

🧮使用

最简单直接的使用

直接指定目标的 cmake 文件。

cmake-format CMakeLists.txt

🗳️选项 options

option含义
-h, --help显示帮助信息并退出
-v, --version显示程序版本号并退出
-l, --log-level
–dump-config如果指定,将默认配置打印到 stdout并退出
–dump
–no-help当与--dump-config一起使用时,将省略输出中的 helptext 注释
–no-default当与--dump-config一起使用时,将省略任何未修改的配置值
-i, --in-place
–check如果格式化不会改变文件内容,则以状态码0退出,如果会改变,则以状态码1退出
-o, --outfile-path写入格式化文件的位置。默认为stdout
-c, --config-files配置文件路径

🗳️样式配置 config

# 查看默认配置
cmake-format --dump-config # 指定样式
# + yaml
# + json
# + python (默认)
cmake-format --dump-config [{yaml,json,python}]# example
# 注意,这里后缀不要用 yml
cmake-format --dump-config yaml > .cmake-format.yaml

⭐END

🌟help

cmake-format -h
usage: 
cmake-format [-h][--dump-config {yaml,json,python} | -i | -o OUTFILE_PATH][-c CONFIG_FILE]infilepath [infilepath ...]Parse cmake listfiles and format them nicely.Formatting is configurable by providing a configuration file. The configuration
file can be in json, yaml, or python format. If no configuration file is
specified on the command line, cmake-format will attempt to find a suitable
configuration for each ``inputpath`` by checking recursively checking it's
parent directory up to the root of the filesystem. It will return the first
file it finds with a filename that matches '\.?cmake-format(.yaml|.json|.py)'.cmake-format can spit out the default configuration for you as starting point
for customization. Run with `--dump-config [yaml|json|python]`.positional arguments:infilepathsoptions:-h, --help            show this help message and exit-v, --version         show program's version number and exit-l {error,warning,info,debug}, --log-level {error,warning,info,debug}--dump-config [{yaml,json,python}]If specified, print the default configuration tostdout and exit--dump {lex,parse,parsedb,layout,markup}--no-help             When used with --dump-config, will omit helptextcomments in the output--no-default          When used with --dump-config, will omit any unmodifiedconfiguration value.-i, --in-place--check               Exit with status code 0 if formatting would not changefile contents, or status code 1 if it would-o OUTFILE_PATH, --outfile-path OUTFILE_PATHWhere to write the formatted file. Default is stdout.-c CONFIG_FILES [CONFIG_FILES ...], --config-files CONFIG_FILES [CONFIG_FILES ...]path to configuration file(s)...
...
...

🌟.cmake-format.py

# ----------------------------------
# Options affecting listfile parsing
# ----------------------------------
"""
影响listfile解析的选项
"""
with section("parse"):# Specify structure for custom cmake functions"""为自定义cmake函数指定结构"""additional_commands = {"foo": {"flags": ["BAR", "BAZ"],"kwargs": {"DEPENDS": "*", "HEADERS": "*", "SOURCES": "*"},}}# Override configurations per-command where available"""在可用的地方覆盖每个命令的配置"""override_spec = {}# Specify variable tags."""指定可变标签。"""vartags = []# Specify property tags."""指定属性标签。"""proptags = []# -----------------------------
# Options affecting formatting.
# -----------------------------
"""
影响格式化的选项。
"""
with section("format"):# Disable formatting entirely, making cmake-format a no-op"""完全禁用格式化,使cmake-format成为空操作"""disable = False# How wide to allow formatted cmake files"""多大的宽度允许格式化的cmake文件"""line_width = 80# How many spaces to tab for indent"""缩进需要多少个空格"""tab_size = 2# If true, lines are indented using tab characters (utf-8 0x09) instead of# <tab_size> space characters (utf-8 0x20). In cases where the layout would# require a fractional tab character, the behavior of the  fractional# indentation is governed by <fractional_tab_policy>"""如果为true,行将使用制表符(utf-8 0x09)而不是<tab_size>空格符(utf-8 0x20)进行缩进。在布局需要一个分数制表符的情况下,分数缩进的行为由<fractional_tab_policy>控制"""use_tabchars = False# If <use_tabchars> is True, then the value of this variable indicates how# fractional indentions are handled during whitespace replacement. If set to# 'use-space', fractional indentation is left as spaces (utf-8 0x20). If set# to `round-up` fractional indentation is replaced with a single tab character# (utf-8 0x09) effectively shifting the column to the next tabstop"""如果<use_tabchars>为True,那么该变量的值表示如何在空格替换期间处理小数缩进。如果设置为‘use-space’,则小数缩进被保留为空格(utf-8 0x20)。如果设置为` round-up `,小数缩进将被替换为单个制表符(utf-8 0x09),有效地将列移动到下一个制表符"""fractional_tab_policy = "use-space"# If an argument group contains more than this many sub-groups (parg or kwarg# groups) then force it to a vertical layout."""如果一个参数组包含超过这个数量的子组(parg或kwarg组),则强制它为垂直布局。"""max_subgroups_hwrap = 2# If a positional argument group contains more than this many arguments, then# force it to a vertical layout."""如果位置参数组包含超过这个数量的参数,则强制其为垂直布局。"""max_pargs_hwrap = 6# If a cmdline positional group consumes more than this many lines without# nesting, then invalidate the layout (and nest)"""如果cmdline位置组在没有嵌套的情况下消耗了超过此数量的行,则使布局(和嵌套)无效"""max_rows_cmdline = 2# If true, separate flow control names from their parentheses with a space"""如果为true,用一个空格将流控制名称与括号分开"""separate_ctrl_name_with_space = False# If true, separate function names from parentheses with a space"""如果为true,用一个空格将函数名和括号分开"""separate_fn_name_with_space = False# If a statement is wrapped to more than one line, than dangle the closing# parenthesis on its own line."""如果一个语句被换行成多行,那么就把右括号放在单独的一行上。"""dangle_parens = False# If the trailing parenthesis must be 'dangled' on its on line, then align it# to this reference: `prefix`: the start of the statement,  `prefix-indent`:# the start of the statement, plus one indentation  level, `child`: align to# the column of the arguments"""如果尾括号必须` dangled `在其在线上,则将其对齐到此引用:`prefix`:语句的开头,`prefix-indent`:语句的开头,加上一个缩进级别,`child`:与参数的列对齐"""dangle_align = "prefix"# If the statement spelling length (including space and parenthesis) is# smaller than this amount, then force reject nested layouts."""如果语句拼写长度(包括空格和括号)小于此长度,则强制拒绝嵌套布局。"""min_prefix_chars = 4# If the statement spelling length (including space and parenthesis) is larger# than the tab width by more than this amount, then force reject un-nested# layouts."""如果语句拼写长度(包括空格和括号)比制表符宽度大超过此数量,则强制拒绝非嵌套布局。"""max_prefix_chars = 10# If a candidate layout is wrapped horizontally but it exceeds this many# lines, then reject the layout."""如果一个候选布局是水平包装的,但它超过了这些行,那么拒绝该布局。"""max_lines_hwrap = 2# What style line endings to use in the output."""在输出中使用什么样式的行结尾。"""line_ending = "unix"# Format command names consistently as 'lower' or 'upper' case"""将命令名格式化为'lower'或'upper'"""command_case = "canonical"# Format keywords consistently as 'lower' or 'upper' case"""将关键字的格式统一为'lower'或'upper'"""keyword_case = "unchanged"# A list of command names which should always be wrapped"""总是应该被包装的命令名称列表"""always_wrap = []# If true, the argument lists which are known to be sortable will be sorted# lexicographicall"""如果为true,已知可排序的参数列表将按字典序排列"""enable_sort = True# If true, the parsers may infer whether or not an argument list is sortable# (without annotation)."""如果为true,解析器可以推断参数列表是否可排序(无需注释)"""autosort = False# By default, if cmake-format cannot successfully fit everything into the# desired linewidth it will apply the last, most agressive attempt that it# made. If this flag is True, however, cmake-format will print error, exit# with non-zero status code, and write-out nothing"""默认情况下,如果cmake-format不能成功地将所有内容都放入所需的线宽,它会应用最后一次最激进的尝试。但是,如果此标志为True,cmake-format将打印错误,退出时显示非零状态码,并且不输出任何内容"""require_valid_layout = False# A dictionary mapping layout nodes to a list of wrap decisions. See the# documentation for more information."""一个将布局节点映射到换行决策列表的字典。更多信息请参见文档。"""layout_passes = {}# ------------------------------------------------
# Options affecting comment reflow and formatting.
# ------------------------------------------------
"""
影响注释流和格式的选项。
"""
with section("markup"):# What character to use for bulleted lists"""项目列表使用什么字符"""bullet_char = "*"# What character to use as punctuation after numerals in an enumerated list"""在枚举列表中,数字后使用哪个字符作为标点符号"""enum_char = "."# If comment markup is enabled, don't reflow the first comment block in each# listfile. Use this to preserve formatting of your copyright/license# statements."""如果启用了注释标记,则不要在每个listfile中重复显示第一个注释块。使用它来保存您的版权/许可声明的格式。"""first_comment_is_literal = False# If comment markup is enabled, don't reflow any comment block which matches# this (regex) pattern. Default is `None` (disabled)."""如果启用了注释标记,则不要重复流任何匹配此(regex)模式的注释块。默认值是`None`(禁用)。"""literal_comment_pattern = None# Regular expression to match preformat fences in comments default=# ``r'^\s*([`~]{3}[`~]*)(.*)$'``"""正则表达式,用于匹配注释中的预格式化栅栏"""fence_pattern = "^\\s*([`~]{3}[`~]*)(.*)$"# Regular expression to match rulers in comments default=# ``r'^\s*[^\w\s]{3}.*[^\w\s]{3}$'``"""正则表达式来匹配注释中的规则"""ruler_pattern = "^\\s*[^\\w\\s]{3}.*[^\\w\\s]{3}$"# If a comment line matches starts with this pattern then it is explicitly a# trailing comment for the preceeding argument. Default is '#<'"""如果匹配的注释行以这个模式开始,那么它就是前面参数的末尾注释。"""explicit_trailing_pattern = "#<"# If a comment line starts with at least this many consecutive hash# characters, then don't lstrip() them off. This allows for lazy hash rulers# where the first hash char is not separated by space"""如果注释行至少以这么多个连续的哈希字符开始,那就不要剥掉它们。这允许使用惰性散列标尺,其中第一个散列字符不以空格分隔"""hashruler_min_length = 10# If true, then insert a space between the first hash char and remaining hash# chars in a hash ruler, and normalize its length to fill the column"""如果注释行至少以这么多个连续的哈希字符开始,那就不要剥掉它们。如果为true,则在散列标尺中第一个散列字符和其余散列字符之间插入一个空格,并规范化其长度以填充列这允许使用惰性散列标尺,其中第一个散列字符不以空格分隔"""canonicalize_hashrulers = True# enable comment markup parsing and reflow"""启用注释标记解析和回流"""enable_markup = True# ----------------------------
# Options affecting the linter
# ----------------------------
"""
影响linter的选项
"""
with section("lint"):# a list of lint codes to disable"""要禁用的lint代码列表"""disabled_codes = []# regular expression pattern describing valid function names"""regular expression pattern describing valid function names"""function_pattern = "[0-9a-z_]+"# regular expression pattern describing valid macro names"""描述有效宏名称的正则表达式模式"""macro_pattern = "[0-9A-Z_]+"# regular expression pattern describing valid names for variables with global# (cache) scope"""正则表达式模式描述具有全局(缓存)作用域的变量的有效名称"""global_var_pattern = "[A-Z][0-9A-Z_]+"# regular expression pattern describing valid names for variables with global# scope (but internal semantic)"""正则表达式模式描述具有全局作用域(但具有内部语义)的变量的有效名称"""internal_var_pattern = "_[A-Z][0-9A-Z_]+"# regular expression pattern describing valid names for variables with local# scope"""描述具有局部作用域的变量的有效名称的正则表达式模式"""local_var_pattern = "[a-z][a-z0-9_]+"# regular expression pattern describing valid names for privatedirectory# variables"""描述私有目录变量的有效名称的正则表达式模式"""private_var_pattern = "_[0-9a-z_]+"# regular expression pattern describing valid names for public directory# variables"""描述公共目录变量有效名称的正则表达式模式"""public_var_pattern = "[A-Z][0-9A-Z_]+"# regular expression pattern describing valid names for function/macro# arguments and loop variables."""正则表达式模式描述函数/宏参数和循环变量的有效名称。"""argument_var_pattern = "[a-z][a-z0-9_]+"# regular expression pattern describing valid names for keywords used in# functions or macros"""描述函数或宏中使用的关键字的有效名称的正则表达式模式"""keyword_pattern = "[A-Z][0-9A-Z_]+"# In the heuristic for C0201, how many conditionals to match within a loop in# before considering the loop a parser."""在C0201的启发式算法中,在将循环视为解析器之前,循环内要匹配多少条件。"""max_conditionals_custom_parser = 2# Require at least this many newlines between statements"""语句之间至少需要这么多换行符"""min_statement_spacing = 1# Require no more than this many newlines between statements"""在语句之间只需要这么多换行符"""max_statement_spacing = 2max_returns = 6max_branches = 12max_arguments = 5max_localvars = 15max_statements = 50# -------------------------------
# Options affecting file encoding
# -------------------------------
"""
影响文件编码的选项
"""
with section("encode"):# If true, emit the unicode byte-order mark (BOM) at the start of the file"""如果为true,在文件开头发出unicode字节序标记(BOM)"""emit_byteorder_mark = False# Specify the encoding of the input file. Defaults to utf-8"""指定输入文件的编码。默认为utf-8"""input_encoding = "utf-8"# Specify the encoding of the output file. Defaults to utf-8. Note that cmake# only claims to support utf-8 so be careful when using anything else"""指定输出文件的编码。默认为utf-8。注意,cmake只声称支持utf-8,所以在使用其他格式时要小心"""output_encoding = "utf-8"# -------------------------------------
# Miscellaneous configurations options.
# -------------------------------------
"""
杂项配置选项。
"""
with section("misc"):# A dictionary containing any per-command configuration overrides. Currently# only `command_case` is supported."""一个字典,包含每个命令的配置覆盖。目前只支持`command_case`。"""per_command = {}

🌟交流方式

⭐交流方式⭐ |C/C++|算法|设计模式|软件架构-CSDN社区

关注我,学习更多C/C++,python,算法,软件工程,计算机知识

B站:

👨‍💻主页:天赐细莲 bilibili

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com