Skip to content

Commit

Permalink
Merge pull request #1014 from kbroch-rivosinc/dev/kbroch/dev/kbroch/s…
Browse files Browse the repository at this point in the history
…kip-unrecognized

add alternate spelling --skip-unrecognized #974
  • Loading branch information
carmenbianca authored Jun 28, 2024
2 parents 9a1122a + 74904ec commit 33c331b
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 9 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<!--
SPDX-FileCopyrightText: 2017 Free Software Foundation Europe e.V. <https://fsfe.org>
SPDX-FileCopyrightText: 2023 DB Systel GmbH
SPDX-FileCopyrightText: 2024 Rivos Inc.
SPDX-FileCopyrightText: © 2020 Liferay, Inc. <https://liferay.com>
SPDX-License-Identifier: CC-BY-SA-4.0
Expand Down Expand Up @@ -51,6 +52,7 @@ CLI command and its behaviour. There are no guarantees of stability for the
- Zsh (`.zshrc`) (#997)
- Perl test (`.t`) (#997)
- BATS test (`.bats`) (#997)
- Support alternate spelling `--skip-unrecognized` (#974)

### Changed

Expand Down
17 changes: 12 additions & 5 deletions src/reuse/_annotate.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
# SPDX-FileCopyrightText: 2019 Free Software Foundation Europe e.V. <https://fsfe.org>
# SPDX-FileCopyrightText: 2019 Stefan Bakker <s.bakker777@gmail.com>
# SPDX-FileCopyrightText: 2019 Kirill Elagin <kirelagin@gmail.com>
# SPDX-FileCopyrightText: 2019 Stefan Bakker <s.bakker777@gmail.com>
# SPDX-FileCopyrightText: 2020 Dmitry Bogatov
# SPDX-FileCopyrightText: © 2020 Liferay, Inc. <https://liferay.com>
# SPDX-FileCopyrightText: 2021 Alvar Penning
# SPDX-FileCopyrightText: 2021 Alliander N.V. <https://alliander.com>
# SPDX-FileCopyrightText: 2021 Alvar Penning
# SPDX-FileCopyrightText: 2021 Robin Vobruba <hoijui.quaero@gmail.com>
# SPDX-FileCopyrightText: 2022 Carmen Bianca Bakker <carmenbianca@fsfe.org>
# SPDX-FileCopyrightText: 2022 Florian Snow <florian@familysnow.net>
# SPDX-FileCopyrightText: 2022 Yaman Qalieh
# SPDX-FileCopyrightText: 2022 Carmen Bianca Bakker <carmenbianca@fsfe.org>
# SPDX-FileCopyrightText: 2024 Rivos Inc.
# SPDX-FileCopyrightText: © 2020 Liferay, Inc. <https://liferay.com>
#
# SPDX-License-Identifier: GPL-3.0-or-later

Expand All @@ -18,7 +19,7 @@
import logging
import os
import sys
from argparse import ArgumentParser, Namespace
from argparse import SUPPRESS, ArgumentParser, Namespace
from gettext import gettext as _
from pathlib import Path
from typing import IO, Iterable, Optional, Set, Tuple, Type, cast
Expand Down Expand Up @@ -478,6 +479,12 @@ def add_arguments(parser: ArgumentParser) -> None:
action="store_true",
help=_("skip files with unrecognised comment styles"),
)
style_mutex_group.add_argument(
"--skip-unrecognized",
dest="skip_unrecognised",
action="store_true",
help=SUPPRESS,
)
parser.add_argument(
"--skip-existing",
action="store_true",
Expand Down
14 changes: 10 additions & 4 deletions tests/test_main_annotate.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# SPDX-FileCopyrightText: 2019 Free Software Foundation Europe e.V. <https://fsfe.org>
# SPDX-FileCopyrightText: 2019 Stefan Bakker <s.bakker777@gmail.com>
# SPDX-FileCopyrightText: © 2020 Liferay, Inc. <https://liferay.com>
# SPDX-FileCopyrightText: 2022 Florian Snow <florian@familysnow.net>
# SPDX-FileCopyrightText: 2022 Carmen Bianca Bakker <carmenbianca@fsfe.org>
# SPDX-FileCopyrightText: 2022 Florian Snow <florian@familysnow.net>
# SPDX-FileCopyrightText: 2023 Maxim Cournoyer <maxim.cournoyer@gmail.com>
# SPDX-FileCopyrightText: 2024 Rivos Inc.
# SPDX-FileCopyrightText: © 2020 Liferay, Inc. <https://liferay.com>
#
# SPDX-License-Identifier: GPL-3.0-or-later

Expand Down Expand Up @@ -563,7 +564,12 @@ def test_annotate_unrecognised_style(fake_repository, capsys):
assert "foo.foo" in stdout


def test_annotate_skip_unrecognised(fake_repository, stringio):
@pytest.mark.parametrize(
"skip_unrecognised", ["--skip-unrecognised", "--skip-unrecognized"]
)
def test_annotate_skip_unrecognised(
fake_repository, skip_unrecognised, stringio
):
"""Skip file that has an unrecognised extension."""
simple_file = fake_repository / "foo.foo"
simple_file.write_text("pass")
Expand All @@ -575,7 +581,7 @@ def test_annotate_skip_unrecognised(fake_repository, stringio):
"GPL-3.0-or-later",
"--copyright",
"Jane Doe",
"--skip-unrecognised",
skip_unrecognised,
"foo.foo",
],
out=stringio,
Expand Down

0 comments on commit 33c331b

Please sign in to comment.