mirror of
https://github.com/servo/servo.git
synced 2025-08-07 06:25:32 +01:00
Auto merge of #13027 - UK992:tidy-toml, r=Wafflespeanut
Check for license only in Cargo.toml This fix problem with false reporting about missing license in every toml file, that is not Cargo.toml r? @Wafflespeanut <!-- 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 <!-- 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/13027) <!-- Reviewable:end -->
This commit is contained in:
commit
8a5e1b70b7
3 changed files with 4 additions and 5 deletions
|
@ -29,11 +29,10 @@ config = {
|
||||||
"skip-check-licenses": False,
|
"skip-check-licenses": False,
|
||||||
"ignore": {
|
"ignore": {
|
||||||
"files": [
|
"files": [
|
||||||
CONFIG_FILE_PATH, # ignore config file
|
"./.", # ignore hidden files
|
||||||
"./.", # ignore hidden files
|
|
||||||
],
|
],
|
||||||
"directories": [
|
"directories": [
|
||||||
"./.", # ignore hidden directories
|
"./.", # ignore hidden directories
|
||||||
],
|
],
|
||||||
"packages": [],
|
"packages": [],
|
||||||
}
|
}
|
||||||
|
@ -312,7 +311,7 @@ duplicate versions for package "{package}"
|
||||||
|
|
||||||
|
|
||||||
def check_toml(file_name, lines):
|
def check_toml(file_name, lines):
|
||||||
if not file_name.endswith(".toml"):
|
if not file_name.endswith("Cargo.toml"):
|
||||||
raise StopIteration
|
raise StopIteration
|
||||||
ok_licensed = False
|
ok_licensed = False
|
||||||
for idx, line in enumerate(lines):
|
for idx, line in enumerate(lines):
|
||||||
|
|
|
@ -117,7 +117,7 @@ class CheckTidiness(unittest.TestCase):
|
||||||
self.assertNoMoreErrors(errors)
|
self.assertNoMoreErrors(errors)
|
||||||
|
|
||||||
def test_toml(self):
|
def test_toml(self):
|
||||||
errors = tidy.collect_errors_for_files(iterFile('test.toml'), [tidy.check_toml], [], print_text=False)
|
errors = tidy.collect_errors_for_files(iterFile('Cargo.toml'), [tidy.check_toml], [], print_text=False)
|
||||||
self.assertEqual('found asterisk instead of minimum version number', errors.next()[2])
|
self.assertEqual('found asterisk instead of minimum version number', errors.next()[2])
|
||||||
self.assertEqual('.toml file should contain a valid license.', errors.next()[2])
|
self.assertEqual('.toml file should contain a valid license.', errors.next()[2])
|
||||||
self.assertNoMoreErrors(errors)
|
self.assertNoMoreErrors(errors)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue