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

查看:285
本文介绍了什么是规范的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:
    ...

CamelCase?

CamelCase?

- 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天全站免登陆