Skip to content

Commit 168d951

Browse files
committed
Add ignore_databases to incorrect_boolean_presence_validation
This commit adds a new option for ignoring entire databases and models backed by them. incorrect_boolean_presence_validation is the first detector that gained that new option.
1 parent 7c13cbd commit 168d951

File tree

13 files changed

+381
-219
lines changed

13 files changed

+381
-219
lines changed

.github/workflows/lint.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Lint
2+
on: [push, pull_request]
3+
4+
jobs:
5+
# Run the linter first for rapid feedback if some trivial stylistic issues
6+
# slipped through the cracks.
7+
lint:
8+
runs-on: ubuntu-latest
9+
env:
10+
# When running in CI the gemspec does NOT pull rubocop as a dependency
11+
# to avoid conflicting with various Ruby/Rails setups. We need to
12+
# set LINT to explicitly request rubocop as a dependency.
13+
LINT: true
14+
steps:
15+
- uses: actions/checkout@v3
16+
- uses: ruby/setup-ruby@v1
17+
with:
18+
ruby-version: 3.0
19+
bundler-cache: true
20+
- run: bundle exec rake rubocop

.github/workflows/mysql.yml

Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
name: Test MySQL
2+
on: [push, pull_request]
3+
4+
jobs:
5+
test-latest:
6+
name: "Active Record 7.1 + Ruby 3.2"
7+
runs-on: ubuntu-latest
8+
services:
9+
mysql:
10+
image: mysql
11+
env:
12+
MYSQL_ROOT_PASSWORD: github
13+
MYSQL_USER: github
14+
MYSQL_PASSWORD: github
15+
MYSQL_DATABASE: active_record_doctor_primary
16+
options: >-
17+
--health-cmd "mysqladmin ping -h 127.0.0.1"
18+
--health-interval 10s
19+
--health-timeout 5s
20+
--health-retries 5
21+
ports:
22+
- 3306:3306
23+
env:
24+
BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/Gemfile.activerecord-7.1.x
25+
steps:
26+
- uses: actions/checkout@v3
27+
- uses: ruby/setup-ruby@v1
28+
with:
29+
ruby-version: "3.2"
30+
bundler-cache: true
31+
- name: Prepare the database
32+
run: |
33+
mysqladmin -h127.0.0.1 -uroot -pgithub create active_record_doctor_secondary
34+
mysql -h127.0.0.1 -uroot -pgithub -e "GRANT ALL PRIVILEGES ON active_record_doctor_secondary.* TO 'github'"
35+
- name: Run the test suite against MySQL
36+
run: bundle exec rake test:mysql2
37+
env:
38+
# We can't use localhost because that makes the MySQL client try
39+
# connecting via a Unix socket instead of TCP.
40+
DATABASE_HOST: 127.0.0.1
41+
DATABASE_PORT: 3306
42+
DATABASE_USERNAME: github
43+
DATABASE_PASSWORD: github
44+
45+
test-supported:
46+
name: "Active Record ${{ matrix.active_record }} + Ruby ${{ matrix.ruby }}"
47+
needs: [test-latest]
48+
runs-on: ubuntu-latest
49+
services:
50+
mysql:
51+
image: mysql
52+
env:
53+
MYSQL_ROOT_PASSWORD: github
54+
MYSQL_USER: github
55+
MYSQL_PASSWORD: github
56+
MYSQL_DATABASE: active_record_doctor_primary
57+
options: >-
58+
--health-cmd "mysqladmin ping -h 127.0.0.1"
59+
--health-interval 10s
60+
--health-timeout 5s
61+
--health-retries 5
62+
ports:
63+
- 3306:3306
64+
strategy:
65+
matrix:
66+
ruby: ["3.0", "3.1", "3.2"]
67+
active_record: ["6.1", "7.0", "7.1"]
68+
exclude:
69+
- ruby: "3.2"
70+
active_record: "7.1"
71+
env:
72+
BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/Gemfile.activerecord-${{ matrix.active_record }}.x
73+
steps:
74+
- uses: actions/checkout@v3
75+
- uses: ruby/setup-ruby@v1
76+
with:
77+
ruby-version: ${{ matrix.ruby }}
78+
bundler-cache: true
79+
- name: Prepare the database
80+
run: |
81+
mysqladmin -h127.0.0.1 -uroot -pgithub create active_record_doctor_secondary
82+
mysql -h127.0.0.1 -uroot -pgithub -e "GRANT ALL PRIVILEGES ON active_record_doctor_secondary.* TO 'github'"
83+
- name: Run the test suite against MySQL
84+
run: bundle exec rake test:mysql2
85+
env:
86+
# We can't use localhost because that makes the MySQL client try
87+
# connecting via a Unix socket instead of TCP.
88+
DATABASE_HOST: 127.0.0.1
89+
DATABASE_PORT: 3306
90+
DATABASE_USERNAME: github
91+
DATABASE_PASSWORD: github
92+
93+
test-unsupported:
94+
name: "Active Record ${{ matrix.active_record }} + Ruby ${{ matrix.ruby }}"
95+
needs: [test-supported]
96+
runs-on: ubuntu-latest
97+
services:
98+
mysql:
99+
image: mysql
100+
env:
101+
MYSQL_ROOT_PASSWORD: github
102+
MYSQL_USER: github
103+
MYSQL_PASSWORD: github
104+
MYSQL_DATABASE: active_record_doctor_primary
105+
options: >-
106+
--health-cmd "mysqladmin ping -h 127.0.0.1"
107+
--health-interval 10s
108+
--health-timeout 5s
109+
--health-retries 5
110+
ports:
111+
- 3306:3306
112+
strategy:
113+
matrix:
114+
ruby: ["2.4", "2.5", "2.6", "2.7"]
115+
active_record: ["4.2", "5.0", "5.1", "5.2", "6.0"]
116+
exclude:
117+
- ruby: "2.7"
118+
active_record: "4.2"
119+
- ruby: "2.4"
120+
active_record: "6.0"
121+
include:
122+
- ruby: "3.0"
123+
active_record: "6.0"
124+
- ruby: "3.1"
125+
active_record: "6.0"
126+
- ruby: "3.2"
127+
active_record: "6.0"
128+
env:
129+
BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/Gemfile.activerecord-${{ matrix.active_record }}.x
130+
steps:
131+
- uses: actions/checkout@v3
132+
- uses: ruby/setup-ruby@v1
133+
with:
134+
ruby-version: ${{ matrix.ruby }}
135+
rubygems: ${{ (matrix.ruby == '2.4' || matrix.ruby == '2.5' || matrix.ruby == '2.6') && '3.2.3' || '' }}
136+
bundler-cache: true
137+
- name: Prepare the database
138+
run: |
139+
mysqladmin -h127.0.0.1 -uroot -pgithub create active_record_doctor_secondary
140+
mysql -h127.0.0.1 -uroot -pgithub -e "GRANT ALL PRIVILEGES ON active_record_doctor_secondary.* TO 'github'"
141+
- name: Run the test suite against MySQL
142+
run: bundle exec rake test:mysql2
143+
env:
144+
# We can't use localhost because that makes the MySQL client try
145+
# connecting via a Unix socket instead of TCP.
146+
DATABASE_HOST: 127.0.0.1
147+
DATABASE_PORT: 3306
148+
DATABASE_USERNAME: github
149+
DATABASE_PASSWORD: github

