Skip to content

Commit cd68913

Browse files
committed
docs: Convert Korean comments to English for better readability
1 parent dbdff60 commit cd68913

File tree

3 files changed

+73
-73
lines changed

3 files changed

+73
-73
lines changed

docs/extra-lint-rules.md

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,55 @@
1-
# SAM CLI 추가 Lint 규칙 사용 가이드
1+
# SAM CLI Extra Lint Rules Usage Guide
22

3-
AWS SAM CLI의 `validate` 명령어는 템플릿 검증을 위해 [cfn-lint](https://github.com/aws-cloudformation/cfn-lint)를 사용합니다.
4-
이제 SAM CLI는 `--extra-lint-rules` 옵션을 통해 추가 lint 규칙을 지원합니다.
3+
The AWS SAM CLI's `validate` command uses [cfn-lint](https://github.com/aws-cloudformation/cfn-lint) for template validation.
4+
SAM CLI now supports additional lint rules through the `--extra-lint-rules` option.
55

6-
## 사용 방법
6+
## Usage
77

88
```bash
99
sam validate --lint --extra-lint-rules="cfn_lint_serverless.rules"
1010
```
1111

12-
## 인스톨러로 SAM CLI 설치 시 고려사항
12+
## Considerations when Installing SAM CLI with the Installer
1313

14-
SAM CLI를 인스톨러(설치 프로그램)로 설치한 경우, SAM CLI는 자체 Python 환경을 사용합니다. 이 경우 추가 규칙 모듈이 해당 환경에 설치되어 있어야 합니다. 이 때 두 가지 접근 방식이 있습니다:
14+
When SAM CLI is installed using the installer, it uses its own Python environment. In this case, additional rule modules must be installed in that environment. There are two approaches:
1515

16-
1. **인스톨러 Python 환경에 패키지 설치**: 인스톨러의 Python 환경에 필요한 패키지를 설치합니다.
17-
2. **모듈 경로를 전체 경로로 지정**: 사용자 환경에 설치된 패키지의 전체 경로를 지정합니다.
16+
1. **Install packages in the installer's Python environment**: Install the required packages in the installer's Python environment.
17+
2. **Specify the full path to the module**: Specify the full path to the package installed in the user's environment.
1818

19-
## 사용 예제
19+
## Usage Examples
2020

21-
### 서버리스 규칙 사용 (cfn-lint-serverless)
21+
### Using Serverless Rules (cfn-lint-serverless)
2222

2323
```bash
24-
# 먼저 패키지 설치
24+
# First, install the package
2525
pip install cfn-lint-serverless
2626

27-
# SAM 템플릿 검증 실행
27+
# Run SAM template validation
2828
sam validate --lint --extra-lint-rules="cfn_lint_serverless.rules"
2929
```
3030

31-
### 여러 규칙 모듈 사용
31+
### Using Multiple Rule Modules
3232

33-
#### 방법 1: 콤마(,)로 구분하여 지정
33+
#### Method 1: Specify Multiple Modules Separated by Commas
3434

35-
여러 규칙 모듈을 콤마(,)로 구분하여 한 번의 옵션으로 지정할 수 있습니다:
35+
You can specify multiple rule modules separated by commas in a single option:
3636

3737
```bash
3838
sam validate --lint --extra-lint-rules="module1.rules,module2.rules,module3.rules"
3939
```
4040

41-
각 모듈은 자동으로 분리되어 cfn-lint에 전달됩니다.
41+
Each module is automatically separated and passed to cfn-lint.
4242

43-
#### 방법 2: 옵션을 여러 번 사용
43+
#### Method 2: Use the Option Multiple Times
4444

45-
`--extra-lint-rules` 옵션을 여러 번 사용하여 여러 규칙 모듈을 지정할 수도 있습니다:
45+
You can also specify multiple rule modules by using the `--extra-lint-rules` option multiple times:
4646

4747
```bash
4848
sam validate --lint --extra-lint-rules="module1.rules" --extra-lint-rules="module2.rules"
4949
```
5050

51-
## 참고사항
51+
## Notes
5252

53-
* 과거에 사용하던 `--serverless-rules` 옵션은 deprecated 되었습니다.
54-
* 새로운 `--extra-lint-rules` 옵션을 사용하는 것이 좋습니다.
55-
* 인스톨러로 SAM CLI를 설치한 경우 추가 규칙이 작동하지 않으면 인스톨러의 Python 환경에 패키지가 설치되어 있는지 확인하세요.
53+
* The previously used `--serverless-rules` option is deprecated.
54+
* It is recommended to use the new `--extra-lint-rules` option.
55+
* If you installed SAM CLI using the installer and additional rules are not working, check if the package is installed in the installer's Python environment.

samcli/commands/validate/validate.py

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -81,13 +81,13 @@ class SamTemplate:
8181
def cli(ctx, template_file, config_file, config_env, lint, save_params, serverless_rules, extra_lint_rules):
8282
# All logic must be implemented in the ``do_cli`` method. This helps with easy unit testing
8383

84-
# serverless_rules 옵션이 사용되면 경고 표시 및 extra_lint_rules로 변환
84+
# Show warning and convert to extra_lint_rules if serverless_rules is used
8585
if serverless_rules and not extra_lint_rules:
8686
click.secho(
8787
"Warning: --serverless-rules is deprecated. Please use --extra-lint-rules=\"cfn_lint_serverless.rules\" instead.",
8888
fg="yellow"
8989
)
90-
# 이전 옵션을 새 옵션으로 변환
90+
# Convert old option to new option
9191
extra_lint_rules = "cfn_lint_serverless.rules"
9292

9393
do_cli(ctx, template_file, lint, serverless_rules, extra_lint_rules) # pragma: no cover
@@ -184,8 +184,8 @@ def _lint(ctx: Context, template: str, template_path: str, serverless_rules: boo
184184
from cfnlint.runner import InvalidRegionException
185185
from samcli.lib.telemetry.event import EventTracker
186186

187-
# 디버그 정보 추가
188-
print(f"디버그 정보: serverless_rules 옵션 값 = {serverless_rules}")
187+
# Add debug information
188+
print(f"Debug info: serverless_rules option value = {serverless_rules}")
189189

190190
cfn_lint_logger = logging.getLogger(CNT_LINT_LOGGER_NAME)
191191
cfn_lint_logger.propagate = False
@@ -199,24 +199,24 @@ def _lint(ctx: Context, template: str, template_path: str, serverless_rules: boo
199199
cfn_lint_logger.propagate = True
200200
cfn_lint_logger.setLevel(logging.DEBUG)
201201

202-
print(f"디버그 정보: linter_config 초기값 = {linter_config}")
202+
print(f"Debug info: initial linter_config = {linter_config}")
203203

204-
# 두 옵션을 함께 처리하기 위한 변수 초기화
204+
# Initialize variable to handle both options together
205205
rules_to_append = []
206206

207-
# 이전 serverless_rules 옵션 지원 (deprecated)
207+
# Support for previous serverless_rules option (deprecated)
208208
if serverless_rules:
209-
print("디버그 정보: serverless_rules 옵션이 활성화되었습니다.")
209+
print("Debug info: serverless_rules option is activated.")
210210
# Track usage of Serverless Rules
211211
EventTracker.track_event("UsedFeature", "ServerlessRules")
212212

213213
# Check if cfn-lint-serverless is installed
214214
import importlib.util
215215
serverless_spec = importlib.util.find_spec("cfn_lint_serverless")
216-
print(f"디버그 정보: cfn_lint_serverless 패키지 설치 여부 = {serverless_spec is not None}")
216+
print(f"Debug info: cfn_lint_serverless package installed = {serverless_spec is not None}")
217217

218218
if serverless_spec is None:
219-
print("디버그 정보: cfn_lint_serverless 패키지가 설치되어 있지 않습니다.")
219+
print("Debug info: cfn_lint_serverless package is not installed.")
220220
click.secho(
221221
"Serverless Rules package (cfn-lint-serverless) is not installed. "
222222
"Please install it using: pip install cfn-lint-serverless",
@@ -230,13 +230,13 @@ def _lint(ctx: Context, template: str, template_path: str, serverless_rules: boo
230230
try:
231231
# Try to import the package
232232
import cfn_lint_serverless
233-
print("디버그 정보: cfn_lint_serverless 패키지 임포트 성공")
233+
print("Debug info: cfn_lint_serverless package import successful")
234234

235-
# Serverless Rules를 규칙 목록에 추가
235+
# Add Serverless Rules to the rule list
236236
rules_to_append.append("cfn_lint_serverless.rules")
237237
click.secho("Serverless Rules enabled for linting", fg="green")
238238
except ImportError as e:
239-
print(f"디버그 정보: cfn_lint_serverless 임포트 오류 = {e}")
239+
print(f"Debug info: cfn_lint_serverless import error = {e}")
240240
click.secho(
241241
"Serverless Rules package (cfn-lint-serverless) is not installed. "
242242
"Please install it using: pip install cfn-lint-serverless",
@@ -247,49 +247,49 @@ def _lint(ctx: Context, template: str, template_path: str, serverless_rules: boo
247247
"Please install it using: pip install cfn-lint-serverless"
248248
)
249249

250-
# 새로운 extra_lint_rules 옵션 지원
250+
# Support for the new extra_lint_rules option
251251
if extra_lint_rules:
252-
print(f"디버그 정보: extra_lint_rules 옵션이 활성화되었습니다. 값: {extra_lint_rules}")
252+
print(f"Debug info: extra_lint_rules option is activated. Value: {extra_lint_rules}")
253253
# Track usage of Extra Lint Rules
254254
EventTracker.track_event("UsedFeature", "ExtraLintRules")
255255

256-
# 콤마로 구분된 여러 규칙 모듈을 파싱
256+
# Parse comma-separated rule modules
257257
modules = [module.strip() for module in extra_lint_rules.split(',') if module.strip()]
258-
print(f"디버그 정보: 파싱된 규칙 모듈 목록 = {modules}")
258+
print(f"Debug info: parsed rule modules list = {modules}")
259259

260-
# 각 모듈을 규칙 목록에 추가
260+
# Add each module to the rule list
261261
rules_to_append.extend(modules)
262262
click.secho(f"Extra lint rules enabled: {extra_lint_rules}", fg="green")
263263

264-
# 규칙이 있으면 linter_config에 추가
264+
# Add rules to linter_config if any exist
265265
if rules_to_append:
266-
print(f"디버그 정보: 추가할 규칙 목록 = {rules_to_append}")
266+
print(f"Debug info: rules to append = {rules_to_append}")
267267
linter_config["append_rules"] = rules_to_append
268-
print(f"디버그 정보: linter_config 업데이트 = {linter_config}")
268+
print(f"Debug info: updated linter_config = {linter_config}")
269269

270270
config = ManualArgs(**linter_config)
271-
print(f"디버그 정보: config 생성 완료")
271+
print(f"Debug info: config creation completed")
272272

273273
try:
274-
print(f"디버그 정보: lint 함수 호출 시작")
274+
print(f"Debug info: starting lint function call")
275275
matches = lint(template, config=config)
276-
print(f"디버그 정보: lint 함수 호출 완료, matches = {matches}")
276+
print(f"Debug info: lint function call completed, matches = {matches}")
277277
except InvalidRegionException as ex:
278-
print(f"디버그 정보: InvalidRegionException 발생 = {ex}")
278+
print(f"Debug info: InvalidRegionException occurred = {ex}")
279279
raise UserException(
280280
f"AWS Region was not found. Please configure your region through the --region option.\n{ex}",
281281
wrapped_from=ex.__class__.__name__,
282282
) from ex
283283
except Exception as e:
284-
print(f"디버그 정보: 예외 발생 = {e}")
284+
print(f"Debug info: exception occurred = {e}")
285285
raise
286286

287287
if not matches:
288-
print(f"디버그 정보: 템플릿 검증 성공")
288+
print(f"Debug info: template validation successful")
289289
click.secho("{} is a valid SAM Template".format(template_path), fg="green")
290290
return
291291

292-
print(f"디버그 정보: 템플릿 검증 실패, matches = {matches}")
292+
print(f"Debug info: template validation failed, matches = {matches}")
293293
click.secho(matches)
294294

295295
raise LinterRuleMatchedException("Linting failed. At least one linting rule was matched to the provided template.")

tests/unit/commands/validate/test_cli.py

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -187,14 +187,14 @@ def test_serverless_rules_package_not_installed(self, find_spec_mock, click_patc
187187

188188
@patch("samcli.commands.validate.validate._read_sam_file")
189189
def test_cli_with_extra_lint_rules(self, mock_read_sam_file):
190-
# 테스트 준비
190+
# Prepare test
191191
template = "template"
192192
extra_lint_rules = "cfn_lint_serverless.rules"
193193
mock_read_sam_file.return_value = SamTemplate(serialized="", deserialized={})
194194

195-
# do_cli 함수를 직접 테스트
195+
# Test the do_cli function directly
196196
with patch("samcli.commands.validate.validate._lint") as mock_lint:
197-
# do_cli 호출
197+
# Call do_cli
198198
do_cli(
199199
ctx=ctx_mock(profile="profile", region="region"),
200200
template=template,
@@ -203,30 +203,30 @@ def test_cli_with_extra_lint_rules(self, mock_read_sam_file):
203203
extra_lint_rules=extra_lint_rules
204204
)
205205

206-
# _lint이 올바른 파라미터로 호출되는지 확인
206+
# Verify that _lint is called with the correct parameters
207207
mock_lint.assert_called_once()
208208
args, kwargs = mock_lint.call_args
209-
self.assertEqual(args[2], template) # template_path 파라미터
210-
self.assertEqual(args[3], False) # serverless_rules 파라미터
211-
self.assertEqual(args[4], extra_lint_rules) # extra_lint_rules 파라미터
209+
self.assertEqual(args[2], template) # template_path parameter
210+
self.assertEqual(args[3], False) # serverless_rules parameter
211+
self.assertEqual(args[4], extra_lint_rules) # extra_lint_rules parameter
212212

213213
@patch("cfnlint.api.lint")
214214
@patch("samcli.commands.validate.validate.click")
215215
def test_lint_with_extra_lint_rules(self, click_patch, lint_patch):
216-
# 테스트 준비
216+
# Prepare test
217217
template_path = "path_to_template"
218218
template_contents = "{}"
219219
extra_lint_rules = "custom.rules.module"
220220
lint_patch.return_value = []
221221

222-
# ManualArgs 클래스를 모킹하여 append_rules 속성이 올바르게 설정되는지 확인
222+
# Mock ManualArgs class to verify that append_rules property is set correctly
223223
with patch("samcli.lib.telemetry.event.EventTracker.track_event") as track_patch:
224224
with patch("cfnlint.api.ManualArgs") as manual_args_mock:
225-
# ManualArgs 객체가 append_rules 속성을 가지도록 설정
225+
# Set up ManualArgs object to have append_rules property
226226
manual_args_instance = Mock()
227227
manual_args_mock.return_value = manual_args_instance
228228

229-
# 테스트 실행
229+
# Run test
230230
_lint(
231231
ctx=ctx_lint_mock(debug=False, region="region"),
232232
template=template_contents,
@@ -235,11 +235,11 @@ def test_lint_with_extra_lint_rules(self, click_patch, lint_patch):
235235
extra_lint_rules=extra_lint_rules
236236
)
237237

238-
# 이벤트 추적 확인 - ExtraLintRules 이벤트가 추적되는지 확인
238+
# Verify event tracking - confirm ExtraLintRules event is being tracked
239239
track_patch.assert_any_call("UsedFeature", "CFNLint")
240240
track_patch.assert_any_call("UsedFeature", "ExtraLintRules")
241241

242-
# ManualArgs가 올바른 인자와 함께 호출되는지 확인
242+
# Verify ManualArgs is called with correct arguments
243243
manual_args_mock.assert_called_once()
244244
args, kwargs = manual_args_mock.call_args
245245
self.assertIn("append_rules", kwargs)
@@ -248,20 +248,20 @@ def test_lint_with_extra_lint_rules(self, click_patch, lint_patch):
248248
@patch("cfnlint.api.lint")
249249
@patch("samcli.commands.validate.validate.click")
250250
def test_lint_with_multiple_comma_separated_extra_lint_rules(self, click_patch, lint_patch):
251-
# 테스트 준비
251+
# Prepare test
252252
template_path = "path_to_template"
253253
template_contents = "{}"
254-
# 콤마로 구분된 여러 규칙 모듈 지정
254+
# Specify multiple rule modules separated by commas
255255
extra_lint_rules = "module1.rules,module2.rules,module3.rules"
256256
lint_patch.return_value = []
257257

258-
# ManualArgs 클래스를 모킹하여 append_rules 속성이 올바르게 설정되는지 확인
258+
# Mock ManualArgs class to verify that append_rules property is set correctly
259259
with patch("samcli.lib.telemetry.event.EventTracker.track_event"):
260260
with patch("cfnlint.api.ManualArgs") as manual_args_mock:
261261
manual_args_instance = Mock()
262262
manual_args_mock.return_value = manual_args_instance
263263

264-
# 테스트 실행
264+
# Run test
265265
_lint(
266266
ctx=ctx_lint_mock(debug=False, region="region"),
267267
template=template_contents,
@@ -270,31 +270,31 @@ def test_lint_with_multiple_comma_separated_extra_lint_rules(self, click_patch,
270270
extra_lint_rules=extra_lint_rules
271271
)
272272

273-
# ManualArgs가 올바른 인자와 함께 호출되는지 확인
273+
# Verify ManualArgs is called with correct arguments
274274
manual_args_mock.assert_called_once()
275275
args, kwargs = manual_args_mock.call_args
276276
self.assertIn("append_rules", kwargs)
277-
# 콤마로 구분된 각 모듈이 분리되어 리스트에 추가되는지 확인
277+
# Verify each comma-separated module is split and added to the list
278278
expected_rules = ["module1.rules", "module2.rules", "module3.rules"]
279279
self.assertEqual(set(kwargs["append_rules"]), set(expected_rules))
280280

281281
@patch("cfnlint.api.lint")
282282
@patch("samcli.commands.validate.validate.click")
283283
@patch("importlib.util.find_spec")
284284
def test_serverless_rules_deprecated_with_extra_lint_rules(self, find_spec_mock, click_patch, lint_patch):
285-
# 테스트 준비
285+
# Prepare test
286286
template_path = "path_to_template"
287287
template_contents = "{}"
288288
find_spec_mock.return_value = True
289289
lint_patch.return_value = []
290290

291-
# 두 옵션이 모두 제공되었을 때 extra_lint_rules가 우선되는지 확인
291+
# Verify when both options are provided, both rules are included
292292
with patch("samcli.lib.telemetry.event.EventTracker.track_event"):
293293
with patch("cfnlint.api.ManualArgs") as manual_args_mock:
294294
manual_args_instance = Mock()
295295
manual_args_mock.return_value = manual_args_instance
296296

297-
# 테스트 실행 - 두 옵션 모두 사용
297+
# Run test - use both options
298298
_lint(
299299
ctx=ctx_lint_mock(debug=False, region="region"),
300300
template=template_contents,
@@ -303,7 +303,7 @@ def test_serverless_rules_deprecated_with_extra_lint_rules(self, find_spec_mock,
303303
extra_lint_rules="custom.rules.module"
304304
)
305305

306-
# 검증 - 두 규칙이 모두 추가되는지 확인
306+
# Verify both rules are added
307307
manual_args_mock.assert_called_once()
308308
args, kwargs = manual_args_mock.call_args
309309
self.assertIn("append_rules", kwargs)

0 commit comments

Comments
 (0)