Skip to content

Commit

Permalink
fix(mit): newline between MIT License and Copyright (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
adamperkowski authored Sep 28, 2024
1 parent 6fe7d18 commit 65d117a
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion resources/licenses.json
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
},
"copyright": "Copyright (c) <year> <copyright holders>",
"optional": [
"MIT License "
"MIT License"
]
},
{
Expand Down
Binary file modified resources/licenses/MIT.txt.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion src/codegen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ pub static LICENSES_INFO: OrderedMap<&'static str, License> = ::phf::OrderedMap
("ISC", License { id: "ISC", replace: Some(LicenseReplace { year: Some("1995-2003"), name: Some("by Internet Software Consortium") }), copyright: Some("Copyright (c) 1995-2003 by Internet Software Consortium"), optional: Some(&["ISC License Copyright (c) 2004-2010 by Internet Systems Consortium, Inc. (\"ISC\")"]) }),
("LGPL-2.1", License { id: "LGPL-2.1", replace: None, copyright: None, optional: Some(&["GNU LESSER GENERAL PUBLIC LICENSE\n\nVersion 2.1, February 1999", "END OF TERMS AND CONDITIONS\n\nHow to Apply These Terms to Your New Libraries\n\nIf you develop a new library, and you want it to be of the greatest possible\nuse to the public, we recommend making it free software that everyone can\nredistribute and change. You can do so by permitting redistribution under\nthese terms (or, alternatively, under the terms of the ordinary General Public\nLicense).\n\nTo apply these terms, attach the following notices to the library. It is safest\nto attach them to the start of each source file to most effectively convey\nthe exclusion of warranty; and each file should have at least the \"copyright\"\nline and a pointer to where the full notice is found.\n\n< one line to give the library\'s name and an idea of what it does. >\n\nCopyright (C) < year > < name of author >\n\nThis library is free software; you can redistribute it and/or modify it under\nthe terms of the GNU Lesser General Public License as published by the Free\nSoftware Foundation; either version 2.1 of the License, or (at your option)\nany later version.\n\nThis library is distributed in the hope that it will be useful, but WITHOUT\nANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\nFOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more\ndetails.\n\nYou should have received a copy of the GNU Lesser General Public License along\nwith this library; if not, write to the Free Software Foundation, Inc., 51\nFranklin Street, Fifth Floor, Boston, MA 02110-1301 USA Also add information\non how to contact you by electronic and paper mail.\n\nYou should also get your employer (if you work as a programmer) or your school,\nif any, to sign a \"copyright disclaimer\" for the library, if necessary. Here\nis a sample; alter the names:\n\nYoyodyne, Inc., hereby disclaims all copyright interest in\n\nthe library `Frob\' (a library for tweaking knobs) written\n\nby James Random Hacker.\n\n< signature of Ty Coon > , 1 April 1990\n\nTy Coon, President of Vice\n\nThat\'s all there is to it!"]) }),
("LGPL-3.0", License { id: "LGPL-3.0", replace: None, copyright: None, optional: Some(&["GNU LESSER GENERAL PUBLIC LICENSE\n\nVersion 3, 29 June 2007"]) }),
("MIT", License { id: "MIT", replace: Some(LicenseReplace { year: Some("<year>"), name: Some("<copyright holders>") }), copyright: Some("Copyright (c) <year> <copyright holders>"), optional: Some(&["MIT License "]) }),
("MIT", License { id: "MIT", replace: Some(LicenseReplace { year: Some("<year>"), name: Some("<copyright holders>") }), copyright: Some("Copyright (c) <year> <copyright holders>"), optional: Some(&["MIT License"]) }),
("MPL-2.0", License { id: "MPL-2.0", replace: None, copyright: None, optional: Some(&["Mozilla Public License Version 2.0", " Exhibit A - Source Code Form\nLicense Notice\n\nThis Source Code Form is subject to the terms of the Mozilla Public License,\nv. 2.0. If a copy of the MPL was not distributed with this file, You can obtain\none at http://mozilla.org/MPL/2.0/.\n\nIf it is not possible or desirable to put the notice in a particular file,\nthen You may include the notice in a location (such as a LICENSE file in a\nrelevant directory) where a recipient would be likely to look for such a notice.\n\nYou may add additional accurate notices of copyright ownership.\n\nExhibit B - \"Incompatible With Secondary Licenses\" Notice\n\nThis Source Code Form is \"Incompatible With Secondary Licenses\", as defined\nby the Mozilla Public License, v. 2.0."]) }),
("Unlicense", License { id: "Unlicense", replace: None, copyright: None, optional: Some(&[" For more information,\nplease refer to <https://unlicense.org/>"]) }),
("Zlib", License { id: "Zlib", replace: Some(LicenseReplace { year: Some("<year>"), name: Some("<copyright holders>") }), copyright: Some("Copyright (c) <year> <copyright holders>"), optional: Some(&["zlib License "]) }),
Expand Down
6 changes: 3 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -332,12 +332,12 @@ mod tests {
fn works() {
let mut encoder = GzEncoder::new(Vec::new(), Compression::default());
encoder
.write_all(b"MIT License Copyright (c) <year> <copyright holders>")
.write_all(b"MIT License\n\nCopyright (c) <year> <copyright holders>")
.unwrap();
let encoded = encoder.finish().unwrap();

let result = gz_decode_bytes(&encoded).unwrap();
let expected = "MIT License Copyright (c) <year> <copyright holders>".to_owned();
let expected = "MIT License\n\nCopyright (c) <year> <copyright holders>".to_owned();

assert_eq!(result, expected);
}
Expand Down Expand Up @@ -417,7 +417,7 @@ mod tests {
#[test]
fn works() {
let result = parse_license("MIT").unwrap();
assert!(result.starts_with("MIT License Copyright (c) <year> <copyright holders>"));
assert!(result.starts_with("MIT License\n\nCopyright (c) <year> <copyright holders>"));
}
}

Expand Down
8 changes: 4 additions & 4 deletions tests/integration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ fn license() {
.args(&["MIT"])
.assert()
.success()
.stdout(predicates::str::starts_with("MIT License \n"))
.stdout(predicates::str::starts_with("MIT License\n"))
.stderr(predicates::str::is_empty());
}

Expand All @@ -69,7 +69,7 @@ fn license_and_name() {
.assert()
.success()
.stdout(predicates::str::starts_with(
"MIT License Copyright (c) 2024 Adam Perkowski\n",
"MIT License\n\nCopyright (c) 2024 Adam Perkowski\n",
))
.stderr(predicates::str::is_empty());
}
Expand Down Expand Up @@ -117,7 +117,7 @@ fn license_keep_placeholder() {
.assert()
.success()
.stdout(predicates::str::starts_with(
"MIT License Copyright (c) <year> <copyright holders>\n",
"MIT License\n\nCopyright (c) <year> <copyright holders>\n",
))
.stderr(predicates::str::is_empty());

Expand All @@ -127,7 +127,7 @@ fn license_keep_placeholder() {
.assert()
.success()
.stdout(predicates::str::starts_with(
"MIT License Copyright (c) <year> <copyright holders>\n",
"MIT License\n\nCopyright (c) <year> <copyright holders>\n",
))
.stderr(predicates::str::is_empty());
}
Expand Down

0 comments on commit 65d117a

Please sign in to comment.