.github/workflows/postgresql.yml

Lines changed: 154 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
1+
name: Test PostgreSQL
2+
on: [push, pull_request]
3+
4+
jobs:
5+
test-latest:
6+
name: "Active Record 7.1 + Ruby 3.2"
7+
runs-on: ubuntu-latest
8+
services:
9+
postgres:
10+
image: postgres
11+
env:
12+
POSTGRES_DB: active_record_doctor_primary
13+
POSTGRES_USER: github
14+
POSTGRES_PASSWORD: github
15+
options: >-
16+
--health-cmd pg_isready
17+
--health-interval 10s
18+
--health-timeout 5s
19+
--health-retries 5
20+
ports:
21+
- 5432:5432
22+
env:
23+
BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/Gemfile.activerecord-7.1.x
24+
steps:
25+
- uses: actions/checkout@v3
26+
- uses: ruby/setup-ruby@v1
27+
with:
28+
ruby-version: "3.2"
29+
bundler-cache: true
30+
- name: Prepare PostgreSQL
31+
run: createdb active_record_doctor_secondary
32+
env:
33+
PGHOST: localhost
34+
PGPORT: 5432
35+
PGUSER: github
36+
PGPASSWORD: github
37+
PGDATABASE: postgres
38+
- name: Run the test suite against PostgreSQL
39+
run: bundle exec rake test:postgresql
40+
env:
41+
DATABASE_HOST: localhost
42+
DATABASE_PORT: 5432
43+
DATABASE_USERNAME: github
44+
DATABASE_PASSWORD: github
45+
46+
test-supported:
47+
name: "Active Record ${{ matrix.active_record }} + Ruby ${{ matrix.ruby }}"
48+
needs: [test-latest]
49+
runs-on: ubuntu-latest
50+
services:
51+
postgres:
52+
image: postgres
53+
env:
54+
POSTGRES_DB: active_record_doctor_primary
55+
POSTGRES_USER: github
56+
POSTGRES_PASSWORD: github
57+
options: >-
58+
--health-cmd pg_isready
59+
--health-interval 10s
60+
--health-timeout 5s
61+
--health-retries 5
62+
ports:
63+
- 5432:5432
64+
strategy:
65+
matrix:
66+
ruby: ["3.0", "3.1", "3.2"]
67+
active_record: ["6.1", "7.0", "7.1"]
68+
exclude:
69+
- ruby: "3.2"
70+
active_record: "7.1"
71+
env:
72+
BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/Gemfile.activerecord-${{ matrix.active_record }}.x
73+
steps:
74+
- uses: actions/checkout@v3
75+
- uses: ruby/setup-ruby@v1
76+
with:
77+
ruby-version: ${{ matrix.ruby }}
78+
rubygems: ${{ matrix.rubygems }}
79+
bundler-cache: true
80+
- name: Prepare PostgreSQL
81+
run: createdb active_record_doctor_secondary
82+
env:
83+
PGHOST: localhost
84+
PGPORT: 5432
85+
PGUSER: github
86+
PGPASSWORD: github
87+
PGDATABASE: postgres
88+
- name: Run the test suite against PostgreSQL
89+
run: bundle exec rake test:postgresql
90+
env:
91+
DATABASE_HOST: localhost
92+
DATABASE_PORT: 5432
93+
DATABASE_USERNAME: github
94+
DATABASE_PASSWORD: github
95+
96+
test-unsupported:
97+
name: "Active Record ${{ matrix.active_record }} + Ruby ${{ matrix.ruby }}"
98+
needs: [test-supported]
99+
runs-on: ubuntu-latest
100+
services:
101+
postgres:
102+
image: postgres
103+
env:
104+
POSTGRES_DB: active_record_doctor_primary
105+
POSTGRES_USER: github
106+
POSTGRES_PASSWORD: github
107+
options: >-
108+
--health-cmd pg_isready
109+
--health-interval 10s
110+
--health-timeout 5s
111+
--health-retries 5
112+
ports:
113+
- 5432:5432
114+
strategy:
115+
matrix:
116+
ruby: ["2.4", "2.5", "2.6", "2.7"]
117+
active_record: ["4.2", "5.0", "5.1", "5.2", "6.0"]
118+
exclude:
119+
- ruby: "2.7"
120+
active_record: "4.2"
121+
- ruby: "2.4"
122+
active_record: "6.0"
123+
include:
124+
- ruby: "3.0"
125+
active_record: "6.0"
126+
- ruby: "3.1"
127+
active_record: "6.0"
128+
- ruby: "3.2"
129+
active_record: "6.0"
130+
env:
131+
BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/Gemfile.activerecord-${{ matrix.active_record }}.x
132+
steps:
133+
- uses: actions/checkout@v3
134+
- uses: ruby/setup-ruby@v1
135+
with:
136+
ruby-version: ${{ matrix.ruby }}
137+
rubygems: ${{ (matrix.ruby == '2.4' || matrix.ruby == '2.5' || matrix.ruby == '2.6') && '3.2.3' || '' }}
138+
bundler-cache: true
139+
- name: Prepare PostgreSQL
140+
if: startsWith(matrix.active_record, '6.') || startsWith(matrix.active_record, '7.')
141+
run: createdb active_record_doctor_secondary
142+
env:
143+
PGHOST: localhost
144+
PGPORT: 5432
145+
PGUSER: github
146+
PGPASSWORD: github
147+
PGDATABASE: postgres
148+
- name: Run the test suite against PostgreSQL
149+
run: bundle exec rake test:postgresql
150+
env:
151+
DATABASE_HOST: localhost
152+
DATABASE_PORT: 5432
153+
DATABASE_USERNAME: github
154+
DATABASE_PASSWORD: github

0 commit comments

Comments
 (0)