PSScriptAnalyzer 모듈
PSScriptAnalyzer 모듈은 PSScriptAnalyzer로 PowerShell 스크립트를 검사해서, .ps1, .psm1, .psd1 파일에 애플리케이션 코드에 적용하는 것과 같은 리뷰 기준을 적용해요. PowerShell이 프로젝트의 일부이고 CI와 Dagger Cloud에서 스타일·안전성·ruleset 기대치를 강제하고 싶을 때 이 모듈을 사용하세요. 워크스페이스에서의 alias는 ps-analyzer라서, check와 설정도 그 이름을 사용해요.
출처: Dagger Docs
본문
워크스페이스에 추가하기 (Add it to your workspace)
dagger module install dagger.io/dotnet/PsScriptAnalyzer
검사 실행하기 (Run the check)
dagger check # run every check in the workspace
dagger check dag://ps-analyzer/check # run PSScriptAnalyzer on discovered PowerShell scripts
ps-analyzer:check는 워크스페이스의 모든 .ps1, .psm1, .psd1 파일을 찾아 Invoke-ScriptAnalyzer를 재귀적으로 실행하고, 보고된 진단(diagnostic)이 하나라도 있으면 실패해요.
설정하기 (Configure it)
dagger module settings ps-analyzer로 현재 설정과 값을 나열하고, dagger module settings ps-analyzer <key> <value>로 하나를 지정하세요. 설정은 dagger.toml의 [modules.ps-analyzer.settings] 아래에 저장돼요:
version(기본값1.22.0)은 설치할 PSScriptAnalyzer 릴리스예요. 로컬과 CI에서 같은 ruleset과 analyzer 동작이 돌도록 고정하세요.exclude(기본값: 없음)는 건너뛸 스크립트 경로 목록이에요.includeExtraFiles(기본값: 비어 있음)는 마운트할 추가 비(非)PowerShell 경로예요. 분석 중에 데이터 파일이나 다른 프로젝트 컨텍스트를 읽는 스크립트에 쓰여요.
dagger module settings ps-analyzer version 1.22.0
목록 값 설정은 dagger.toml에서 직접 편집해요:
[modules.ps-analyzer.settings]
version = "1.22.0"
exclude = ["tests/"]
includeExtraFiles = ["data/"]
다른 모듈과 함께 쓰기 (Working with other modules)
PowerShell 자동화, Windows 지원 스크립트, PowerShell 모듈이 있는 저장소에 이 모듈을 사용하세요. 셸이 섞인 워크스페이스에서는 ShellCheck와 상호 보완돼요.
더 알아보기 (Learn more)
- 소스 코드 — PSScriptAnalyzer 모듈 GitHub 저장소
- ShellCheck 모듈 — 셸 스크립트 검사 모듈