This is an automated email from the ASF dual-hosted git repository.
guanmingchiu pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/mahout.git
The following commit(s) were added to refs/heads/main by this push:
new 6b8f3cfdc MAHOUT-618: Add license headers check hook (#619)
6b8f3cfdc is described below
commit 6b8f3cfdc9ffcf903e59462a7c4a2f54f02065d8
Author: Guan-Ming (Wesley) Chiu <[email protected]>
AuthorDate: Thu Nov 13 10:21:05 2025 +0800
MAHOUT-618: Add license headers check hook (#619)
* Add license headers check hook
* Fix lint error
---
.pre-commit-config.yaml | 15 ++++++++++++++-
examples/quantum_teleportation.py | 16 ++++++++++++++++
examples/simple_example.py | 16 ++++++++++++++++
qumat/__init__.py | 22 +++++++++++++++++++---
testing/utils/.license-header.txt | 15 +++++++++++++++
5 files changed, 80 insertions(+), 4 deletions(-)
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index f76ebdbbb..65f563860 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -1,7 +1,7 @@
repos:
# Check yaml, end of file, trailing whitespace
- repo: https://github.com/pre-commit/pre-commit-hooks
- rev: v4.5.0
+ rev: v6.0.0
hooks:
- id: check-yaml
name: check yaml
@@ -9,3 +9,16 @@ repos:
name: fix end of file
- id: trailing-whitespace
name: trim trailing whitespace
+
+ # Check Apache license headers
+ - repo: https://github.com/lucas-c/pre-commit-hooks
+ rev: v1.5.5
+ hooks:
+ - id: insert-license
+ name: check license headers
+ files: \.py$
+ args:
+ - --license-filepath
+ - testing/utils/.license-header.txt
+ - --comment-style
+ - "#"
diff --git a/examples/quantum_teleportation.py
b/examples/quantum_teleportation.py
index 653d182da..d87a038e4 100644
--- a/examples/quantum_teleportation.py
+++ b/examples/quantum_teleportation.py
@@ -1,3 +1,19 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
# Example of implementing Quantum Teleportation using QuMat
from qumat import QuMat
diff --git a/examples/simple_example.py b/examples/simple_example.py
index 8079d6312..77cb3dff0 100644
--- a/examples/simple_example.py
+++ b/examples/simple_example.py
@@ -1,3 +1,19 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
# Import the QuantumComputer class from your package
from qumat import QuMat
diff --git a/qumat/__init__.py b/qumat/__init__.py
index 039ff44ab..54b0dfc85 100644
--- a/qumat/__init__.py
+++ b/qumat/__init__.py
@@ -1,3 +1,19 @@
-from .qumat import QuMat
-
-__all__ = ["QuMat"]
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+from .qumat import QuMat
+
+__all__ = ["QuMat"]
diff --git a/testing/utils/.license-header.txt
b/testing/utils/.license-header.txt
new file mode 100644
index 000000000..f9f8d2460
--- /dev/null
+++ b/testing/utils/.license-header.txt
@@ -0,0 +1,15 @@
+
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements. See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.