Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cover ignored blocks in Spec and FAQ #104

Merged
merged 3 commits into from May 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
43 changes: 43 additions & 0 deletions faq.md
Expand Up @@ -113,6 +113,49 @@ testing.
If you have an entire directory that you want to "exclude" from REUSE compliance
testing, you can [use a DEP5 file](#bulk-license).

## How do I exclude certain files from REUSE compliance testing? {#exclude-lines}

In order to make the tool ignore a specific section containing strings that may
falsely be detected as copyright or license statements, you can wrap it within
the two comments `REUSE-IgnoreStart` and `REUSE-IgnoreEnd`.

Please note that this must not be used to ignore valid copyright and licensing
information by yourself or a third party. The ignore blocks must only be used
for marking blocks that may trigger false-positive detections and errors.

An example for a file that contains commands or documentation that confuse the
REUSE helper tool:

```
# SPDX-FileCopyrightText: 2021 Jane Doe
#
# SPDX-License-Identifier: GPL-3.0-or-later

echo "SPDX-FileCopyrightText: $(date +'%Y') John Doe" > file.txt
echo "SPDX-License-Identifier: MIT" > file.txt
```

The tool would complain that it cannot parse the license in the last line and it
would falsely understand the second-last line as an additional copyright holder:

```
reuse._util - ERROR - Could not parse 'MIT" > file.txt'
reuse.project - ERROR - 'foobar.sh' holds an SPDX expression that cannot be parsed, skipping the file
```

This is how the section that causes these errors can be ignored:

```
# SPDX-FileCopyrightText: 2021 Jane Doe
#
# SPDX-License-Identifier: GPL-3.0-or-later

# REUSE-IgnoreStart
echo "SPDX-FileCopyrightText: $(date +'%Y') John Doe" > file.txt
echo "SPDX-License-Identifier: MIT" > file.txt
# REUSE-IgnoreEnd
```

## Do you support a version control system other than Git? {#no-git}

Yes, the helper tool also supports [Mercurial](https://www.mercurial-scm.org/).
Expand Down
20 changes: 20 additions & 0 deletions spec.md
Expand Up @@ -129,6 +129,26 @@ An example of a comment header:
# SPDX-License-Identifier: GPL-3.0-or-later
```

If these tags are additionally used in the file without describing the file's
actual license or copyright but for example as part of an output command or
documentation, these occurences MAY be put between two comments:
`REUSE-IgnoreStart` and `REUSE-IgnoreEnd`. The REUSE Tool then ignores all tags
within. This technique MUST NOT be used to ignore valid tags for licensing or
copyright.

An example for an ignored block:

```
# SPDX-FileCopyrightText: 2021 Jane Doe
#
# SPDX-License-Identifier: GPL-3.0-or-later

# REUSE-IgnoreStart
echo "SPDX-FileCopyrightText: $(date +'%Y') John Doe" > file.txt
echo "SPDX-License-Identifier: MIT" > file.txt
# REUSE-IgnoreEnd
```

### DEP5

Alternatively, Copyright and Licensing Information MAY be associated with a
Expand Down