Skip to content

Commit 5e06d87

Browse files
authored
Merge pull request #170 from rubycdp/linter
Run linter and tests
2 parents 68e08d6 + 291894f commit 5e06d87

File tree

5 files changed

+44
-28
lines changed

5 files changed

+44
-28
lines changed

.github/workflows/linter.yml

Lines changed: 31 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,36 @@ name: Linter
22
on: [push]
33

44
jobs:
5-
# linters:
6-
# name: Linters
7-
# runs-on: ubuntu-latest
8-
# steps:
9-
# - name: Checkout code
10-
# uses: actions/checkout@v2
5+
linters:
6+
name: Linters
7+
strategy:
8+
fail-fast: false
9+
matrix:
10+
ruby: [ 2.7, 3.0 ]
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v2
1115

12-
# - name: Setup Ruby
13-
# uses: ruby/setup-ruby@v1
14-
# - name: Ruby gem cache
15-
# uses: actions/cache@v1
16-
# with:
17-
# path: vendor/bundle
18-
# key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
19-
# restore-keys: |
20-
# ${{ runner.os }}-gems-
21-
# - name: Install gems
22-
# run: |
23-
# bundle config path vendor/bundle
24-
# bundle install --jobs 4 --retry 3
16+
- name: Setup Ruby
17+
uses: ruby/setup-ruby@v1
18+
with:
19+
ruby-version: ${{ matrix.ruby }}
20+
bundler-cache: true
2521

26-
# - name: Run linters
27-
# run: |
28-
# bin/rubocop --parallel
22+
- name: Ruby gem cache
23+
uses: actions/cache@v1
24+
with:
25+
path: vendor/bundle
26+
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
27+
restore-keys: |
28+
${{ runner.os }}-gems-
29+
30+
- name: Install gems
31+
run: |
32+
bundle config path vendor/bundle
33+
bundle install --jobs 4 --retry 3
34+
35+
- name: Run linters
36+
run: |
37+
bundle exec rubocop --parallel

.github/workflows/tests.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ on:
44
branches:
55
- master
66
pull_request:
7-
types: [opened, synchronize, reopened, labeled]
87

98
jobs:
109
tests:
@@ -39,10 +38,9 @@ jobs:
3938
- name: Run tests
4039
run: bundle exec rake
4140
if: |
42-
github.event.pull_request.draft == false ||
43-
(github.event.pull_request.draft == true &&
44-
contains(github.event.pull_request.labels.*.name, 'master') &&
45-
matrix.gemfile == 'ferrum-master')
41+
matrix.gemfile != 'ferrum-master' ||
42+
(matrix.gemfile == 'ferrum-master' &&
43+
contains(github.event.pull_request.labels.*.name, 'master'))
4644
4745
- name: Archive artifacts
4846
uses: actions/upload-artifact@v2

cuprite.gemspec

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ Gem::Specification.new do |s|
2121
"homepage_uri" => "https://cuprite.rubycdp.com/",
2222
"bug_tracker_uri" => "https://github.com/rubycdp/cuprite/issues",
2323
"documentation_uri" => "https://github.com/rubycdp/cuprite/blob/master/README.md",
24-
"source_code_uri" => "https://github.com/rubycdp/cuprite"
24+
"source_code_uri" => "https://github.com/rubycdp/cuprite",
25+
"rubygems_mfa_required" => "true"
2526
}
2627

2728
s.required_ruby_version = ">= 2.6.0"

lib/capybara/cuprite/driver.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
module Capybara
77
module Cuprite
8+
# rubocop:disable Metrics/ClassLength
89
class Driver < Capybara::Driver::Base
910
DEFAULT_MAXIMIZE_SCREEN_SIZE = [1366, 768].freeze
1011
EXTENSION = File.expand_path("javascripts/index.js", __dir__)
@@ -418,5 +419,6 @@ def pdf?(path, options)
418419
options[:format].to_s == "pdf"
419420
end
420421
end
422+
# rubocop:enable Metrics/ClassLength
421423
end
422424
end

lib/capybara/cuprite/page.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,9 @@ def title
130130

131131
private
132132

133+
# rubocop:disable Metrics/CyclomaticComplexity
134+
# rubocop:disable Metrics/PerceivedComplexity
135+
# rubocop:disable Style/GuardClause
133136
def prepare_page
134137
super
135138

@@ -178,6 +181,9 @@ def prepare_page
178181
command("Page.handleJavaScriptDialog", **options)
179182
end
180183
end
184+
# rubocop:enable Metrics/CyclomaticComplexity
185+
# rubocop:enable Metrics/PerceivedComplexity
186+
# rubocop:enable Style/GuardClause
181187

182188
def find_position(node, **options)
183189
node.find_position(**options)

0 commit comments

Comments
 (0)