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

Replace rubocop configuration to comply with latest version of the gem #9

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
15 changes: 14 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -266,12 +266,24 @@ Default whitelist is:

Best solution would be integrating check script to dev pipeline's CI/CD.

# Rubocop

Rubocop is a linter for ruby. It can be extended for Ruby on Rails using the gem rubocop-rails. Add the following lines in your Gemfile to begin using Rubocop.

```ruby
group :development do
gem 'rubocop', '~> 0.79.0'
gem 'rubocop-rails', '~> 2.4', '>= 2.4.2'
end
```

A configuration file compliant with those versions can be found in the `config_files` directory.

# To-dos

List here all the section and stuff you would like or wish someone could to talk about in a next PR

* moduloTech gem
* Rubocop and rubocop-rails
* CI/CD
* use [Licensed](https://github.com/github/licensed) script to check new/updated dependencies' licenses
* use rubocop as part of CI pipeline
Expand All @@ -282,6 +294,7 @@ List here all the section and stuff you would like or wish someone could to talk

# Changes
* ...
* ciappa_m - Add section about Rubocop
* philib_j - Added information about r.sh
* varaby_m - Add section about dependencies' licenses
* ciappa_m - Add a section about commit messages
Expand Down
23 changes: 16 additions & 7 deletions config_files/.rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
require: 'rubocop-rails'
# Enabling Rails-specific cops
require: rubocop-rails

AllCops:

# Excluding most directories with generated files and directories with configuration files
Exclude:
- 'vendor/**/*'
- 'db/*'
Expand All @@ -20,9 +23,7 @@ AllCops:
- 'spec/spec_helper.rb'
- 'node_modules/**/*'

Rails:
Enabled: true

# Instructing rubocop about all non-standard environments
Rails/UnknownEnv:
Environments:
- production
Expand All @@ -31,7 +32,7 @@ Rails/UnknownEnv:
- staging

# Commonly used screens these days easily fit more than 80 characters.
Metrics/LineLength:
Layout/LineLength:
Max: 100
Exclude:
- 'config/*'
Expand All @@ -55,7 +56,7 @@ Style/SymbolArray:
Enabled: true

# Most readable form.
Layout/AlignHash:
Layout/HashAlignment:
EnforcedHashRocketStyle: table
EnforcedColonStyle: table

Expand All @@ -71,6 +72,10 @@ Style/PreferredHashMethods:
Style/FormatString:
EnforcedStyle: percent

# Annotated or template are too verbose and rarely needed.
Style/FormatStringToken:
EnforcedStyle: unannotated

Style/CollectionMethods:
Enabled: true
PreferredMethods:
Expand Down Expand Up @@ -104,7 +109,7 @@ Style/SignalException:
# Suppressing exceptions can be perfectly fine, and be it to avoid to
# explicitly type nil into the rescue since that's what you want to return,
# or suppressing LoadError for optional dependencies
Lint/HandleExceptions:
Lint/SuppressedException:
Enabled: false

# { ... } for multi-line blocks is okay, follow Weirichs rule instead:
Expand Down Expand Up @@ -212,3 +217,7 @@ Style/PercentLiteralDelimiters:
Rails/Output:
Exclude:
- 'config/deploy.rb'

# It brings pain for no real benefits
Metrics/ModuleLength:
Enabled: false