-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Store grammar git version within license file when caching #4268
Conversation
All licenses should remain the same except where there is clearly a change in license
@@ -1,7 +1,5 @@ | |||
#!/usr/bin/env ruby | |||
|
|||
# TODO: push these changes to licensor gem | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're not going to do this, so no need for this comment.
script/licensed
Outdated
@@ -24,10 +22,10 @@ module Licensed | |||
|
|||
def dependencies | |||
Dir.glob(@glob).map do |directory| | |||
puts "caching #{directory}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is duplicating info that is already printed by Licensed. Licensed will print:
Caching licenses for linguist:
grammar dependencies:
Using sublime-rexx (2e304a34d3493e7453a430735191d91f356faa5a)
Using Modelica (c841b17b0f441451b43a0b0e62bc6201a3456b83)
Using atom-language-purescript (cc2cb471968eb331af7259aac219feb3017d709e)
[...]
Caching Sublime-Coq (94e43bdc194535cf5bae9306624039af9f38c014)
[...]
Using
signifies nothing has changed, Caching
signifies a change.
- Sublime-Lasso | ||
- blitzmax # No license file. License in README | ||
- creole # License filename is not LICENSE(.*) but rather "The MIT License (MIT)" | ||
- Sublime-Lasso # No license file. License in README |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Equivalent of what we do in test_grammars.rb
@lildude
I'm not sure this is entirely necessary. Now that you've built in versioning, |
license: apache-2.0 | ||
--- | ||
Apache License | ||
Apache License |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤦♂️ ok licensed
is too aggressive in stripping leading empty space
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops. I meant to update our Licensed dependency too. If you're going to address this 🔜, I can hold off merging this PR and update the licenses again once a newer version of Licensed is available.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, I think you may not need to do anything @jonabc. Just updated the gemspec and I'm not seeing that over-stripping of whitespace with Licensed 1.3.3.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmmm, but now the version has changed 😕 Issue in Licensed coming up.
Ah, cool. I'll remove that then. 🙇♂️ |
This reverts commit c86cfd1. This isn't needed now we're versioning out license files
This is to be expected. TTBOMK, year ranges in a project's license should be updated each time work has been made in a new year. 😉 Realistically, we should be expecting this of everybody... |
After a little back-and-forth with @jonabc, I think I've come to a good solution which ties our cached license versions to the submodule SHAs. We don't update these independently of each other so it makes sense to use this tie. Licensed may gain support for a submodule source which may allow us to simplify or even remove our Filesystem implementation in future. Until then, I think this does the trick. Ready for reviews. |
@lildude I'm curious whether removing the tests is still being thought about. I'm curious whether licensed is able to cover those test cases or if there's something that it's not checking that it could and/or should. |
Whoops. I meant to come back and remove those three tests. I think |
🔥'd |
Are the remaining tests using It looks like those tests only exist to ensure the hashes are valid for use in the tests that you removed in 7cf1233 |
🤔 good question. I believe they were originally written to keep track of when a whitelisted project gained a license and |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❤️ licensed
setup looks good. let me know if there's anything else you have questions on or want help with
I'm merging a |
Done. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. 👍 I ran the tests after adding a grammar for a new language entry, and they all passed (the grammar is language-file-magic
).
🎉 I've also tested with updating grammars and it does a good job of flagging changes there too. Gonna merge and start work on a new release. |
Description
As discovered by @pchaigno in #4265, running
script/licensed
results in some unexpected changes to the cached licenses. Some of this was because the grammars have been updated, but not the licenses (🙋♂️ my fault), and some due to stripping of newlines etc.As pointed out by @jonabc at #4265 (comment):
I looked into the latter in #4267, and this proved way too complex for our needs so I've gone with the former.
At the same time, I've added
script/licensed
to be run just beforescript/licensed status
in CI. This should cause the latter to flag any issues.I've also updated the contributing guidelines so other Hubbers will remember to perform the
script/licensed
step each time the grammars are updated.And of course, I've updated all of the licenses so they have a version flag. The only changes to actual licenses are where the license has legitimately changed within the grammar. Mr @Alhadis has done this a few times 😉
The
curated
flag has also been removed from the license files as this isn't honoured by anything and the version check should effectively lock us to an approved version. Thescript/licensed && script/licensed status
should pick up any changes that'll need re-evaluating as-and-when the grammar is updated.As licensed is performing a license check on our cached licenses and these are now tied to a version, I'm tempted to ditch the checks we're performing directly with licensee at https://github.com/github/linguist/blob/8bf9efa3702a1a43df85dc5cd72b63f3ff36871f/test/test_grammars.rb#L91-L142
Thoughts? @jonabc, I think the
script/licensed status
is effectively performing what ☝️ tests are. Am I right?Checklist:
Fixes #4265