Skip to content

Commit

Permalink
Include files in the root directory for license check
Browse files Browse the repository at this point in the history
  • Loading branch information
dtaniwaki committed Apr 13, 2019
1 parent 5ace80e commit f9a8212
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
7 changes: 6 additions & 1 deletion scripts/license/add.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,15 @@

PROJECT_ROOT = subprocess.check_output(
"git rev-parse --show-toplevel".split()).strip().decode("utf-8")
target_dirs = [os.path.join(PROJECT_ROOT, d) for d in os.listdir(PROJECT_ROOT) if d != "vendor"]
target_dirs = [os.path.join(PROJECT_ROOT, d) for d in os.listdir(PROJECT_ROOT)
if d != "vendor" and os.path.isdir(os.path.join(PROJECT_ROOT, d))]


def main(verbose=False):
add(Path(PROJECT_ROOT).glob("*.go"), license_header("//"), verbose)
add(Path(PROJECT_ROOT).glob("*.py"), license_header("#"), verbose)
add(Path(PROJECT_ROOT).glob("*.sh"), license_header("#"), verbose)

for d in target_dirs:
add(Path(d).glob("**/*_k8s.go"), license_header("//", modification=True), verbose)
add([p for p in Path(d).glob("**/*.go")
Expand Down
7 changes: 6 additions & 1 deletion scripts/license/check.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,17 @@

PROJECT_ROOT = subprocess.check_output(
"git rev-parse --show-toplevel".split()).strip().decode("utf-8")
target_dirs = [os.path.join(PROJECT_ROOT, d) for d in os.listdir(PROJECT_ROOT) if d != "vendor"]
target_dirs = [os.path.join(PROJECT_ROOT, d) for d in os.listdir(PROJECT_ROOT)
if d != "vendor" and os.path.isdir(os.path.join(PROJECT_ROOT, d))]


def main(verbose=False):
ok = True

ok &= check(Path(PROJECT_ROOT).glob("*.go"), license_header("//"), verbose)
ok &= check(Path(PROJECT_ROOT).glob("*.py"), license_header("#"), verbose)
ok &= check(Path(PROJECT_ROOT).glob("*.sh"), license_header("#"), verbose)

for d in target_dirs:
ok &= check(Path(d).glob("**/*_k8s.go"), license_header("//", modification=True), verbose)
ok &= check([p for p in Path(d).glob("**/*.go")
Expand Down

0 comments on commit f9a8212

Please sign in to comment.