From 8ff2080993ab3c442c173aaee3042203c058bece Mon Sep 17 00:00:00 2001 From: Firstsawyou <52862365+Firstsawyou@users.noreply.github.com> Date: Wed, 9 Sep 2020 16:18:34 +0800 Subject: [PATCH] add tools to check ASF headers in code files. (#454) --- .actions/ASF-Release.cfg | 105 ++++++++++++++++++ .actions/ASFLicenseHeaderMarkdown.txt | 18 +++ .actions/openwhisk-utilities | 1 + .github/workflows/api_ci.yml | 4 + CONTRIBUTING.md | 19 ++++ Makefile | 25 +++++ USER_GUIDE.md | 19 ++++ api/route/route_group.go | 16 +++ api/route/route_group_test.go | 16 +++ api/service/upstream_test.go | 16 +++ compose/apisix_conf/config.yaml | 1 - .../provisioning/dashboards/all.yaml | 2 +- .../provisioning/datasources/all.yaml | 2 +- src/pages/Consumer/components/Step1.tsx | 2 +- src/pages/Route/components/Step3/index.tsx | 16 +++ src/pages/User/index.ts | 17 +++ src/pages/User/locales/en-US.ts | 17 +++ src/pages/User/locales/zh-CN.ts | 17 +++ src/pages/User/typing.d.ts | 17 +++ 19 files changed, 326 insertions(+), 4 deletions(-) create mode 100644 .actions/ASF-Release.cfg create mode 100644 .actions/ASFLicenseHeaderMarkdown.txt create mode 160000 .actions/openwhisk-utilities create mode 100644 Makefile diff --git a/.actions/ASF-Release.cfg b/.actions/ASF-Release.cfg new file mode 100644 index 0000000000..bb6e8d7e94 --- /dev/null +++ b/.actions/ASF-Release.cfg @@ -0,0 +1,105 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more contributor +# license agreements; and to You under the Apache License, Version 2.0. + +# scanCode.py configuration file + +# List of filenames containing the text of valid license (headers) +# These files SHOULD be in the same directory path where scanCode.py +# resides. +[Licenses] +ASFLicenseHeader.txt +ASFLicenseHeaderBash.txt +ASFLicenseHeaderMarkdown.txt +ASFLicenseHeaderLua.txt + +# Filters (path/filename) with wildcards and associated scan checks +# that are to be run against them. The checks are actual valid +# function names found in scanCode.py. +[Includes] +*=is_not_symlink, regex_check +*.conf=has_block_license, eol_at_eof, regex_check +*.go=has_block_license, eol_at_eof, regex_check +*.gradle=has_block_license, eol_at_eof, regex_check +*.groovy=has_block_license, eol_at_eof, regex_check +*.html=has_block_license, regex_check +*.java=no_tabs, has_block_license, eol_at_eof, regex_check +*.js=has_block_license, regex_check +*.md=no_tabs, has_block_license, eol_at_eof, regex_check +*.properties=no_tabs, has_block_license, eol_at_eof, regex_check +*.py=no_tabs, has_block_license, eol_at_eof, regex_check +*.scala=has_block_license, no_tabs, eol_at_eof, regex_check +*.sh=has_block_license, eol_at_eof, regex_check +*.swift=no_tabs, has_block_license, eol_at_eof, regex_check +*.yaml=has_block_license, eol_at_eof, regex_check +*.yml=has_block_license, eol_at_eof, regex_check +*.css=has_block_license, regex_check +*.tsx=has_block_license, regex_check +*.ts=has_block_license, regex_check +*.less=has_block_license, regex_check +*Dockerfile*=has_block_license + +# Sanity check files not required to have ASF headers because either they +# are excluded or are not packaged with the Apache source release. +*.cfg=regex_check +*.ini=regex_check +*.j2=regex_check +*.json=regex_check +*.txt=regex_check +*.xml=regex_check + +# List of paths (inclusive of subdirectories) to exclude from code scanning +[Excludes] + +# General tooling & binary file exclusions +.bin +.dockerignore +.eslintrc.* +.git +.gitattributes +.github +.gitignore +.gradle +.idea +.jshintrc +.pydevproject +.rat-excludes +.tox + +# Skip files containing MIT License +scripts/verifyCommit.js +src/components/HeaderDropdown/index.less +src/components/HeaderDropdown/index.tsx +src/components/NoticeIcon +src/components/PageLoading/index.tsx +src/components/RightContent +src/e2e/__mocks__/antd-pro-merge-less.js +src/e2e/baseLayout.e2e.js +src/pages/404.tsx +src/service-worker.js +compose/dashboard_conf/nginx.conf +docker/nginx.conf + +# The README.md file cannot be found, but it will be detected +dag-to-lua-1.1/README.md + +api/build.sh + + +# Exclude Apache standard legal files +CREDITS.txt +DISCLAIMER.txt +LICENSE*.txt +NOTICE.txt + +conf +.actions/openwhisk-utilities + +[Options] +# Not all code files allow licenses to appear starting at the first character +# of the file. This option tells the scan to allow licenses to appear starting +# within the first 'x' characters of each code file (as provided by this option's +# value). +LICENSE_SLACK_LENGTH=500 + +# List of regular expressions for forbidden strings, e.g. \w+@company.com +[Regex] diff --git a/.actions/ASFLicenseHeaderMarkdown.txt b/.actions/ASFLicenseHeaderMarkdown.txt new file mode 100644 index 0000000000..c4748142bc --- /dev/null +++ b/.actions/ASFLicenseHeaderMarkdown.txt @@ -0,0 +1,18 @@ + diff --git a/.actions/openwhisk-utilities b/.actions/openwhisk-utilities new file mode 160000 index 0000000000..8636f9ad3b --- /dev/null +++ b/.actions/openwhisk-utilities @@ -0,0 +1 @@ +Subproject commit 8636f9ad3bb7c4ed216f6b9291b0a6bf9a12cb76 diff --git a/.github/workflows/api_ci.yml b/.github/workflows/api_ci.yml index 32a365bf36..ac0829ceab 100644 --- a/.github/workflows/api_ci.yml +++ b/.github/workflows/api_ci.yml @@ -74,3 +74,7 @@ jobs: working-directory: ./api run: | go test ./... + + - name: run Makefile + run: | + make license-check diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index b84ca1586a..a322373715 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,3 +1,22 @@ + + # Contributing to Apache APISIX Dashboard Firstly, thanks for your interest in contributing! I hope that this will be a diff --git a/Makefile b/Makefile new file mode 100644 index 0000000000..d366e44fbb --- /dev/null +++ b/Makefile @@ -0,0 +1,25 @@ +# +# 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. +# + +### license-check: Check apisix-dashboard source code for Apache License +.PHONY: license-check +license-check: +ifeq ("$(wildcard .actions/openwhisk-utilities/scancode/scanCode.py)", "") + git clone https://github.com/apache/openwhisk-utilities.git .actions/openwhisk-utilities + cp .actions/ASF* .actions/openwhisk-utilities/scancode/ +endif + .actions/openwhisk-utilities/scancode/scanCode.py --config .actions/ASF-Release.cfg ./ \ No newline at end of file diff --git a/USER_GUIDE.md b/USER_GUIDE.md index 659850fdac..ed2aaa3b44 100644 --- a/USER_GUIDE.md +++ b/USER_GUIDE.md @@ -1,3 +1,22 @@ + + # User Guide Please visit [http://139.217.190.60/](http://139.217.190.60/) in browser to have a full-preview of the Apache APISIX Dashboard. diff --git a/api/route/route_group.go b/api/route/route_group.go index bfe138a43b..7be8538e3c 100644 --- a/api/route/route_group.go +++ b/api/route/route_group.go @@ -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. + */ package route import ( diff --git a/api/route/route_group_test.go b/api/route/route_group_test.go index 0500c8f883..ce939db4a7 100644 --- a/api/route/route_group_test.go +++ b/api/route/route_group_test.go @@ -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. + */ package route import ( diff --git a/api/service/upstream_test.go b/api/service/upstream_test.go index f216de650b..a4d671b374 100644 --- a/api/service/upstream_test.go +++ b/api/service/upstream_test.go @@ -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. + */ package service import ( diff --git a/compose/apisix_conf/config.yaml b/compose/apisix_conf/config.yaml index 3fb47af261..7437eb0d00 100644 --- a/compose/apisix_conf/config.yaml +++ b/compose/apisix_conf/config.yaml @@ -37,4 +37,3 @@ etcd: - "http://192.17.5.10:2379" # multiple etcd address prefix: "/apisix" # apisix configurations prefix timeout: 30 # 30 seconds - \ No newline at end of file diff --git a/compose/grafana_conf/provisioning/dashboards/all.yaml b/compose/grafana_conf/provisioning/dashboards/all.yaml index 26a9599efe..6ca6695601 100644 --- a/compose/grafana_conf/provisioning/dashboards/all.yaml +++ b/compose/grafana_conf/provisioning/dashboards/all.yaml @@ -24,4 +24,4 @@ providers: disableDeletion: false editable: false options: - path: /var/lib/grafana/dashboards \ No newline at end of file + path: /var/lib/grafana/dashboards diff --git a/compose/grafana_conf/provisioning/datasources/all.yaml b/compose/grafana_conf/provisioning/datasources/all.yaml index 3812d4f7b1..681bd7097a 100644 --- a/compose/grafana_conf/provisioning/datasources/all.yaml +++ b/compose/grafana_conf/provisioning/datasources/all.yaml @@ -22,4 +22,4 @@ datasources: org_id: 1 type: 'prometheus' url: 'http://prometheus:9090' - version: 1 \ No newline at end of file + version: 1 diff --git a/src/pages/Consumer/components/Step1.tsx b/src/pages/Consumer/components/Step1.tsx index 7b92e1f4b7..f4afcdf291 100644 --- a/src/pages/Consumer/components/Step1.tsx +++ b/src/pages/Consumer/components/Step1.tsx @@ -61,4 +61,4 @@ const Step1: React.FC = ({ form, disabled }) => { ); }; -export default Step1; \ No newline at end of file +export default Step1; diff --git a/src/pages/Route/components/Step3/index.tsx b/src/pages/Route/components/Step3/index.tsx index 25a37dc413..0b872e9696 100644 --- a/src/pages/Route/components/Step3/index.tsx +++ b/src/pages/Route/components/Step3/index.tsx @@ -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 React, { useState } from 'react'; import { Radio, Tooltip } from 'antd'; import { QuestionCircleOutlined } from '@ant-design/icons'; diff --git a/src/pages/User/index.ts b/src/pages/User/index.ts index 3ee57c23fe..0cb3be4483 100644 --- a/src/pages/User/index.ts +++ b/src/pages/User/index.ts @@ -1,2 +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. + */ + export { default as UserZhCN } from './locales/zh-CN'; export { default as UserEnUS } from './locales/en-US'; diff --git a/src/pages/User/locales/en-US.ts b/src/pages/User/locales/en-US.ts index bfcadc0957..423e792ecf 100644 --- a/src/pages/User/locales/en-US.ts +++ b/src/pages/User/locales/en-US.ts @@ -1,3 +1,20 @@ +/* + * 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. + */ + export default { 'component.user.login': 'Login', 'component.user.loginMethodPassword': 'Username & Password', diff --git a/src/pages/User/locales/zh-CN.ts b/src/pages/User/locales/zh-CN.ts index d48e5bb623..c2a28b66a3 100644 --- a/src/pages/User/locales/zh-CN.ts +++ b/src/pages/User/locales/zh-CN.ts @@ -1,3 +1,20 @@ +/* + * 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. + */ + export default { 'component.user.login': '登录', 'component.user.loginMethodPassword': '账号密码登录', diff --git a/src/pages/User/typing.d.ts b/src/pages/User/typing.d.ts index 3f7d0633d7..fde4f9a989 100644 --- a/src/pages/User/typing.d.ts +++ b/src/pages/User/typing.d.ts @@ -1,3 +1,20 @@ +/* + * 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 React from 'react'; declare namespace UserModule {