This is an automated email from the ASF dual-hosted git repository.
albumenj pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/dubbo-python.git
The following commit(s) were added to refs/heads/main by this push:
new 4fd4b33 Chore: Add python lint and license check (#32)
4fd4b33 is described below
commit 4fd4b3303d4a4166bdb0ce0b05f1ac58fa614c77
Author: Zaki <[email protected]>
AuthorDate: Mon May 13 10:47:12 2024 +0800
Chore: Add python lint and license check (#32)
* chore: add flake8 configuration and PR template
* chore: add Python Lint and License Check actions
---
.flake8 | 24 ++++++++
.github/PULL_REQUEST_TEMPLATE.md | 20 +++++++
.../workflows/python-lint-and-license-check.yml | 31 ++++++++++
.licenserc.yaml | 68 ++++++++++++++++++++++
4 files changed, 143 insertions(+)
diff --git a/.flake8 b/.flake8
new file mode 100644
index 0000000..3ab0e58
--- /dev/null
+++ b/.flake8
@@ -0,0 +1,24 @@
+[flake8]
+
+ignore =
+ # whitespace before ',', ';', or ':'
+ E203
+ # too many leading '#' for block comment
+ E266
+ # line too long (82 > 79 characters)
+ E501
+ # line break before binary operator
+ W503
+ # from module import * used
+ F403
+
+# Maximum line length
+max-line-length = 120
+
+exclude =
+ .git,
+ __pycache__,
+ docs
+
+per-file-ignores =
+ __init__.py:F401
\ No newline at end of file
diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md
new file mode 100644
index 0000000..638e73e
--- /dev/null
+++ b/.github/PULL_REQUEST_TEMPLATE.md
@@ -0,0 +1,20 @@
+## What is the purpose of the change
+
+
+
+## Brief changelog
+
+
+## Verifying this change
+
+
+<!-- Follow this checklist to help us incorporate your contribution quickly
and easily: -->
+
+## Checklist
+- [x] Make sure there is a
[GitHub_issue](https://github.com/apache/dubbo/issues) field for the change
(usually before you start working on it). Trivial changes like typos do not
require a GitHub issue. Your pull request should address just this issue,
without pulling in other changes - one PR resolves one issue.
+- [ ] Each commit in the pull request should have a meaningful subject line
and body.
+- [ ] Write a pull request description that is detailed enough to understand
what the pull request does, how, and why.
+- [ ] Write necessary unit-test to verify your logic correction, more mock a
little better when cross module dependency exist.
+- [ ] Add some description to
[dubbo-website](https://github.com/apache/dubbo-website) project if you are
requesting to add a feature.
+- [ ] GitHub Actions works fine on your own branch.
+- [ ] If this contribution is large, please follow the [Software Donation
Guide](https://github.com/apache/dubbo/wiki/Software-donation-guide).
diff --git a/.github/workflows/python-lint-and-license-check.yml
b/.github/workflows/python-lint-and-license-check.yml
new file mode 100644
index 0000000..b552112
--- /dev/null
+++ b/.github/workflows/python-lint-and-license-check.yml
@@ -0,0 +1,31 @@
+name: Python Lint and License Check
+
+on: [push, pull_request]
+
+jobs:
+ python-lint:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v4
+
+ - name: Set up Python 3.10
+ uses: actions/setup-python@v5
+ with:
+ python-version: '3.10'
+
+ - name: Lint with flake8
+ run: |
+ # fail if there are any flake8 errors
+ pip install flake8
+ flake8 .
+
+ check-license:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v4
+
+ - name: Check License Header
+ uses: apache/skywalking-eyes/header@main
+ with:
+ log: info
+ config: .licenserc.yaml
\ No newline at end of file
diff --git a/.licenserc.yaml b/.licenserc.yaml
new file mode 100644
index 0000000..35f2542
--- /dev/null
+++ b/.licenserc.yaml
@@ -0,0 +1,68 @@
+#
+# 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.
+#
+
+header: # `header` section is configurations for source codes license header.
+ license:
+ spdx-id: Apache-2.0 # the spdx id of the license, it's convenient when
your license is standard SPDX license.
+ copyright-owner: Apache Software Foundation # the copyright owner to
replace the [owner] in the `spdx-id` template.
+ content: | # `license` will be used as the content when `fix` command
needs to insert a license header.
+ 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.
+ # `pattern` is optional regexp if all the file headers are the same as
`license` or the license of `spdx-id` and `copyright-owner`.
+ pattern: |
+ Licensed to the Apache Software Foundation under one or more contributor
+ license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright
+ ownership. The Apache Software Foundation 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.
+ paths: # `paths` are the path list that will be checked (and fixed) by
license-eye, default is ['**'].
+ - '**'
+
+ paths-ignore: # `paths-ignore` are the path list that will be ignored by
license-eye.
+ - '**/*.md'
+ - 'LICENSE'
+ - 'NOTICE'
+ - '.asf.yaml'
+ - '.gitignore'
+ - '.github'
+ - '.flake8'
+ comment: on-failure # on what condition license-eye will comment on the pull
request, `on-failure`, `always`, `never`.
+
+ # license-location-threshold specifies the index threshold where the license
header can be located,
+ # after all, a "header" cannot be TOO far from the file start.
+ license-location-threshold: 80