什么是规范的 YAML 命名风格 [英] What is the canonical YAML naming style

查看:67
本文介绍了什么是规范的 YAML 命名风格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在设计一个新的 YAML 文件,我想使用最标准的命名风格.是哪个?

I am designing a new YAML file, and I want to use the most standard style of naming. Which is it?

连字符?

- job-name:
    ...

lower_case_with_underscores?

lower_case_with_underscores?

- job_name:
    ...

驼峰式?

- jobName:
    ...

推荐答案

使用周边软件规定的标准.

Use the standard dictated by the surrounding software.

例如,在我当前的项目中,YAML 文件包含 Python 属性的默认值.由于 YAML 中使用的名称出现在相关的 Python API 中,因此很明显,在这个特定项目中,YAML 名称应遵循 PEP-8 的 Python lower_case_with_underscores 命名约定.

For example, in my current project the YAML file contains default values for Python attributes. Since the names used in YAML appear in the associated Python API, it is clear that on this particular project, the YAML names should obey the Python lower_case_with_underscores naming convention per PEP-8.

我的下一个项目可能有不同的流行命名约定,在这种情况下,我将在关联的 YAML 文件中使用它.

My next project might have a different prevailing naming convention, in which case I will use that in the associated YAML files.

这篇关于什么是规范的 YAML 命名风格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