Skip to content

add rubocop github ci #3

add rubocop github ci

add rubocop github ci #3

Workflow file for this run

name: RuboCop linting
on:
push:
pull_request:
types: [ opened, reopened ]
jobs:
rubocop:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3

Check failure on line 14 in .github/workflows/rubocop.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/rubocop.yml

Invalid workflow file

You have an error in your yaml syntax on line 14
# 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