Fix linting on CI

This commit is contained in:
Pedro Piñera 2021-05-17 12:05:21 +02:00
parent a640b474f1
commit f3c2c4faad
8 changed files with 117 additions and 89 deletions

View File

@ -61,27 +61,6 @@ jobs:
working-directory: projects/lab
run: |
bundle exec rails test
lint_ruby:
name: Lint Ruby
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
ruby-version: ${{ env.RUBY_VERSION }}
- name: Install dependencies
working-directory: projects/lab
run: |
sudo apt-get -yqq install libpq-dev
gem install bundler
bundle config path vendor/bundle
bundle install --jobs=4 --retry=3
- name: Lint Ruby
working-directory: projects/lab
run: |
bundle exec rubocop
assets_precompile:
name: Assets precompile
runs-on: ubuntu-latest

View File

@ -1,5 +1,7 @@
inherit_gem:
rubocop-shopify: rubocop.yml
rubocop-rails_config:
- config/rails.yml
require:
- rubocop-rake
- rubocop-minitest
@ -20,7 +22,13 @@ AllCops:
- Gemfile
- Rakefile
- projects/fourier/**/*.rb
- projects/lab/**/*.rb
Exclude:
- vendor/**/*
- projects/website/node_modules/**/*
- projects/tuist/fixtures/**/*
- projects/lab/node_modules/**/*
- projects/lab/vendor/**/*
- projects/lab/db/schema.rb
- projects/lab/bin/**/*

View File

@ -31,6 +31,9 @@ group :development do
gem "rubocop-shopify"
gem "rubocop-minitest", "~> 0.12.1"
gem "rubocop-rake", "~> 0.5.1"
gem "rubocop", "~> 1.14"
gem "rubocop-rails", "~> 2.10.1"
gem "rubocop-rails_config"
end
group :development, :test do

View File

@ -2,6 +2,19 @@ GEM
remote: https://rubygems.org/
specs:
CFPropertyList (3.0.3)
actionpack (5.2.5)
actionview (= 5.2.5)
activesupport (= 5.2.5)
rack (~> 2.0, >= 2.0.8)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.2)
actionview (5.2.5)
activesupport (= 5.2.5)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.3)
activesupport (5.2.5)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 0.7, < 2)
@ -61,6 +74,7 @@ GEM
colored2 (3.1.2)
colorize (0.8.1)
concurrent-ruby (1.1.8)
crass (1.0.6)
cucumber (6.0.0)
builder (~> 3.2, >= 3.2.4)
cucumber-core (~> 9.0, >= 9.0.0)
@ -103,6 +117,7 @@ GEM
ejson (1.2.1)
encrypted-environment (0.2.0)
ejson (~> 1.2)
erubi (1.10.0)
escape (0.0.4)
ethon (0.12.0)
ffi (>= 1.3.0)
@ -160,12 +175,17 @@ GEM
concurrent-ruby (~> 1.0)
json (2.5.1)
jwt (2.2.2)
loofah (2.9.1)
crass (~> 1.0.2)
nokogiri (>= 1.5.9)
memoist (0.16.2)
method_source (1.0.0)
middleware (0.1.0)
mime-types (3.3.1)
mime-types-data (~> 3.2015)
mime-types-data (3.2021.0225)
mini_mime (1.0.2)
mini_portile2 (2.5.1)
minitest (5.14.4)
minitest-reporters (1.4.3)
ansi
@ -181,12 +201,15 @@ GEM
nap (1.1.0)
naturally (2.2.1)
netrc (0.11.0)
nokogiri (1.11.4)
mini_portile2 (~> 2.5.0)
racc (~> 1.4)
octokit (4.21.0)
faraday (>= 0.9)
sawyer (~> 0.8.0, >= 0.5.3)
os (1.1.1)
parallel (1.20.1)
parser (3.0.1.0)
parser (3.0.1.1)
ast (~> 2.4.1)
protobuf-cucumber (3.10.8)
activesupport (>= 3.2)
@ -194,6 +217,21 @@ GEM
thor
thread_safe
public_suffix (4.0.6)
racc (1.5.2)
rack (2.2.3)
rack-test (1.1.0)
rack (>= 1.0, < 3)
rails-dom-testing (2.0.3)
activesupport (>= 4.2.0)
nokogiri (>= 1.6)
rails-html-sanitizer (1.3.0)
loofah (~> 2.3)
railties (5.2.5)
actionpack (= 5.2.5)
activesupport (= 5.2.5)
method_source
rake (>= 0.8.7)
thor (>= 0.19.0, < 2.0)
rainbow (3.0.0)
rake (13.0.3)
regexp_parser (2.1.1)
@ -203,19 +241,35 @@ GEM
uber (< 0.2.0)
retriable (3.1.2)
rexml (3.2.5)
rubocop (1.13.0)
rubocop (1.15.0)
parallel (~> 1.10)
parser (>= 3.0.0.0)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml
rubocop-ast (>= 1.2.0, < 2.0)
rubocop-ast (>= 1.5.0, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 3.0)
rubocop-ast (1.4.1)
parser (>= 2.7.1.5)
rubocop-ast (1.5.0)
parser (>= 3.0.1.1)
rubocop-minitest (0.12.1)
rubocop (>= 0.90, < 2.0)
rubocop-packaging (0.5.1)
rubocop (>= 0.89, < 2.0)
rubocop-performance (1.11.3)
rubocop (>= 1.7.0, < 2.0)
rubocop-ast (>= 0.4.0)
rubocop-rails (2.10.1)
activesupport (>= 4.2.0)
rack (>= 1.1)
rubocop (>= 1.7.0, < 2.0)
rubocop-rails_config (1.5.3)
railties (>= 5.0)
rubocop (>= 1.13)
rubocop-ast (>= 1.0.1)
rubocop-packaging (~> 0.5)
rubocop-performance (~> 1.11)
rubocop-rails (~> 2.0)
rubocop-rake (0.5.1)
rubocop
rubocop-shopify (2.1.0)
@ -274,7 +328,10 @@ DEPENDENCIES
mocha (~> 1.12)
octokit (~> 4.21)
rake (~> 13.0)
rubocop (~> 1.14)
rubocop-minitest (~> 0.12.1)
rubocop-rails (~> 2.10.1)
rubocop-rails_config
rubocop-rake (~> 0.5.1)
rubocop-shopify
ruby-macho (~> 1.4)

