0.01
The project is in a healthy, maintained state
RuboCop plugin for Slim template.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Runtime

>= 1.72.1
~> 0.7
 Project Readme

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