Skip to content

Commit

Permalink
[ISSUE apache#438] Enable Github Actions for Checkstyle (apache#439)
Browse files Browse the repository at this point in the history
* enable github actions for checkstyle

* try to fix ci

* ...

* ...

* ...

* Enable Github Actions for Checkstyle

* accelerate

* -filter-mode=nofilter -fail-on-error

* remove -name
  • Loading branch information
SteveYurongSu authored and jjz921024 committed Jul 25, 2021
1 parent ab3c444 commit 78a324f
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 24 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,28 @@ jobs:
- name: Upload coverage report to codecov.io
run: bash <(curl -s https://codecov.io/bash) || echo 'Failed to upload coverage report!'

checkstyle:
name: Checkstyle

runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Download checkstyle exectable
run: wget -O - -q https://github.com/checkstyle/checkstyle/releases/download/checkstyle-8.44/checkstyle-8.44-all.jar > ./checkstyle.jar

- name: Download reviewdog exectable
run: wget -O - -q https://raw.githubusercontent.com/reviewdog/reviewdog/master/install.sh | sh -s -- -b . v0.12.0

- name: Check code style
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
java -jar ./checkstyle.jar -c ./style/checkStyle.xml -f xml ./eventmesh-* \
| ./reviewdog -f=checkstyle -reporter=github-pr-check -filter-mode=nofilter -fail-on-error
license-check:
name: License Check

Expand Down
47 changes: 47 additions & 0 deletions style/checkStyle.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ 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.
~
-->

<!DOCTYPE module PUBLIC
"-//Puppy Crawl//DTD Check Configuration 1.3//EN"
"http://checkstyle.org/dtds/configuration_1_3.dtd">
<module name="Checker">
<module name="RegexpSingleline">
<property name="format" value="System\.out\.println"/>
<property name="message" value="Prohibit invoking System.out.println in source code !"/>
</module>

<module name="RegexpSingleline">
<property name="format" value="^\s*\*\s*@author"/>
<property name="minimum" value="0"/>
<property name="maximum" value="0"/>
<property name="message" value="ASF project doesn't allow @author copyright."/>
</module>

<module name="RegexpSingleline">
<property name="format"
value=".*[\u3400-\u4DB5\u4E00-\u9FA5\u9FA6-\u9FBB\uF900-\uFA2D\uFA30-\uFA6A\uFA70-\uFAD9\uFF00-\uFFEF\u2E80-\u2EFF\u3000-\u303F\u31C0-\u31EF]+.*"/>
<property name="message" value="Chinese characters are not allowed!"/>
</module>

<module name="TreeWalker">
<module name="PackageName">
<property name="format" value="^(org)\.apache(\.[a-zA-Z][a-zA-Z0-9]*)+$"/>
</module>
</module>
</module>
24 changes: 0 additions & 24 deletions style/copyright/Apache.xml

This file was deleted.

0 comments on commit 78a324f

Please sign in to comment.