Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upAdded test-tidy for dependent licenses. #12511
Conversation
highfive
commented
Jul 19, 2016
|
Heads up! This PR modifies the following files:
|
| lines = f.read().splitlines(True) | ||
| for idx, line in enumerate(lines): | ||
| for license in licenses_dep_toml: | ||
| ok_licensed |= (license in line) |
This comment has been minimized.
This comment has been minimized.
wafflespeanut
Jul 19, 2016
Member
Not sure whether license would be a valid name. It's a built-in function :)
This comment has been minimized.
This comment has been minimized.
| filename = os.path.join(root, filename) | ||
| with open(filename, "r") as f: | ||
| ok_licensed = False | ||
| lines = f.read().splitlines(True) |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
| @@ -642,6 +642,23 @@ def check_wpt_lint_errors(files): | |||
| yield ("WPT Lint Tool", "", "lint error(s) in Web Platform Tests: exit status {0}".format(returncode)) | |||
|
|
|||
|
|
|||
| def check_dep_license_errors(progress): | |||
| for root, directories, filenames in os.walk(".cargo"): | |||
This comment has been minimized.
This comment has been minimized.
wafflespeanut
Jul 19, 2016
Member
It'd be better if we print something like 'Checking licenses...' before beginning the iterator.
This comment has been minimized.
This comment has been minimized.
| @@ -675,8 +692,10 @@ def scan(only_changed_files=False, progress=True): | |||
| errors = collect_errors_for_files(files_to_check, checking_functions, line_checking_functions) | |||
| # wpt lint checks | |||
| wpt_lint_errors = check_wpt_lint_errors(get_wpt_files(only_changed_files, progress)) | |||
| # check dependecy licenses | |||
| dep_license_errors = check_dep_license_errors(progress) | |||
This comment has been minimized.
This comment has been minimized.
wafflespeanut
Jul 19, 2016
Member
Also, doesn't this consume time? Wouldn't it be better if we check this when we run ./mach test-tidy --all (i.e.,) only_changed_files=False?
This comment has been minimized.
This comment has been minimized.
|
BTW, the progress indicator isn't printing correctly:
what is the magic I should be using? |
| 'license = "MIT / Apache-2.0"', | ||
| 'license = "MIT OR Apache-2.0"', | ||
| 'license = "MIT"', | ||
| 'license = "MIT"', |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
The Also, it would be good to have the lint run even if progress is |
|
But, the |
| print '\nRunning the dependency licensing lint...' | ||
| for root, directories, filenames in os.walk(".cargo"): | ||
| if progress: | ||
| filenames = progress_wrapper(filenames) |
This comment has been minimized.
This comment has been minimized.
wafflespeanut
Jul 20, 2016
Member
Yep, I missed this. As Aneesh said, this should be
filenames = progress_wrapper(filenames) if progress else filenames
This comment has been minimized.
This comment has been minimized.
asajeffrey
Jul 20, 2016
Author
Member
Fixed. (Also fixed the indentation, bah humbug emacs python mode.)
|
@wafflespeanut I'd prefer to use iterators everywhere (for reduced memory usage), but your call. At the very least, I think we should still accept regular iterators as input to |
|
How come do we have to do something similar to grep when we could read the files as TOML files from Python? |
|
Yay, the progress meter now works! |
|
@nox: it would be a bit cleaner to parse the toml file, but would probably use a bit more memory unless there's a clever streaming toml parser out there. |
|
#12507 has landed, so we should be able to land this one. @larsbergstrom? |
|
Reviewed 2 of 2 files at r3. Comments from Reviewable |
|
looks good! squash and r=me |
e003c73
to
536314b
|
Squashed. @bors-servo r=larsbergstrom |
|
|
…trom Added test-tidy for dependent licenses. <!-- Please describe your changes on the following line: --> Add a test-tidy lint for dependency licenses. Note that #12507 should land first. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes do not require tests because we don't test our lints <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/12511) <!-- Reviewable:end -->
|
|
asajeffrey commentedJul 19, 2016
•
edited by larsbergstrom
Add a test-tidy lint for dependency licenses. Note that #12507 should land first.
./mach build -ddoes not report any errors./mach test-tidydoes not report any errorsThis change is