Skip to content
Merged
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
6 changes: 6 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
# This is the configuration used to check the rubocop source code.
# Check out: https://github.com/bbatsov/rubocop

AllCops:
Include:
- '**/Rakefile'
- '**/config.ru'
Exclude:
- 'vendor/**/*'
- 'spec/fixtures/**/*'
- 'node_modules/**/*'
- 'db/**/*'
- 'db/schema.rb'
- 'db/seeds.rb'
- 'client/node_modules/**/*'
- 'bin/**/*'
- !ruby/regexp /old_and_unused\.rb$/

Metrics/LineLength:
Max: 120
Expand Down
205 changes: 205 additions & 0 deletions .scss-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,205 @@
# See http://sass-guidelin.es/#zeros

scss_files:
- 'app/assets/stylesheets/**/*.scss'
- 'client/assets/stylesheets/**/*.scss'

linters:
# BangFormat:
# enabled: true
# space_before_bang: true
# space_after_bang: false
#
# BorderZero:
# enabled: true
# convention: zero # or `none`
#
ColorKeyword:
enabled: false
ColorVariable:
enabled: false
#
# Comment:
# enabled: true
#
# DebugStatement:
# enabled: true
#
# DeclarationOrder:
# enabled: true
#
# DuplicateProperty:
# enabled: true
#
# ElsePlacement:
# enabled: true
# style: same_line # or 'new_line'
#
# EmptyLineBetweenBlocks:
# enabled: true
# ignore_single_line_blocks: true
#
# EmptyRule:
# enabled: true
#
# FinalNewline:
# enabled: true
# present: true
#
HexLength:
enabled: true
style: long

HexNotation:
enabled: true
style: uppercase
#
# HexValidation:
# enabled: true
#
IdSelector:
enabled: true
#
# ImportantRule:
# enabled: true
#
# ImportPath:
# enabled: true
# leading_underscore: false
# filename_extension: false
#
# Indentation:
# enabled: true
# allow_non_nested_indentation: false
# character: space # or 'tab'
# width: 2
#
LeadingZero:
enabled: true
style: include_zero
#
# MergeableSelector:
# enabled: true
# force_nesting: true
#
# NameFormat:
# enabled: true
# allow_leading_underscore: true
# convention: hyphenated_lowercase # or 'camel_case', or 'snake_case', or a regex pattern
#
# NestingDepth:
# enabled: true
# max_depth: 3
#
# PlaceholderInExtend:
# enabled: true
#
# PropertyCount:
# enabled: false
# include_nested: false
# max_properties: 10
#
# PropertyUnits:
# enabled: true
# global: [
# 'ch', 'em', 'ex', 'rem', # Font-relative lengths
# 'cm', 'in', 'mm', 'pc', 'pt', 'px', 'q', # Absolute lengths
# 'vh', 'vw', 'vmin', 'vmax', # Viewport-percentage lengths
# 'deg', 'grad', 'rad', 'turn', # Angle
# 'ms', 's', # Duration
# 'Hz', 'kHz', # Frequency
# 'dpi', 'dpcm', 'dppx', # Resolution
# '%', # Other
# ]
# properties: {}
#
# PropertySortOrder:
# enabled: true
# ignore_unspecified: false
# separate_groups: false
#
# PropertySpelling:
# enabled: true
# extra_properties: []
#
# QualifyingElement:
# enabled: true
# allow_element_with_attribute: false
# allow_element_with_class: false
# allow_element_with_id: false
#
# SelectorDepth:
# enabled: true
# max_depth: 3
#
# SelectorFormat:
# enabled: true
# convention: hyphenated_lowercase # or 'strict_BEM', or 'hyphenated_BEM', or 'snake_case', or 'camel_case', or a regex pattern
#
# Shorthand:
# enabled: true
# allowed_shorthands: [1, 2, 3]
#
# SingleLinePerProperty:
# enabled: true
# allow_single_line_rule_sets: true
#
# SingleLinePerSelector:
# enabled: true
#
# SpaceAfterComma:
# enabled: true
#
# SpaceAfterPropertyColon:
# enabled: true
# style: one_space # or 'no_space', or 'at_least_one_space', or 'aligned'
#
# SpaceAfterPropertyName:
# enabled: true
#
# SpaceBeforeBrace:
# enabled: true
# style: space # or 'new_line'
# allow_single_line_padding: false
#
# SpaceBetweenParens:
# enabled: true
# spaces: 0
#
# StringQuotes:
# enabled: true
# style: single_quotes # or double_quotes
#
# TrailingSemicolon:
# enabled: true
#
# TrailingZero:
# enabled: false
#
# UnnecessaryMantissa:
# enabled: true
#
# UnnecessaryParentReference:
# enabled: true
#
# UrlFormat:
# enabled: true
#
# UrlQuotes:
# enabled: true
#
# VariableForProperty:
# enabled: false
# properties: []
#
# VendorPrefix:
# enabled: true
# identifier_list: base
# additional_identifiers: []
# excluded_identifiers: []
#
# ZeroUnit:
# enabled: true
#
# Compass::*:
# enabled: false
6 changes: 6 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,12 @@ group :development, :test do
gem "rubocop", require: false

gem "ruby-lint", require: false

gem "scss-lint", require: false

gem "brakeman", require: false

gem "bundler-audit", require: false
end

