Repository: fsfe/reuse-tool (language: python)

Issue:
REUSE Tool does not ignore files beginning with LICENSE
I'm working on a project that was up until recently REUSE compliant. I had two files, `LICENSE-MIT` and `LICENSE-APACHE` in the repository to have GitHub license recognition work as well as a `.reuse/dep5` and the `LICENSES` directory.

Today as I upgraded to `reuse` tool 4.0.2 from 3.0.2, I see a non-compliance warning with the above 2 license files being marked as not containing a license. As I understand from #881 that the tool ignores the files that start with `LICENSE`. Please advise on how to proceed here.

Repository: [CogDisResLab/Kaleidoscope](https://github.com/CogDisResLab/Kaleidoscope)


Discussion / hints:
Hi @AliSajid. Copying from the change log:

```markdown
- Previously, any file that begins with `COPYING` or `LICENSE` was ignored. This
  has been changed. Now, files like `COPYING_README` are no longer ignored, but
  `COPYING` and `COPYING.txt` are still ignored (in other words: exact matches,
  or `COPYING` + a file extension). Idem ditto for `LICENSE`. (#886)
```

It should suffice to rename to `LICENSE.MIT`.
`LICENSE.APACHE` may not be recognized correctly on <https://pkg.go.dev/> (see [License Disclaimer](https://pkg.go.dev/license-policy)). However, this may be something the other side should fix.
This is possibly also an issue that could be solved here, although it would annoyingly require a spec bump, which is not ideal at all. I'll get back on this.
> `LICENSE.APACHE` may not be recognized correctly on https://pkg.go.dev/ (see [License Disclaimer](https://pkg.go.dev/license-policy)). However, this may be something the other side should fix.

This may be solved by merging `LICENSE-MIT` and `LICENSE-APACHE` into a single file (`LICENSE`):

```text
Apache License 2.0 text

---

MIT License text
```
Thank you for this detailed response and I appreciate you helping me out. REUSE is a great project and I'm indebted to your team for it. Thank you.
You're welcome @AliSajid ! I will re-open this issue because I am discussing it tomorrow with the team.

Fix patch:
diff --git a/changelog.d/changed/unspecly-changes.md b/changelog.d/changed/unspecly-changes.md
new file mode 100644
index 000000000..8c8e85d58
--- /dev/null
+++ b/changelog.d/changed/unspecly-changes.md
@@ -0,0 +1,6 @@
+- Changes that are not strictly compatible with
+  [REUSE Specification v3.2](https://reuse.software/spec-3.2):
+  - More `LICENSE` and `COPYING`-like files are ignored. Now, such files
+    suffixed by `-anything` are also ignored, typically something like
+    `LICENSE-MIT`. Files with the UK spelling `LICENCE` are also ignored.
+    (#1041)
diff --git a/src/reuse/__init__.py b/src/reuse/__init__.py
index 7b98506c0..9bd35c2fb 100644
--- a/src/reuse/__init__.py
+++ b/src/reuse/__init__.py
@@ -64,8 +64,9 @@
 ]
 
 _IGNORE_FILE_PATTERNS = [
-    re.compile(r"^LICENSE(\..*)?$"),
-    re.compile(r"^COPYING(\..*)?$"),
+    # LICENSE, LICENSE-MIT, LICENSE.txt
+    re.compile(r"^LICEN[CS]E([-\.].*)?$"),
+    re.compile(r"^COPYING([-\.].*)?$"),
     # ".git" as file happens in submodules
     re.compile(r"^\.git$"),
     re.compile(r"^\.gitkeep$"),


Test patch:
diff --git a/tests/test_project.py b/tests/test_project.py
index 0041466ea..a7196eeac 100644
--- a/tests/test_project.py
+++ b/tests/test_project.py
@@ -112,13 +112,23 @@ def test_all_files_ignore_hg(empty_directory):
 
 
 def test_all_files_ignore_license_copying(empty_directory):
-    """When there are files names LICENSE, LICENSE.ext, COPYING, or COPYING.ext,
-    ignore them.
+    """When there are files named LICENSE, LICENSE.ext, LICENSE-MIT, COPYING,
+    COPYING.ext, or COPYING-MIT, ignore them.
     """
     (empty_directory / "LICENSE").write_text("foo")
     (empty_directory / "LICENSE.txt").write_text("foo")
+    (empty_directory / "LICENSE-MIT").write_text("foo")
     (empty_directory / "COPYING").write_text("foo")
     (empty_directory / "COPYING.txt").write_text("foo")
+    (empty_directory / "COPYING-MIT").write_text("foo")
+
+    project = Project.from_directory(empty_directory)
+    assert not list(project.all_files())
+
+
+def test_all_files_ignore_uk_license(empty_directory):
+    """Ignore UK spelling of licence."""
+    (empty_directory / "LICENCE").write_text("foo")
 
     project = Project.from_directory(empty_directory)
     assert not list(project.all_files())