Thanks to visit codestin.com
Credit goes to github.com

Skip to content

RuboCop plugin for Slim template.

License

Notifications You must be signed in to change notification settings

r7kamura/rubocop-slim

Repository files navigation

rubocop-slim

test

RuboCop plugin for Slim template.

Installation

Install the gem and add to the application's Gemfile by executing:

bundle add rubocop-slim

If bundler is not being used to manage dependencies, install the gem by executing:

gem install rubocop-slim

Usage

Add rubocop-slim to plugins.

# .rubocop.yml
plugins:
  - rubocop-slim

Now you can use RuboCop also for Slim templates.

$ bundle exec rubocop spec/fixtures/dummy.slim
Inspecting 1 file
C

Offenses:

spec/fixtures/dummy.slim:1:3: C: [Correctable] Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.
- "a"
  ^^^
spec/fixtures/dummy.slim:3:5: C: [Correctable] Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.
| #{"c"}
    ^^^
spec/fixtures/dummy.slim:5:8: C: [Correctable] Style/ZeroLengthPredicate: Use !empty? instead of size > 0.
- a if array.size > 0
       ^^^^^^^^^^^^^^
spec/fixtures/dummy.slim:6:3: C: [Correctable] Style/NegatedIf: Favor unless over if for negative conditions.
- a if !b
  ^^^^^^^
spec/fixtures/dummy.slim:8:6: C: [Correctable] Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.
- if "a"
     ^^^

1 file inspected, 5 offenses detected, 5 offenses autocorrectable

Related projects

About

RuboCop plugin for Slim template.

Resources

License

Code of conduct

Stars

Watchers

Forks

Sponsor this project