Main validator for Solr changelog structure.
| 68 | |
| 69 | |
| 70 | class ChangelogValidator: |
| 71 | """Main validator for Solr changelog structure.""" |
| 72 | |
| 73 | def __init__( |
| 74 | self, |
| 75 | git_root: Optional[Path] = None, |
| 76 | work_dir: Optional[Path] = None, |
| 77 | report_file: Optional[Path] = None, |
| 78 | changelog_file: Optional[Path] = None, |
| 79 | fetch_remote: bool = False, |
| 80 | report_format: str = "md", |
| 81 | skip_sync_check: bool = False, |
| 82 | check_duplicates: bool = False, |
| 83 | ): |
| 84 | """Initialize the validator. |
| 85 | |
| 86 | Args: |
| 87 | git_root: Root of git repository (auto-detected if not provided) |
| 88 | work_dir: Working directory for temporary branches (default: auto in /tmp) |
| 89 | report_file: File to write validation report to (default: stdout) |
| 90 | changelog_file: File to write generated CHANGELOG.md to. (default: none) |
| 91 | fetch_remote: If True, fetch from remote. |
| 92 | report_format: Report format ("md" for Markdown or "json" for JSON) |
| 93 | skip_sync_check: If True, skip git branch sync check |
| 94 | check_duplicates: If True, check for duplicate JIRA issues (default: False) |
| 95 | """ |
| 96 | if git_root is None: |
| 97 | git_root = self._find_git_root() |
| 98 | self.git_root = git_root |
| 99 | self.changelog_root = git_root / "changelog" |
| 100 | self.build_gradle = git_root / "build.gradle" |
| 101 | self.changelog_md = git_root / "CHANGELOG.md" |
| 102 | self.report_file = report_file |
| 103 | self.changelog_file = changelog_file |
| 104 | self.work_dir = work_dir |
| 105 | self.fetch_remote = fetch_remote |
| 106 | self.report_format = report_format |
| 107 | self.skip_sync_check = skip_sync_check |
| 108 | self.check_duplicates = check_duplicates |
| 109 | self.branches = {} |
| 110 | self.remote_branches = set() |
| 111 | self.errors = [] |
| 112 | self.warnings = [] |
| 113 | self.info_messages = [] |
| 114 | self.current_branch = None |
| 115 | self.temp_branch = None |
| 116 | |
| 117 | @staticmethod |
| 118 | def _find_git_root() -> Path: |
| 119 | """Find the git root directory.""" |
| 120 | try: |
| 121 | result = subprocess.run( |
| 122 | ["git", "rev-parse", "--show-toplevel"], |
| 123 | capture_output=True, |
| 124 | text=True, |
| 125 | check=True |
| 126 | ) |
| 127 | return Path(result.stdout.strip()) |
no outgoing calls
no test coverage detected
searching dependent graphs…