confluence-mdx: 불필요 코드 및 중복 코드 분석 + 리팩토링 실행#796
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
reverse-sync, mdx-to-storage, converter 등 전체 모듈을 대상으로 불필요한 구현(dead code)과 중복 코드를 분석한 문서를 작성합니다. - analysis-dead-code.md: 삭제 가능한 코드 범위 (~44줄) - analysis-duplicate-code.md: 7개 중복 영역, 리팩토링 로드맵 (~290줄 절감) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
추가 분석 결과를 반영하여 삭제 범위를 보강합니다: - 중복 CLI 래퍼 (mdx_to_storage_xhtml_cli.py) ~194줄 - 위치 부적절 CLI 래퍼 (test_verify.py) ~67줄 - Phase별 태스크 전용 래퍼 모듈 3건 ~335줄 - 총 삭제 가능 범위: ~44줄(즉시) + ~596줄(통합 후) = ~640줄 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
c7dd721에서 _debug_markdown에 "# Used when debugging manually" 주석이 추가된 것을 반영하여, 디버그 관련 코드(_debug_markdown, _debug_tags)를 삭제 대상에서 유지 대상으로 변경합니다. - 즉시 삭제 가능한 dead code: ~44줄 → 0줄 - 총 삭제 가능 범위: ~640줄 → ~596줄 (래퍼 통합분만 해당) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
분석 문서(analysis-dead-code.md, analysis-duplicate-code.md)에서 식별한 개선 대상을 실행합니다. - CLI 통합: mdx_to_storage_xhtml_cli.py를 단일 진입점으로 확장 (batch-verify 강화, final-verify, baseline 서브커맨드 추가) 삭제: verify_cli, phase1_baseline_cli, final_verify, baseline 모듈 - 텍스트 유틸리티 통합: text_normalizer → text_utils로 함수 이동, text_normalizer를 re-export 래퍼로 전환 - MDX 파서 통합: parser.py Block에 line_start/line_end 추가, parse_mdx_blocks() 호환 함수 추가, mdx_block_parser.py를 re-export 래퍼로 전환 - 인라인 변환기 통합: mdx_to_xhtml_inline.py의 _convert_inline()을 mdx_to_storage.inline.convert_inline으로 대체 - Regex 패턴 정리: emitter.py의 HEADING_PATTERN을 parser.py에서 import - 문서 업데이트: 분석 문서 및 architecture.md에 실행 결과 반영 테스트: 626 passed, 1 pre-existing failure (splice byte-equal) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
97e67fb to
cffbd41
Compare
rehydrator.py의 splice 경로와 sidecar.build_sidecar()가 mdx_block_parser.py의 블록 분할에 의존합니다. sidecar의 mdx_content_hash가 이 파서 기준으로 생성되므로, parser.py로 대체하면 해시 불일치로 splice byte-equal이 깨집니다. - mdx_block_parser.py: re-export 래퍼 → 원본 구현 복원 - sidecar.py build_sidecar(): parser.py → mdx_block_parser.py import 복원 - 문서 업데이트: Phase 2 상태를 '부분 완료'로 변경 테스트: 627 passed, 0 failed Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
분석 문서
analysis-dead-code.md— dead code 분석 (모듈/함수/도달 불가능 코드)analysis-duplicate-code.md— 7개 중복 영역 식별 및 리팩토링 로드맵리팩토링 실행 (28개 파일, +1,232 / -1,439줄)
1. CLI 통합 —
mdx_to_storage_xhtml_cli.py를 단일 진입점으로 확장batch-verify강화 (--ignore-ri-filename,--pages-yaml옵션 추가)final-verify,baseline서브커맨드 추가mdx_to_storage_xhtml_verify_cli.py,mdx_to_storage_phase1_baseline_cli.py,mdx_to_storage_final_verify.py,mdx_to_storage_baseline.py+ 관련 테스트 4개2. 텍스트 유틸리티 통합 —
text_normalizer.py→text_utils.pystrip_for_compare,normalize_mdx_to_plain,collapse_ws,strip_list_marker,EMOJI_RE를text_utils.py로 이동text_normalizer.py를 backward-compat re-export 래퍼로 전환3. MDX 파서 통합 —
mdx_block_parser.py→parser.pyBlock데이터클래스에line_start/line_end필드 추가parse_mdx_blocks()호환 함수 추가mdx_block_parser.py를 backward-compat re-export 래퍼로 전환4. 인라인 변환기 통합
mdx_to_xhtml_inline.py의 자체_convert_inline()을 삭제mdx_to_storage.inline.convert_inline을 import하여 사용5. Regex 패턴 정리
emitter.py의_HEADING_LINE_PATTERN을parser.py의HEADING_PATTERN에서 import6. 문서 업데이트
analysis-dead-code.md,analysis-duplicate-code.md— 실행 결과 반영architecture.md— CLI 명령어 목록, 모듈 설명 업데이트Test plan
python3 -m pytest tests/— 626 passed, 1 pre-existing failure (splice byte-equal)mdx_to_storage_xhtml_cli.py --help— 5개 서브커맨드 확인 (convert, verify, batch-verify, final-verify, baseline)🤖 Generated with Claude Code