-
Notifications
You must be signed in to change notification settings - Fork 0
42 lines (35 loc) · 1012 Bytes
/
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
38
39
40
41
42
name: RuboCop Linter
on:
push:
branches:
- "**"
jobs:
rubocop:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: "3.3.4"
- name: Install dependencies
run: |
bundle install --jobs 4 --retry 3
- name: Verify jq installation
run: |
if ! command -v jq &> /dev/null; then
echo "jq not found! Installing..."
sudo apt-get update && sudo apt-get install -y jq
else
echo "jq is already installed."
fi
- name: Run RuboCop
id: rubocop
run: |
offenses=$(bundle exec rubocop --format json | jq '.summary.offense_count')
echo "Rubocop offenses found: $offenses"
if [ "$offenses" -ge 4 ]; then
echo "More than 3 offenses found, failing the workflow!"
exit 1
fi