Skip to content

Add Pylint adapter and refactor adapter architecture#31

Merged
ikjeong merged 13 commits intomainfrom
feat/python
Nov 27, 2025
Merged

Add Pylint adapter and refactor adapter architecture#31
ikjeong merged 13 commits intomainfrom
feat/python

Conversation

@ikjeong
Copy link
Contributor

@ikjeong ikjeong commented Nov 27, 2025

Summary

  • Python 정적 분석을 위한 Pylint 어댑터 추가
  • 어댑터 아키텍처를 인스턴스 기반 자동 등록 방식으로 리팩토링하여 확장성 개선
  • LLM이 적절한 규칙을 선택할 수 있도록 라우팅 힌트 인터페이스 추가
  • ValidateChanges()를 활용한 통합 테스트 추가

Changes

  • Pylint 어댑터 추가 (Python static analysis)
  • 어댑터 레지스트리를 인스턴스 기반 자동 등록 방식으로 변경
  • LinterConverter를 각 어댑터 패키지로 이동하여 하드코딩 제거
  • GetRoutingHints 인터페이스 추가 (LLM 규칙 라우팅용)
  • Prettier 3.x 출력 포맷 지원
  • TSC executor 절대 경로 처리 수정
  • NewValidatorWithWorkDir 생성자 추가
  • 6개 어댑터(pylint, checkstyle, pmd, eslint, prettier, tsc) 통합 테스트 추가

- Adapters are now stateless and use CWD at execution time
- TSC temp config now uses ToolsDir/.tmp with unique filenames
- NewAdapter signature changed from (toolsDir, workDir) to (toolsDir)
- Updated all adapter tests accordingly
- Add LinterConverter interface to adapter.go
- Rewrite registry.go with Global() singleton, RegisterTool(), GetConverter(), GetConfigFile(), BuildLanguageMapping()
- Create adapter/common.go with DefaultToolsDir()
- Add register.go to each adapter (eslint, prettier, tsc, checkstyle, pmd) with init() auto-registration
- Create bootstrap/adapters.go for blank imports
- Update main.go to import bootstrap package
- Remove hardcoded languageLinterMapping from converter.go
- Remove hardcoded switch in getLinterConverter(), use registry instead
- Remove hardcoded switch in getAdapterConfig(), use registry.GetConfigFile()
- Change validator.go to use Global() instead of DefaultRegistry()
- Add type aliases in linters/interface.go for backward compatibility
- Delete registry/init.go to avoid import cycle
@ikjeong ikjeong self-assigned this Nov 27, 2025
…ding

Part C: Remove hardcoded linter references
- Add GetLLMDescription() method to LinterConverter interface
- Update cmd/init.go to dynamically get config files from registry
- Update cmd/convert.go to dynamically build --targets flag description
- Update converter.go to dynamically build LLM prompts from registry

Part D: Move LinterConverters to adapter packages
- Create converter.go in each adapter package (eslint, prettier, tsc, checkstyle, pmd)
- Update register.go files to use same-package NewConverter()
- Delete converter/linters package (eslint.go, prettier_tsc.go, checkstyle.go, pmd.go, interface.go)

Registry enhancements:
- Add GetAllConfigFiles() method
- Add GetAllConverters() method

This completes the OCP-compliant adapter architecture:
- Adding a new adapter only requires creating files in adapter/<new>/ directory
- Plus one blank import line in bootstrap/adapters.go (Go language limitation)
- Implement Pylint adapter with capabilities for Python linting.
- Add support for virtual environment management and installation of Pylint.
- Create configuration file generation for Pylint using LLM for rule conversion.
- Implement tests for adapter functionality, including execution and output parsing.
- Update bootstrap to include Pylint adapter registration.

This addition enhances the static analysis capabilities of the Symphony CLI for Python projects.
- workDir을 직접 지정할 수 있는 생성자 추가
- symDir은 workDir/.sym으로 자동 설정
- 6개 어댑터(pylint, checkstyle, pmd, eslint, prettier, tsc) 테스트 추가
- testdata 디렉토리에 각 도구별 테스트 파일 및 설정 추가
- init_test.go로 어댑터 등록 처리
Copy link
Contributor

@sehwan505 sehwan505 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ikjeong ikjeong merged commit 4b8690e into main Nov 27, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants