-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Set up Rubocop for the template (#320)
* Setup rubocop and fix warnings * Add template rubocop script * Fix rubocop warnings and adjust rubocop config * wip * Fix failed tests * Update readme * Revert workflow trigger * Update readme * Update target ruby version to 3 * Update readme
- Loading branch information
Showing
22 changed files
with
191 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
--- | ||
BUNDLE_GEMFILE: ".template/Gemfile" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
name: Test Template | ||
|
||
on: push | ||
|
||
env: | ||
RUBY_VERSION: 3.0.1 | ||
|
||
jobs: | ||
test: | ||
name: Test template | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Cancel previous runs | ||
uses: styfle/[email protected] | ||
with: | ||
access_token: ${{ github.token }} | ||
|
||
- name: Checkout Repository | ||
uses: actions/[email protected] | ||
|
||
- name: Setup Ruby | ||
uses: ruby/setup-ruby@v1 | ||
with: | ||
ruby-version: ${{ env.RUBY_VERSION }} | ||
bundler-cache: true | ||
|
||
- name: Cache gems | ||
uses: actions/cache@v2 | ||
with: | ||
path: vendor/bundle | ||
key: ${{ runner.os }}-template-${{ env.RUBY_VERSION }}-${{ hashFiles('**/Gemfile.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-template-${{ env.RUBY_VERSION }}- | ||
- name: Install gems | ||
run: | | ||
bundle config path vendor/bundle | ||
bundle install --jobs 4 --retry 3 | ||
- name: Run RuboCop | ||
run: bundle exec rubocop --config .template/.rubocop.yml --parallel |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
AllCops: | ||
NewCops: enable | ||
TargetRubyVersion: 3 | ||
Exclude: | ||
- 'vendor/**/*' | ||
|
||
Lint/NonDeterministicRequireOrder: | ||
Exclude: | ||
- '../spec/rails_helper.rb' | ||
|
||
Metrics/MethodLength: | ||
Exclude: | ||
- '../template.rb' | ||
- '**/template.rb' | ||
- 'hooks/**/*' | ||
|
||
Metrics/AbcSize: | ||
Enabled: false | ||
|
||
Metrics/BlockLength: | ||
Enabled: false | ||
|
||
Metrics/CyclomaticComplexity: | ||
Exclude: | ||
- '../template.rb' | ||
- '**/template.rb' | ||
|
||
Metrics/PerceivedComplexity: | ||
Exclude: | ||
- '../template.rb' | ||
- '**/template.rb' | ||
|
||
Naming/FileName: | ||
Enabled: false | ||
|
||
Style/Documentation: | ||
Enabled: false | ||
|
||
Style/FrozenStringLiteralComment: | ||
Enabled: false | ||
|
||
# TODO: Enable this rule later | ||
Style/GlobalVars: | ||
Enabled: false | ||
|
||
# TODO: Enable this rule later | ||
Style/RegexpLiteral: | ||
Enabled: false | ||
|
||
Style/TrivialAccessors: | ||
Exclude: | ||
- '../template.rb' | ||
- '**/template.rb' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
source 'https://rubygems.org' | ||
|
||
gem 'docker-api' # A lightweight Ruby client for the Docker Remote API | ||
gem 'rspec' # BDD for Ruby | ||
gem 'rspec-wait' # Wait for conditions in RSpec | ||
gem 'rubocop', require: false # A Ruby static code analyzer and formatter, based on the community Ruby style guide. | ||
gem 'serverspec' # RSpec tests for your servers | ||
gem 'docker-api' # A lightweight Ruby client for the Docker Remote API |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
after_bundle do | ||
use_source_path __dir__ | ||
|
||
copy_file '.phraseapp.yml' | ||
apply 'spec/template.rb' | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/usr/bin/env bash | ||
|
||
bundle exec rubocop --config .template/.rubocop.yml $@ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
# rubocop:todo Style/ClassAndModuleChildren | ||
class Template::Errors < Template::Messages; end | ||
# rubocop:enable Style/ClassAndModuleChildren |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
.template/spec/base/app/controllers/concerns/localization_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
append_to_file '.gitignore' do | ||
<<~IGNORE | ||
# Ignore i18n.js generated files | ||
# If deploy to heroku with git, please remove this as it prevents the files to be committed | ||
/app/javascript/translations/* | ||
# Ignore i18n.js generated files | ||
# If deploy to heroku with git, please remove this as it prevents the files to be committed | ||
/app/javascript/translations/* | ||
# Ignore asset builds | ||
/app/assets/builds/* | ||
# Ignore asset builds | ||
/app/assets/builds/* | ||
# Ignore Node dependencies | ||
/node_modules | ||
# Ignore Node dependencies | ||
/node_modules | ||
IGNORE | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.