gem "spring-commands-rspec", group: :development
Expand Down
30 changes: 30 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,20 @@ GEM
bootstrap-sass (3.3.4.1)
autoprefixer-rails (>= 5.0.0.1)
sass (>= 3.2.19)
brakeman (3.0.3)
erubis (~> 2.6)
fastercsv (~> 1.5)
haml (>= 3.0, < 5.0)
highline (~> 1.6.20)
multi_json (~> 1.2)
ruby2ruby (~> 2.1.1)
ruby_parser (~> 3.6.2)
sass (~> 3.0)
terminal-table (~> 1.4)
builder (3.2.2)
bundler-audit (0.3.1)
bundler (~> 1.2)
thor (~> 0.18)
byebug (4.0.3)
columnize (= 0.9.0)
capybara (2.4.4)
Expand Down Expand Up @@ -82,10 +95,14 @@ GEM
factory_girl_rails (4.5.0)
factory_girl (~> 4.5.0)
railties (>= 3.0.0)
fastercsv (1.5.5)
foreman (0.78.0)
thor (~> 0.19.1)
globalid (0.3.3)
activesupport (>= 4.1.0)
haml (4.0.6)
tilt
highline (1.6.21)
hike (1.2.3)
i18n (0.7.0)
jbuilder (2.2.12)
Expand Down Expand Up @@ -177,16 +194,25 @@ GEM
parser (~> 2.1, >= 2.1.1)
slop (~> 3.4, >= 3.4.7)
ruby-progressbar (1.7.5)
ruby2ruby (2.1.4)
ruby_parser (~> 3.1)
sexp_processor (~> 4.0)
ruby_parser (3.6.6)
sexp_processor (~> 4.1)
sass (3.4.13)
sass-rails (5.0.1)
railties (>= 4.0.0, < 5.0)
sass (~> 3.1)
sprockets (>= 2.8, < 4.0)
sprockets-rails (>= 2.0, < 4.0)
tilt (~> 1.1)
scss-lint (0.37.0)
rainbow (~> 2.0)
sass (~> 3.4.1)
sdoc (0.4.1)
json (~> 1.7, >= 1.7.7)
rdoc (~> 4.0)
sexp_processor (4.5.1)
slop (3.6.0)
spring (1.3.3)
spring-commands-rspec (1.0.4)
Expand All @@ -201,6 +227,7 @@ GEM
activesupport (>= 3.0)
sprockets (>= 2.8, < 4.0)
sqlite3 (1.3.10)
terminal-table (1.4.5)
thor (0.19.1)
thread_safe (0.3.5)
tilt (1.4.1)
Expand Down Expand Up @@ -229,6 +256,8 @@ PLATFORMS
DEPENDENCIES
autoprefixer-rails
bootstrap-sass (~> 3.3.1)
brakeman
bundler-audit
byebug
capybara
capybara-screenshot
Expand All @@ -248,6 +277,7 @@ DEPENDENCIES
rubocop
ruby-lint
sass-rails
scss-lint
sdoc
spring
spring-commands-rspec
Expand Down
27 changes: 14 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ In no particular order:
- Easily enable use of npm modules with a Rails application.
- Easily enable retrofitting such a JS framework into an existing Rails app.
- Enable the use of the JavaScript ES6 transpiler.
- Example setting up Ruby and ES6 linting in a real project.

# Technologies involved

Expand Down Expand Up @@ -216,18 +217,6 @@ To deploy the app on Heroku:
git push heroku master
```

# Update Node Modules
```
rm npm-shrinkwrap.json
npm-check-updates -u
npm install
npm shrinkwrap
```

Then confirm that the hot reload server and the rails server both work fine. You
may have to delete `node_modules` and `npm-shrinkwrap.json` and then run `npm
shrinkwrap`.

# Running Tests
*Default rake task runs tests and linting*

Expand Down Expand Up @@ -258,14 +247,26 @@ QMAKE=/usr/local/Cellar/qt5/5.4.0/bin/qmake bundle install
Then run `rspec` and you should see the tests have passed.

# Linting and Code Inspection
* Default rake task runs tests and linting (yes, repeating this!)
## Running Lint and CI tasks
* Default rake task runs tests and linting (yes, repeating this!) (see `ci.rake`)
* See file [README.md](client/README.md) for how to run ESLint and JSCS
* See scripts `scripts/lint` and `client/bin/lint`.
* Create a custom scope like this for RubyMine, named "Inspection Scope"

file[react-rails-tutorial]:*/&&!file[react-rails-tutorial]:tmp//*&&!file[react-rails-tutorial]:log//*&&!file[react-rails-tutorial]:client/node_modules//*&&!file[react-rails-tutorial]:client/assets/fonts//*&&!file[react-rails-tutorial]:app/assets/fonts//*&&!file[react-rails-tutorial]:bin//*&&!file[react-rails-tutorial]:app/assets/javascripts//*

* Install the code style and inspection files in [client/jetbrains](client/jetbrains)
* Use the installed inspection settings and new Inspection Scope for code inspection.
* RubyMine configuration is optional. All linters run from the command line.

## Linters
1. [Rubocop](https://github.com/bbatsov/rubocop)
2. [Ruby-Lint](https://github.com/YorickPeterse/ruby-lint)
3. [Eslint](http://eslint.org/)
4. [JSCS](https://github.com/jscs-dev/node-jscs)
5. [scss-lint](https://github.com/brigade/scss-lint)
6. [brakeman](http://brakemanscanner.org/)
7. [bundle-audit](https://github.com/rubysec/bundler-audit)

# Contributors
* [Martin Breining](https://github.com/mbreining)
Expand Down
Loading