Add license detection #84
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a fairly large change that essentially pulls in a bulk of the https://github.com/jpeddicord/askalono crate to add the ability to detect the SPDX license for a file. For now this is basically just a copy of the code with minor tweaks, but opens up the possibility to make changes more easily in the future, eg. detecting multiple licenses in the same file.
The only major change made when inlining the askalono code into this crate was how the cache is serialized and used. askalono used msgpack (via rmp-serde) for de/serialization, which ended up being the impetus for finally doing this PR and addressing the fairly old issue of #67.
pastedependency 3Hren/msgpack-rust#372 this PR to removepaste(which has an unmaintained advisory) has others interested in getting rid of it, but since rmp-serde is effectively unmaintained has been sitting, though not as long as another PR that attempts to address the same issuermp-serdewithmsgpackerjpeddicord/askalono#102 was made to change from rmp-serde to msgpacker as a backwards-compatible change, but as stated previously, askalono is also effectively unmaintainedIn light of this, the biggest single change I did while inlining the askalono code was to use a really simple length-prefixed style format for serializing the cache data that doesn't use any external dependencies since the data is incredibly simple and doesn't need to interface with anything outside of itself.
Resolves: #67