Skip to content

Commit cfd4acf

Browse files
committed
make that work
1 parent b314ba9 commit cfd4acf

File tree

7 files changed

+31
-13
lines changed

7 files changed

+31
-13
lines changed

Diff for: .github/scripts/add_unsafe_reviewers/add-unsafe-reviewers.py

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# Copyright (c) Microsoft Corporation.
2+
# Licensed under the MIT License.
3+
14
import click
25
from git import Repo
36
from github import Github

Diff for: .github/scripts/refresh_mirror/refresh-mirror.py

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# Copyright (c) Microsoft Corporation.
2+
# Licensed under the MIT License.
3+
14
import click
25
import time
36
import sys

Diff for: openhcl/gen_init_ramfs.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#!/usr/bin/python3
2-
32
# Copyright (c) Microsoft Corporation.
43
# Licensed under the MIT License.
54

Diff for: openhcl/update-rootfs.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#!/usr/bin/python3
2-
32
# Copyright (c) Microsoft Corporation.
43
# Licensed under the MIT License.
54

Diff for: support/clap_dyn_complete/src/templates/complete.ps1

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# Copyright (c) Microsoft Corporation.
2+
# Licensed under the MIT License.
3+
14
Register-ArgumentCompleter -Native -CommandName '__COMMAND_NAME__' -ScriptBlock {
25
param($wordToComplete, $commandAst, $cursorPosition)
36

Diff for: vmm_tests/vmm_tests/test_data/tpm.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Copyright (c) Microsoft Corporation.
22
# Licensed under the MIT License.
3-
#
3+
44
# The test script that reads AK CERT from TPM and validate its content
55

66
# TPM NV READ command for Index 0x01c101d0 (AK CERT) that takes size (u32) and offset (u32) arguments through appending

Diff for: xtask/src/tasks/fmt/house_rules/copyright.rs

+21-10
Original file line numberDiff line numberDiff line change
@@ -17,24 +17,34 @@ pub fn check_copyright(path: &Path, fix: bool) -> anyhow::Result<()> {
1717
.and_then(|e| e.to_str())
1818
.unwrap_or_default();
1919

20-
if !matches!(ext, "rs" | "c" | "proto" | "toml" | "ts" | "js" | "py" | "ps1" | "config") {
20+
if !matches!(
21+
ext,
22+
"rs" | "c" | "proto" | "toml" | "ts" | "js" | "py" | "ps1" | "config"
23+
) {
2124
return Ok(());
2225
}
2326

2427
let f = BufReader::new(File::open(path)?);
2528
let mut lines = f.lines();
26-
let first_line = lines.next().unwrap_or(Ok(String::new()))?;
27-
let second_line = lines.next().unwrap_or(Ok(String::new()))?;
28-
let third_line = lines.next().unwrap_or(Ok(String::new()))?;
29+
let first_content_line = {
30+
let line = lines.next().unwrap_or(Ok(String::new()))?;
31+
if line.starts_with("#!") {
32+
lines.next().unwrap_or(Ok(String::new()))?
33+
} else {
34+
line
35+
}
36+
};
37+
let second_content_line = lines.next().unwrap_or(Ok(String::new()))?;
38+
let third_content_line = lines.next().unwrap_or(Ok(String::new()))?;
2939

3040
// Preserve any files which are copyright, but not by Microsoft.
31-
if first_line.contains("Copyright") && !first_line.contains("Microsoft") {
41+
if first_content_line.contains("Copyright") && !first_content_line.contains("Microsoft") {
3242
return Ok(());
3343
}
3444

35-
let mut missing_banner =
36-
!first_line.contains(HEADER_MIT_FIRST) || !second_line.contains(HEADER_MIT_SECOND);
37-
let mut missing_blank_line = !third_line.is_empty();
45+
let mut missing_banner = !first_content_line.contains(HEADER_MIT_FIRST)
46+
|| !second_content_line.contains(HEADER_MIT_SECOND);
47+
let mut missing_blank_line = !third_content_line.is_empty();
3848

3949
// TEMP: until we have more robust infrastructure for distinct
4050
// microsoft-internal checks, include this "escape hatch" for preserving
@@ -44,8 +54,9 @@ pub fn check_copyright(path: &Path, fix: bool) -> anyhow::Result<()> {
4454
let is_msft_internal = std::env::var("XTASK_FMT_COPYRIGHT_ALLOW_MISSING_MIT").is_ok();
4555
if is_msft_internal {
4656
// support both new and existing copyright banner styles
47-
missing_banner = !(first_line.contains("Copyright") && first_line.contains("Microsoft"));
48-
missing_blank_line = !second_line.is_empty();
57+
missing_banner =
58+
!(first_content_line.contains("Copyright") && first_content_line.contains("Microsoft"));
59+
missing_blank_line = !second_content_line.is_empty();
4960
}
5061

5162
if fix {

0 commit comments

Comments
 (0)