Yiyiyimu commented on a change in pull request #3624:
URL: https://github.com/apache/apisix/pull/3624#discussion_r627017997



##########
File path: .pre-commit-config.yaml
##########
@@ -0,0 +1,193 @@
+#
+# 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.
+#
+---
+default_stages: [commit, push]
+default_language_version:
+  # force all unspecified Python hooks to run python3
+  python: python3
+minimum_pre_commit_version: "1.20.0"
+repos:
+  - repo: meta
+    hooks:
+      - id: identity
+      - id: check-hooks-apply
+  - repo: https://github.com/Lucas-C/pre-commit-hooks
+    rev: v1.1.10
+    hooks:
+      # - id: insert-license
+      #  name: Add license for all Golang files
+      #  exclude: ^\.github/.*$
+      #  files: \.go
+      #  args:
+      #    - --comment-style
+      #    - "/*|| */"
+      #    - --license-filepath
+      #    - license-templates/LICENSE.txt
+      #    - --fuzzy-match-generates-todo
+      # - id: insert-license
+      #  name: Add license for all Java files
+      #  exclude: ^\.github/.*$
+      #  files: \.java$
+      #  args:
+      #    - --comment-style
+      #    - "/*|| */"
+      #    - --license-filepath
+      #    - license-templates/LICENSE.txt
+      #    - --fuzzy-match-generates-todo
+      - id: insert-license

Review comment:
       I'm a bit confused about this place. If pre-commit finds a place that 
need to add a license, would it add with bot account of Github Action? If so, 
the action is prohibited by Apache Community since we do not allow bot to do 
commits.

##########
File path: .gitignore
##########
@@ -63,8 +63,9 @@ t/lib/dubbo-backend/dubbo-backend-provider/target/
 !.github/
 ci/openwhisk-utilities/
 !.gitmodules
-!.markdownlint.yml
-!.yamllint
+!.markdownlint.yaml
+!.pre-commit-config.yaml
+!.yamllint.yaml

Review comment:
       might be good to keep the extra newline

##########
File path: CONTRIBUTING.md
##########
@@ -51,9 +51,42 @@ Once we've discussed your changes and you've got your code 
ready, make sure that
 
 ## Contribution Guidelines for Documentation
 
+* pre-commit
+
+    A framework for managing and maintaining multi-language pre-commit hooks.
+    Pre-commit can be [installed](https://pre-commit.com/#installation) with 
`pip`, `curl`, `brew` or `conda`.

Review comment:
       I still believe it's better to add a universal script for contributors 
to easily use it, like using `curl` to do the installation.

##########
File path: codespell.txt
##########
@@ -0,0 +1,4 @@
+hel

Review comment:
       Sorry I failed to understand this. Is this a whitelist for misspell?

##########
File path: .pre-commit-config.yaml
##########
@@ -0,0 +1,193 @@
+#
+# 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.
+#
+---
+default_stages: [commit, push]
+default_language_version:
+  # force all unspecified Python hooks to run python3
+  python: python3
+minimum_pre_commit_version: "1.20.0"
+repos:
+  - repo: meta
+    hooks:
+      - id: identity
+      - id: check-hooks-apply
+  - repo: https://github.com/Lucas-C/pre-commit-hooks
+    rev: v1.1.10
+    hooks:
+      # - id: insert-license
+      #  name: Add license for all Golang files
+      #  exclude: ^\.github/.*$
+      #  files: \.go
+      #  args:
+      #    - --comment-style
+      #    - "/*|| */"
+      #    - --license-filepath
+      #    - license-templates/LICENSE.txt
+      #    - --fuzzy-match-generates-todo
+      # - id: insert-license
+      #  name: Add license for all Java files
+      #  exclude: ^\.github/.*$
+      #  files: \.java$
+      #  args:
+      #    - --comment-style
+      #    - "/*|| */"
+      #    - --license-filepath
+      #    - license-templates/LICENSE.txt
+      #    - --fuzzy-match-generates-todo
+      - id: insert-license
+        name: Add license for all Lua files
+        exclude: ^\.github/.*$
+        files: \.lua$|\.luacov$
+        args:
+          - --comment-style
+          - "|--|"
+          - --license-filepath
+          - license-templates/LICENSE.txt
+          - --fuzzy-match-generates-todo
+      # - id: insert-license
+      #  name: Add license for all Markdown files
+      #  files: \.md$
+      #  exclude: ^\.github/.*$
+      #  args:
+      #    - --comment-style
+      #    - "<!--|| -->"
+      #    - --license-filepath
+      #    - license-templates/LICENSE.txt
+      #    - --fuzzy-match-generates-todo
+      - id: insert-license
+        name: Add license for all Other files

Review comment:
       I can't get it what does this `Other` means here, since there are still 
quite a lot categories after this one

##########
File path: CONTRIBUTING.md
##########
@@ -51,9 +51,42 @@ Once we've discussed your changes and you've got your code 
ready, make sure that
 
 ## Contribution Guidelines for Documentation
 
+* pre-commit
+
+    A framework for managing and maintaining multi-language pre-commit hooks.
+    Pre-commit can be [installed](https://pre-commit.com/#installation) with 
`pip`, `curl`, `brew` or `conda`.
+    You need to first install pre-commit and then install the pre-commit hooks 
with `pre-commit install`.
+    Now pre-commit will run automatically on git commit!

Review comment:
       Suggest removing this line since it's not related to contributing guide




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to