|
1 | 1 | """ |
2 | 2 | CLI helper commands for CI static checks. |
3 | 3 |
|
4 | | -Contains wrappers to markdownlint-cli2 and changelog validation that fail |
| 4 | +Contains a wrapper to markdownlint-cli2 validation which fails |
5 | 5 | silently if external tools are not available, to avoid disruption to |
6 | 6 | external contributors. |
7 | 7 | """ |
@@ -96,53 +96,3 @@ def markdownlint(args: tuple[str, ...]) -> None: |
96 | 96 |
|
97 | 97 | command = ["node", markdownlint] + args_list |
98 | 98 | sys.exit(subprocess.run(command).returncode) |
99 | | - |
100 | | - |
101 | | -@click.command() |
102 | | -def validate_changelog() -> None: |
103 | | - """ |
104 | | - Validate changelog formatting to ensure bullet points end with proper |
105 | | - punctuation. |
106 | | -
|
107 | | - Check that all bullet points (including nested ones) end with either: |
108 | | - - A period (.) for regular entries |
109 | | - - A colon (:) for section headers that introduce lists |
110 | | - """ |
111 | | - project_root = find_project_root() |
112 | | - changelog_path = Path(project_root / "docs/CHANGELOG.md") |
113 | | - |
114 | | - if not changelog_path.exists(): |
115 | | - click.echo(f"❌ Changelog file not found: {changelog_path}") |
116 | | - sys.exit(1) |
117 | | - |
118 | | - try: |
119 | | - with open(changelog_path, "r", encoding="utf-8") as f: |
120 | | - content = f.read() |
121 | | - except Exception as e: |
122 | | - click.echo(f"❌ Error reading changelog: {e}.") |
123 | | - sys.exit(1) |
124 | | - |
125 | | - # Find bullet points that don't end with period or colon |
126 | | - invalid_lines = [] |
127 | | - for line_num, line in enumerate(content.splitlines(), 1): |
128 | | - if re.match(r"^\s*-\s+", line) and re.search( |
129 | | - r"[^\.:]$", line.rstrip() |
130 | | - ): |
131 | | - invalid_lines.append((line_num, line.strip())) |
132 | | - |
133 | | - if invalid_lines: |
134 | | - click.echo( |
135 | | - f"❌ Found bullet points in {changelog_path} without proper " |
136 | | - "punctuation:" |
137 | | - ) |
138 | | - click.echo() |
139 | | - for line_num, line in invalid_lines: |
140 | | - click.echo(f"Line {line_num}: {line}") |
141 | | - click.echo() |
142 | | - click.echo("💡 All bullet points should end with:") |
143 | | - click.echo(" - A period (.) for regular entries.") |
144 | | - click.echo(" - A colon (:) for paragraphs that introduce lists.") |
145 | | - sys.exit(1) |
146 | | - else: |
147 | | - click.echo("✅ All bullet points have proper punctuation!") |
148 | | - sys.exit(0) |
0 commit comments