本文整理匯總了Python中gitlint.config.LintConfig.get_rule_option方法的典型用法代碼示例。如果您正苦於以下問題:Python LintConfig.get_rule_option方法的具體用法?Python LintConfig.get_rule_option怎麽用?Python LintConfig.get_rule_option使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類gitlint.config.LintConfig
的用法示例。
在下文中一共展示了LintConfig.get_rule_option方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_set_rule_option
# 需要導入模塊: from gitlint.config import LintConfig [as 別名]
# 或者: from gitlint.config.LintConfig import get_rule_option [as 別名]
def test_set_rule_option(self):
config = LintConfig()
# assert default title line-length
self.assertEqual(config.get_rule_option('title-max-length', 'line-length'), 72)
# change line length and assert it is set
config.set_rule_option('title-max-length', 'line-length', 60)
self.assertEqual(config.get_rule_option('title-max-length', 'line-length'), 60)
示例2: test_apply_config_options
# 需要導入模塊: from gitlint.config import LintConfig [as 別名]
# 或者: from gitlint.config.LintConfig import get_rule_option [as 別名]
def test_apply_config_options(self):
config = LintConfig()
# assert some defaults
self.assertEqual(config.get_rule_option('title-max-length', 'line-length'), 72)
self.assertEqual(config.get_rule_option('body-max-line-length', 'line-length'), 80)
self.assertEqual(config.verbosity, 3)
# change and assert changes
config.apply_config_options(['general.verbosity=1', 'title-max-length.line-length=60',
'body-max-line-length.line-length=120'])
self.assertEqual(config.get_rule_option('title-max-length', 'line-length'), 60)
self.assertEqual(config.get_rule_option('body-max-line-length', 'line-length'), 120)
self.assertEqual(config.verbosity, 1)
示例3: test_set_config_from_string_list
# 需要導入模塊: from gitlint.config import LintConfig [as 別名]
# 或者: from gitlint.config.LintConfig import get_rule_option [as 別名]
def test_set_config_from_string_list(self):
config = LintConfig()
# assert some defaults
self.assertEqual(config.get_rule_option('title-max-length', 'line-length'), 72)
self.assertEqual(config.get_rule_option('body-max-line-length', 'line-length'), 80)
self.assertEqual(config.verbosity, 3)
# change and assert changes
config_builder = LintConfigBuilder()
config_builder.set_config_from_string_list(['general.verbosity=1', 'title-max-length.line-length=60',
'body-max-line-length.line-length=120'])
config = config_builder.build()
self.assertEqual(config.get_rule_option('title-max-length', 'line-length'), 60)
self.assertEqual(config.get_rule_option('body-max-line-length', 'line-length'), 120)
self.assertEqual(config.verbosity, 1)