Skip to content

Commit 2f983ea

Browse files
authored
Add missing --skip-comments option (#421)
1 parent a5ffb97 commit 2f983ea

File tree

3 files changed

+20
-1
lines changed

3 files changed

+20
-1
lines changed

docs/releasenotes/3.3.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ English language is supported by default.
3131
* Updated MergeAndOrderSections to not merge language: <lang> header with other comment sections
3232
* Sections with only language: <lang> marker and less than ``section_lines`` empty lines will be not transformed by NormalizeNewLines
3333

34+
Fixes
35+
------
36+
* Add missing ``--skip-comments`` option (#418)
37+
3438
Other
3539
-----
3640
* Reorganized our imports to better support optional rich dependency (#419)

robotidy/cli.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,7 @@ def print_transformers_list(target_version: int):
391391
help="Parse Robot Framework files using additional languages.",
392392
show_default="en",
393393
)
394+
@skip.comments_option
394395
@skip.documentation_option
395396
@skip.return_values_option
396397
@skip.keyword_call_option
@@ -435,6 +436,7 @@ def cli(
435436
force_order: bool,
436437
target_version: int,
437438
language: Optional[List[str]],
439+
skip_comments: bool,
438440
skip_documentation: bool,
439441
skip_return_values: bool,
440442
skip_keyword_call: List[str],
@@ -492,6 +494,7 @@ def cli(
492494
timeout=skip_timeout,
493495
return_statement=skip_return,
494496
tags=skip_tags,
497+
comments=skip_comments,
495498
block_comments=skip_block_comments,
496499
)
497500

tests/utest/test_cli.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import pytest
66
from click import FileError, NoSuchOption
77

8-
from robotidy import utils
8+
from robotidy import skip, utils
99
from robotidy.cli import read_config
1010
from robotidy.files import DEFAULT_EXCLUDES, find_project_root, get_paths, read_pyproject_config
1111
from robotidy.transformers.aligners_core import AlignKeywordsTestsSection
@@ -445,3 +445,15 @@ def test_too_recent_target_version(self, mocked_version, option_name):
445445
f"Target Robot Framework version ({target_version}) "
446446
"should not be higher than installed version (" in error
447447
)
448+
449+
def test_skip_options(self, tmp_path):
450+
alternate_names = {"--skip-return-statement": "--skip-return"}
451+
with_values = {"--skip-keyword-call-pattern", "--skip-keyword-call"}
452+
option_names = []
453+
for skip_option in skip.SkipConfig.HANDLES:
454+
option = f"--{skip_option.replace('_', '-')}"
455+
option = alternate_names.get(option, option)
456+
option_names.append(option)
457+
if option in with_values:
458+
option_names.append("empty")
459+
run_tidy([*option_names, str(tmp_path)])

0 commit comments

Comments
 (0)