Commit 9a9c452b00
Unsigned
Layout: unified · split
lib/checks/check-additions.py +3 −2
| @@ -143,8 +143,9 @@ def check_single_entry(diff): | |||
| 143 | if added_count > 1: | 143 | if added_count > 1: |
| 144 | return MULTIPLE_MSG | 144 | return MULTIPLE_MSG |
| 145 | if added_count == 0: | 145 | if added_count == 0: |
| 146 | sec_count = len(diff.get("sections", [])) | 146 | added_sections = [s for s in diff.get("sections", []) |
| 147 | if sec_count > 1: | 147 | if s.get("change_type") == "added_section"] |
| 148 | if len(added_sections) > 1: | ||
| 148 | return MULTIPLE_MSG | 149 | return MULTIPLE_MSG |
| 149 | return None | 150 | return None |
| 150 | 151 | ||
lib/checks/check-yaml-diff.py +3 −2
| @@ -191,8 +191,9 @@ def main(): | |||
| 191 | if added_count > 1: | 191 | if added_count > 1: |
| 192 | print(red(f"Single-entry rule violation: {added_count} service additions found."), file=sys.stderr) | 192 | print(red(f"Single-entry rule violation: {added_count} service additions found."), file=sys.stderr) |
| 193 | sys.exit(EXIT_RULE_VIOLATION) | 193 | sys.exit(EXIT_RULE_VIOLATION) |
| 194 | if added_count == 0 and len(sections) > 1: | 194 | added_sections = [s for s in sections if s["change_type"] == "added_section"] |
| 195 | print(red(f"Single-entry rule violation: {len(sections)} section changes found."), file=sys.stderr) | 195 | if added_count == 0 and len(added_sections) > 1: |
| 196 | print(red(f"Single-entry rule violation: {len(added_sections)} section additions found."), file=sys.stderr) | ||
| 196 | sys.exit(EXIT_RULE_VIOLATION) | 197 | sys.exit(EXIT_RULE_VIOLATION) |
| 197 | 198 | ||
| 198 | total = len(added) + len(removed) + len(modified) | 199 | total = len(added) + len(removed) + len(modified) |