Class ReuseFileEntry
Represents REUSE metadata collected for a single file, including license identifiers and copyright statements.
public record ReuseFileEntry : IEquatable<ReuseFileEntry>
- Inheritance
-
ReuseFileEntry
- Implements
- Inherited Members
Constructors
ReuseFileEntry(AbsolutePath, ImmutableArray<string>, ImmutableArray<string>)
Represents REUSE metadata collected for a single file, including license identifiers and copyright statements.
public ReuseFileEntry(AbsolutePath Path, ImmutableArray<string> LicenseIdentifiers, ImmutableArray<string> CopyrightStatements)
Parameters
Path
AbsolutePathThe absolute path to the file the entry refers to.
LicenseIdentifiers
ImmutableArray<string>A list of SPDX license identifiers associated with the file.
CopyrightStatements
ImmutableArray<string>A list of copyright statements associated with the file.
Properties
CopyrightStatements
A list of copyright statements associated with the file.
public ImmutableArray<string> CopyrightStatements { get; init; }
Property Value
LicenseIdentifiers
A list of SPDX license identifiers associated with the file.
public ImmutableArray<string> LicenseIdentifiers { get; init; }
Property Value
Path
The absolute path to the file the entry refers to.
public AbsolutePath Path { get; init; }
Property Value
- AbsolutePath
Methods
CombineEntries(AbsolutePath, IEnumerable<ReuseFileEntry>)
Combines multiple ReuseFileEntry values into a single set by preserving relative order and removing duplicates.
public static ReuseCombinedEntry CombineEntries(AbsolutePath baseDirectory, IEnumerable<ReuseFileEntry> entries)
Parameters
baseDirectory
AbsolutePathThe directory to calculate relative ordering of files for deterministic output.
entries
IEnumerable<ReuseFileEntry>A sequence of entries to combine.
Returns
- ReuseCombinedEntry
A combined entry with de-duplicated license identifiers and copyright statements.
UpdateFileContents(ICommenter?)
Update the file REUSE headers with the data from this object, replacing the existing headers.
This method will try to detect binary files, and automatically put the metadata for them into the
corresponding .license
files.
public Task UpdateFileContents(ICommenter? commenter = null)
Parameters
commenter
ICommenter
Returns
Remarks
Note that this method guarantees correct updates only for quite strict formats of metadata — mostly for the data it has saved itself.
For any data format that is not strict (e.g., additional comments, additional letters, additional empty lines, metadata not at the very beginning of the file, etc.), it does the best effort of preserving the existing data in the file, but will require manual review of the changes applied.