Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pronto and Linters #314

Merged
merged 7 commits into from
Apr 4, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions .github/workflows/pronto.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Pronto

on:
pull_request:
branches: [ master ]

jobs:
pronto:
name: Linters
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y mysql-client libmysqlclient-dev wkhtmltopdf pandoc yaz libyaz-dev libmagickwand-dev libpcap-dev memcached cmake
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- name: Run pronto
env:
RAILS_ENV: "test"
PRONTO_PULL_REQUEST_ID: ${{ github.event.pull_request.number }}
PRONTO_GITHUB_ACCESS_TOKEN: "${{ github.token }}"
BUNDLE_PATH: "vendor/bundle"
run:
bundle exec pronto run -f github_pr github_status -c origin/${{ github.base_ref }}
12 changes: 6 additions & 6 deletions .github/workflows/rspec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,23 @@ on:

jobs:
test:
name: CI
runs-on: ubuntu-20.04
name: RSpec
runs-on: ubuntu-22.04
services:
mysql:
image: mysql:5.7
image: mysql:8.0
env:
MYSQL_ROOT_PASSWORD: root
ports:
- 3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
steps:
- name: Checkout
uses: actions/checkout@v1
uses: actions/checkout@v4
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y mysql-client libmysqlclient-dev wkhtmltopdf pandoc yaz libyaz-dev libmagickwand-dev libpcap-dev memcached
sudo apt-get install -y mysql-client libmysqlclient-dev wkhtmltopdf pandoc yaz libyaz-dev libmagickwand-dev libpcap-dev memcached cmake
- name: Configure sysctl limits
run: |
sudo swapoff -a
Expand Down Expand Up @@ -59,4 +59,4 @@ jobs:
MYSQL_PORT: ${{ job.services.mysql.ports[3306] }}
ELASTICSEARCH_PORT: ${{ job.services.elasticsearch.ports[9200] }}
run: |
bundle exec rspec
bundle exec rspec
39 changes: 39 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
AllCops:
TargetRubyVersion: 3.2
NewCops: enable
Exclude:
- bin/*
- config/environments/*
- db/migrate/*

require:
- rubocop-rails
- rubocop-rspec
- rubocop-factory_bot

Metrics/BlockLength:
Max: 100

Metrics/ClassLength:
Max: 1000

Metrics/MethodLength:
Max: 100

Metrics/ModuleLength:
Max: 1000

Metrics/AbcSize:
Enabled: false

Metrics/CyclomaticComplexity:
Enabled: false

Metrics/PerceivedComplexity:
Enabled: false

Layout/LineLength:
Max: 120

Style/HashSyntax:
EnforcedShorthandSyntax: never
13 changes: 12 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
ruby '3.2.1'
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/FrozenStringLiteralComment: Missing frozen string literal comment.


source 'http://rubygems.org'

gem 'rails', '~> 6'
Expand Down Expand Up @@ -121,13 +123,22 @@ group :development do
gem 'capistrano3-puma'
gem 'listen'
gem 'derailed_benchmarks'
# gem 'bullet' # for suggestions to add/remove eager loading
# gem 'bullet' # for suggestions to add/remove eager loading
gem 'stackprof'
gem 'active_record_query_trace'
gem 'immigrant'
gem 'ruby-prof' # for profiling
gem 'ed25519'
gem 'bcrypt_pbkdf'

gem 'haml_lint', '~> 0.57.0', require: false
gem 'pronto', '~> 0.11.2'
gem 'pronto-haml', '~> 0.11.1', require: false
gem 'pronto-rubocop', '~> 0.11.5', require: false
gem 'rubocop', '~> 1.61.0', require: false
gem 'rubocop-factory_bot', '~> 2.25.1', require: false
gem 'rubocop-rails', '~> 2.24.1', require: false
gem 'rubocop-rspec', '~> 2.28.0', require: false
end

group :test, :development do
Expand Down
90 changes: 89 additions & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,16 @@ GEM
minitest (>= 5.1)
tzinfo (~> 2.0)
zeitwerk (~> 2.3)
addressable (2.8.6)
public_suffix (>= 2.0.2, < 6.0)
ahoy_matey (5.0.2)
activesupport (>= 6.1)
device_detector (>= 1)
safely_block (>= 0.4)
airbrussh (1.5.1)
sshkit (>= 1.6.1, != 1.7.0)
ansi (1.5.0)
ast (2.4.2)
aws-eventstream (1.3.0)
aws-partitions (1.895.0)
aws-sdk-core (3.191.3)
Expand Down Expand Up @@ -285,6 +288,9 @@ GEM
rubyzip (> 1.1.1, < 2.4)
get_process_mem (0.2.7)
ffi (~> 1.0)
gitlab (4.19.0)
httparty (~> 0.20)
terminal-table (>= 1.5.1)
globalid (1.2.1)
activesupport (>= 6.1)
grape (1.6.0)
Expand All @@ -311,6 +317,12 @@ GEM
activesupport (>= 5.1)
haml (>= 4.0.6)
railties (>= 5.1)
haml_lint (0.57.0)
haml (>= 5.0)
parallel (~> 1.10)
rainbow
rubocop (>= 1.0)
sysexits (~> 1.1)
hashie (5.0.0)
heapy (0.2.0)
thor
Expand All @@ -320,6 +332,9 @@ GEM
http-accept (1.7.0)
http-cookie (1.0.5)
domain_name (~> 0.5)
httparty (0.21.0)
mini_mime (>= 1.0.0)
multi_xml (>= 0.5.2)
i18n (1.14.4)
concurrent-ruby (~> 1.0)
image_processing (1.12.2)
Expand Down Expand Up @@ -360,6 +375,7 @@ GEM
activerecord
kaminari-core (= 1.2.2)
kaminari-core (1.2.2)
language_server-protocol (3.17.0.3)
libv8-node (18.16.0.0)
libv8-node (18.16.0.0-x86_64-linux)
listen (3.9.0)
Expand Down Expand Up @@ -437,6 +453,9 @@ GEM
snaky_hash (~> 2.0)
version_gem (~> 1.1)
observer (0.1.2)
octokit (7.2.0)
faraday (>= 1, < 3)
sawyer (~> 0.9)
omniauth (2.1.2)
hashie (>= 3.4.6)
rack (>= 2.2.3)
Expand Down Expand Up @@ -464,15 +483,34 @@ GEM
paper_trail (15.1.0)
activerecord (>= 6.1)
request_store (~> 1.4)
parallel (1.24.0)
parser (3.3.0.5)
ast (~> 2.4.1)
racc
pcaprub (0.13.1)
pkg-config (1.5.6)
project-honeypot2 (0.1.3)
net-dns2
pronto (0.11.2)
gitlab (>= 4.4.0, < 5.0)
httparty (>= 0.13.7, < 1.0)
octokit (>= 4.7.0, < 8.0)
rainbow (>= 2.2, < 4.0)
rexml (>= 3.2.5, < 4.0)
rugged (>= 0.23.0, < 2.0)
thor (>= 0.20.3, < 2.0)
pronto-haml (0.11.1)
haml_lint (~> 0.23)
pronto (~> 0.11.0)
pronto-rubocop (0.11.5)
pronto (~> 0.11.0)
rubocop (>= 0.63.1, < 2.0)
property_sets (3.12.0)
activerecord (>= 6.0, < 7.2)
json
psych (5.1.2)
stringio
public_suffix (5.0.5)
puma (6.4.2)
nio4r (~> 2.0)
puma-daemon (0.3.2)
Expand All @@ -483,7 +521,7 @@ GEM
puma (>= 2.7)
raabro (1.4.0)
racc (1.7.3)
rack (2.2.8.1)
rack (2.2.9)
rack-accept (0.4.5)
rack (>= 0.4)
rack-attack (6.7.0)
Expand Down Expand Up @@ -534,6 +572,7 @@ GEM
method_source
rake (>= 12.2)
thor (~> 1.0)
rainbow (3.1.1)
rake (13.1.0)
rb-fsevent (0.11.2)
rb-inotify (0.10.1)
Expand Down Expand Up @@ -585,14 +624,45 @@ GEM
rswag-ui (2.13.0)
actionpack (>= 3.1, < 7.2)
railties (>= 3.1, < 7.2)
rubocop (1.61.0)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
parser (>= 3.3.0.2)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml (>= 3.2.5, < 4.0)
rubocop-ast (>= 1.30.0, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.31.2)
parser (>= 3.3.0.4)
rubocop-capybara (2.20.0)
rubocop (~> 1.41)
rubocop-factory_bot (2.25.1)
rubocop (~> 1.41)
rubocop-rails (2.24.1)
activesupport (>= 4.2.0)
rack (>= 1.1)
rubocop (>= 1.33.0, < 2.0)
rubocop-ast (>= 1.31.1, < 2.0)
rubocop-rspec (2.28.0)
rubocop (~> 1.40)
rubocop-capybara (~> 2.17)
rubocop-factory_bot (~> 2.22)
rubocop-rspec_rails (~> 2.28)
rubocop-rspec_rails (2.28.2)
rubocop (~> 1.40)
ruby-prof (1.7.0)
ruby-progressbar (1.13.0)
ruby-statistics (3.0.2)
ruby-vips (2.2.1)
ffi (~> 1.12)
ruby2_keywords (0.0.5)
rubyzip (2.3.2)
rufus-scheduler (3.9.1)
fugit (~> 1.1, >= 1.1.6)
rugged (1.7.2)
rvm1-capistrano3 (1.4.0)
capistrano (~> 3.0)
sshkit (>= 1.2)
Expand All @@ -607,6 +677,9 @@ GEM
sprockets (> 3.0)
sprockets-rails
tilt
sawyer (0.9.2)
addressable (>= 2.3.5)
faraday (>= 0.17.3, < 3)
selenium-webdriver (4.18.1)
base64 (~> 0.2)
rexml (~> 3.2, >= 3.2.5)
Expand Down Expand Up @@ -646,7 +719,10 @@ GEM
net-ssh (>= 2.8.0)
stackprof (0.2.26)
stringio (3.1.0)
sysexits (1.2.0)
temple (0.10.3)
terminal-table (3.0.2)
unicode-display_width (>= 1.1.1, < 3)
terrapin (1.0.1)
climate_control
thor (1.3.1)
Expand All @@ -658,6 +734,7 @@ GEM
concurrent-ruby (~> 1.0)
uglifier (4.2.0)
execjs (>= 0.3.0, < 3)
unicode-display_width (2.5.0)
version_gem (1.1.3)
watir (6.19.1)
regexp_parser (>= 1.2, < 3)
Expand Down Expand Up @@ -716,6 +793,7 @@ DEPENDENCIES
grape-swagger-entity (~> 0.5.1)
haml
haml-rails
haml_lint (~> 0.57.0)
hebrew (>= 0.2.1)
hebruby
htmlentities
Expand All @@ -741,6 +819,9 @@ DEPENDENCIES
pandoc-ruby
paper_trail
project-honeypot2 (>= 0.1.3)
pronto (~> 0.11.2)
pronto-haml (~> 0.11.1)
pronto-rubocop (~> 0.11.5)
property_sets (>= 3.7.1)
puma
puma-daemon
Expand All @@ -758,6 +839,10 @@ DEPENDENCIES
rspec-rails (~> 5.0.2)
rswag-api
rswag-ui
rubocop (~> 1.61.0)
rubocop-factory_bot (~> 2.25.1)
rubocop-rails (~> 2.24.1)
rubocop-rspec (~> 2.28.0)
ruby-prof
rufus-scheduler
rvm1-capistrano3
Expand All @@ -774,5 +859,8 @@ DEPENDENCIES
web-console
yt

RUBY VERSION
ruby 3.2.1p31

BUNDLED WITH
2.4.5
9 changes: 9 additions & 0 deletions config/environments/development.rb
Original file line number Diff line number Diff line change
Expand Up @@ -122,4 +122,13 @@
config.active_record.verbose_query_logs = false
config.action_view.cache_template_loading = true
end

# Applying rubocop-rails autocorrection to generated content
# see https://github.com/rubocop/rubocop-rails?tab=readme-ov-file#rails-configuration-tip
config.generators.after_generate do |files|
parsable_files = files.filter { |file| file.end_with?('.rb') }
unless parsable_files.empty?
system("bundle exec rubocop -A --fail-level=E #{parsable_files.shelljoin}", exception: true)
end
end
end
Loading
Loading