forked from ontoportal/ontoportal_web_ui
-
Notifications
You must be signed in to change notification settings - Fork 5
37 lines (32 loc) · 1.12 KB
/
rubocop.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
name: RuboCop linting
on:
push:
pull_request:
types: [ opened, reopened ]
jobs:
rubocop:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
# Add or replace dependency steps here
- name: Install Ruby and gems
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7.8
bundler-cache: true
- name: Run RuboCop
run: |
bundle exec rubocop --format offenses
bundle exec rubocop --format offenses --out tmp/rubocop/offenses.json
- name: Post RuboCop annotations
if: always()
run: |
cat tmp/rubocop/offenses.json | jq -r '.files[] | .offenses[] | "\(.message) at \(.location.line):\(.location.column)"' | \
while read -r line; do
file=$(echo "$line" | awk -F ':' '{print $1}')
message=$(echo "$line" | awk -F ':' '{print $2}')
line_number=$(echo "$line" | awk -F ':' '{print $3}' | cut -d' ' -f1)
col_number=$(echo "$line" | awk -F ':' '{print $4}')
echo "::error file=${file},line=${line_number},col=${col_number}::${message}"
done