Skip to content

Commit

Permalink
fix license check (apache#243)
Browse files Browse the repository at this point in the history
  • Loading branch information
chunshao90 authored Sep 13, 2022
1 parent 0500362 commit df2bfed
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 4 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ jobs:
rustup component add rustfmt
- name: Run
run: |
make check-license
make clippy
make fmt
Expand Down
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ test-ut:
fmt:
cd $(DIR); cargo fmt -- --check

check-license:
cd $(DIR); sh scripts/check-license.sh

clippy:
cd $(DIR); cargo clippy --all-targets --all-features --workspace -- -D warnings

Expand Down
2 changes: 2 additions & 0 deletions analytic_engine/src/role_table/leader.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Copyright 2022 CeresDB Project Authors. Licensed under Apache-2.0.

use std::{
collections::HashMap,
sync::{
Expand Down
2 changes: 2 additions & 0 deletions analytic_engine/src/role_table/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Copyright 2022 CeresDB Project Authors. Licensed under Apache-2.0.

use std::{collections::HashMap, sync::Arc};

use async_trait::async_trait;
Expand Down
2 changes: 2 additions & 0 deletions analytic_engine/src/sst/parquet/index.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Copyright 2022 CeresDB Project Authors. Licensed under Apache-2.0.

use std::collections::HashMap;
use std::convert::TryFrom;
use std::process::id;
Expand Down
1 change: 0 additions & 1 deletion etc/license.template

This file was deleted.

4 changes: 1 addition & 3 deletions rustfmt.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,4 @@ format_code_in_doc_comments = true
# Reorder impl items. type and const are put first, then macros and methods.
reorder_impl_items = true
# Discard existing import groups, and create three groups for std, external crates, crates
group_imports = "StdExternalCrate"

license_template_path = "etc/license.template"
group_imports = "StdExternalCrate"
14 changes: 14 additions & 0 deletions scripts/check-license.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/env bash
# Check all source files have a license header.
set -eu

for i in $(git ls-files --exclude-standard | grep "\.rs"); do
# first line -> match -> print line -> quit
matches=$(sed -n "1{/Copyright [0-9]\{4\} CeresDB Project Authors. Licensed under Apache-2.0./p;};q;" $i)
if [ -z "${matches}" ]; then
echo "License header is missing from $i."
exit 1
fi
done

echo "License check passed."
2 changes: 2 additions & 0 deletions src/adapter.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Copyright 2022 CeresDB Project Authors. Licensed under Apache-2.0.

use async_trait::async_trait;
use catalog::{
manager::ManagerRef as CatalogManagerRef,
Expand Down

0 comments on commit df2bfed

Please sign in to comment.