mirror of
https://github.com/servo/servo.git
synced 2025-07-22 23:03:42 +01:00
Improve tidy's license validation logic
fixes https://github.com/servo/servo/issues/10716 I took the lazy way out and hardcoded the size of block we examine for licenses. fixes https://github.com/servo/servo/issues/10719 Includes tests for new functionality.
This commit is contained in:
parent
1f4dd8765f
commit
48ace17b54
7 changed files with 73 additions and 102 deletions
|
@ -7,97 +7,29 @@
|
|||
# option. This file may not be copied, modified, or distributed
|
||||
# except according to those terms.
|
||||
|
||||
# when wrapped to 80 chars, the longest license is 10 lines.
|
||||
# TODO actually grab whatever commented block is before the second blank line
|
||||
# of the file instead of hard-coding this.
|
||||
MAX_LICENSE_LINESPAN = 12
|
||||
|
||||
# These licenses are valid for use in Servo
|
||||
licenses = [
|
||||
MPL = """\
|
||||
This Source Code Form is subject to the terms of the Mozilla Public \
|
||||
License, v. 2.0. If a copy of the MPL was not distributed with this \
|
||||
file, You can obtain one at http://mozilla.org/MPL/2.0/.\
|
||||
"""
|
||||
|
||||
"""\
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
""",
|
||||
APACHE = """\
|
||||
Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or \
|
||||
http://www.apache.org/licenses/LICENSE-2.0> or the MIT license \
|
||||
<LICENSE-MIT or http://opensource.org/licenses/MIT>, at your \
|
||||
option. This file may not be copied, modified, or distributed \
|
||||
except according to those terms.\
|
||||
"""
|
||||
|
||||
"""\
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
""",
|
||||
|
||||
"""\
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
""",
|
||||
|
||||
"""\
|
||||
#!/usr/bin/env python
|
||||
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
""",
|
||||
|
||||
"""\
|
||||
#!/usr/bin/env python3
|
||||
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
""",
|
||||
|
||||
"""\
|
||||
// This Source Code Form is subject to the terms of the Mozilla Public
|
||||
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
""",
|
||||
|
||||
"""\
|
||||
// Copyright 2013 The Servo Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
""",
|
||||
|
||||
"""\
|
||||
# Copyright 2013 The Servo Project Developers. See the COPYRIGHT
|
||||
# file at the top-level directory of this distribution.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
# option. This file may not be copied, modified, or distributed
|
||||
# except according to those terms.
|
||||
""",
|
||||
|
||||
"""\
|
||||
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
""",
|
||||
|
||||
"""\
|
||||
// Copyright 2012-2014 The Rust Project Developers.
|
||||
// See http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
""",
|
||||
] # noqa: Indicate to flake8 that we do not want to check indentation here
|
||||
COPYRIGHT = [
|
||||
"See the COPYRIGHT file at the top-level directory of this distribution",
|
||||
"See http://rust-lang.org/COPYRIGHT",
|
||||
]
|
||||
|
||||
# The valid licenses, in the form we'd expect to see them in a Cargo.toml file.
|
||||
licenses_toml = [
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue