Skip to content

Commit

Permalink
Adds checkstyle workflow (#3)
Browse files Browse the repository at this point in the history
* Adds checkstyle workflow

Fixes all linting related issues in the main source set
Removes release from build workflow
Adds checkstyle failure criteria
  • Loading branch information
c4deszes authored Mar 7, 2021
1 parent ba5f282 commit e756139
Show file tree
Hide file tree
Showing 120 changed files with 5,140 additions and 3,993 deletions.
25 changes: 18 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ on:
- '**/*.md'
branches:
- master
- release/**
pull_request:
paths-ignore:
- '*.md'
Expand Down Expand Up @@ -45,9 +44,21 @@ jobs:
name: codecov-umbrella
fail_ci_if_error: true

- name: Release
if: github.event_name != 'pull_request' && startsWith(github.ref, 'refs/tags/v')
env:
GITHUB_PKG_USERNAME: javatmc
GITHUB_PKG_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./gradlew publish
# - name: Release
# if: github.event_name != 'pull_request' && startsWith(github.ref, 'refs/tags/v')
# env:
# GITHUB_PKG_USERNAME: javatmc
# GITHUB_PKG_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# run: ./gradlew publish

lint:
name: Lint
runs-on: ubuntu-latest
container:
image: openjdk:8
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Checkstyle
run: ./gradlew checkstyleMain --info
9 changes: 9 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ subprojects {
apply plugin: 'java'
apply plugin: 'maven-publish'
apply plugin: 'jacoco'
apply plugin: 'checkstyle'

repositories {
jcenter()
Expand Down Expand Up @@ -46,6 +47,14 @@ subprojects {
}
}

checkstyle {
toolVersion '8.39'
sourceSets = []
configFile = file("${rootDir}/config/checkstyle/checkstyle.xml")
ignoreFailures = false
maxWarnings = 0
}

tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}
Expand Down
2 changes: 1 addition & 1 deletion codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ coverage:
base: auto
flags:
- unittests
if_ci_failed: error
if_ci_failed: error
15 changes: 15 additions & 0 deletions config/checkstyle/checkstyle-suppressions.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suppressions PUBLIC
"-//Checkstyle//DTD SuppressionFilter Configuration 1.0//EN"
"https://checkstyle.org/dtds/suppressions_1_0.dtd">
<suppressions>
<!-- Disabled due to lots of standards using full capital names and abbreviations -->
<suppress files="." checks="AbbreviationAsWordInNameCheck"/>

<!-- Disabled because of styling choice -->
<suppress files="." checks="RequireEmptyLineBeforeBlockTagGroup" />

<!-- Generated RPC of the VXI11 module -->
<suppress checks="." files="org[\\/]jtmc[\\/]core[\\/]lxi[\\/]vxi11[\\/]rpc[\\/]"/>
<suppress checks="." files="org[\\/]jtmc[\\/]core[\\/]lxi[\\/]vxi11[\\/]portmap[\\/]"/>
</suppressions>
Loading

0 comments on commit e756139

Please sign in to comment.