View File

@ -37,34 +37,33 @@ module Fourier
end
private
def download(temporary_dir:)
puts(::CLI::UI.fmt("Downloading source code from {{info:#{SOURCE_TAR_URL}}}"))
sources_zip_path = File.join(temporary_dir, "swiftdoc.zip")
Down.download(SOURCE_TAR_URL, destination: sources_zip_path)
sources_zip_path
end
def download(temporary_dir:)
puts(::CLI::UI.fmt("Downloading source code from {{info:#{SOURCE_TAR_URL}}}"))
sources_zip_path = File.join(temporary_dir, "swiftdoc.zip")
Down.download(SOURCE_TAR_URL, destination: sources_zip_path)
sources_zip_path
end
def extract(sources_zip_path)
puts("Extracting source code...")
zip_content_path = File.join(File.dirname(sources_zip_path), "content")
Utilities::Zip.extract(zip: sources_zip_path, into: zip_content_path)
Dir.glob(File.join(zip_content_path, "*/")).first
end
def extract(sources_zip_path)
puts("Extracting source code...")
zip_content_path = File.join(File.dirname(sources_zip_path), "content")
Utilities::Zip.extract(zip: sources_zip_path, into: zip_content_path)
Dir.glob(File.join(zip_content_path, "*/")).first
end
def build(sources_path, into:)
puts("Building...")
Utilities::SwiftPackageManager.build_fat_release_binary(
path: sources_path,
binary_name: "swift-doc",
output_directory: into
)
def build(sources_path, into:)
puts("Building...")
Utilities::SwiftPackageManager.build_fat_release_binary(
path: sources_path,
binary_name: "swift-doc",
output_directory: into
)
FileUtils.copy_entry(
File.join(sources_path, ".build/arm64-apple-macosx/release/swift-doc_swift-doc.bundle"),
File.join(into, "swift-doc_swift-doc.bundle")
)
end
FileUtils.copy_entry(
File.join(sources_path, ".build/arm64-apple-macosx/release/swift-doc_swift-doc.bundle"),
File.join(into, "swift-doc_swift-doc.bundle")
)
end
end
end
end

View File

@ -24,29 +24,28 @@ module Fourier
end
private
def download(temporary_dir:)
puts(::CLI::UI.fmt("Downloading source code from {{info:#{SOURCE_TAR_URL}}}"))
sources_zip_path = File.join(temporary_dir, "xcbeautify.zip")
Down.download(SOURCE_TAR_URL, destination: sources_zip_path)
sources_zip_path
end
def download(temporary_dir:)
puts(::CLI::UI.fmt("Downloading source code from {{info:#{SOURCE_TAR_URL}}}"))
sources_zip_path = File.join(temporary_dir, "xcbeautify.zip")
Down.download(SOURCE_TAR_URL, destination: sources_zip_path)
sources_zip_path
end
def extract(sources_zip_path)
puts("Extracting source code...")
content_path = File.join(File.dirname(sources_zip_path), "content")
Utilities::Zip.extract(zip: sources_zip_path, into: content_path)
Dir.glob(File.join(content_path, "*/")).first
end
def extract(sources_zip_path)
puts("Extracting source code...")
content_path = File.join(File.dirname(sources_zip_path), "content")
Utilities::Zip.extract(zip: sources_zip_path, into: content_path)
Dir.glob(File.join(content_path, "*/")).first
end
def build(sources_path, into:)
puts("Building...")
Utilities::SwiftPackageManager.build_fat_release_binary(
path: sources_path,
binary_name: "xcbeautify",
output_directory: into
)
end
def build(sources_path, into:)
puts("Building...")
Utilities::SwiftPackageManager.build_fat_release_binary(
path: sources_path,
binary_name: "xcbeautify",
output_directory: into
)
end
end
end
end

View File

@ -1,12 +0,0 @@
inherit_from: "../../.rubocop.yml"
inherit_gem:
rubocop-rails_config:
- config/rails.yml
AllCops:
Exclude:
- node_modules/**/*
- vendor/**/*
- db/schema.rb
- bin/**/*

View File

@ -33,11 +33,6 @@ group :development do
# gem "rack-mini-profiler", "~> 2.0"
gem "spring"
gem "web-console", ">= 4.1.0"
gem "rubocop", "~> 1.14"
gem "rubocop-rails", "~> 2.10.1"
gem "rubocop-rails_config"
gem "rubocop-shopify", "~> 2.1"
gem "rubocop-rake", "~> 0.5.1"
end
group :test do