No release in over a year
RuboCop plugin for Ruby code blocks in Markdown.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

 Project Readme

rubocop-markdown

RuboCop plugin for Ruby code blocks in Markdown.

Installation

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

bundle add rubocop-markdown

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

gem install rubocop-markdown

Usage

Require rubocop-markdown in your RuboCop config.

# .rubocop.yml
require:
  - rubocop-markdown

Now you can use RuboCop also for Ruby code block in Markdown.

$ bundle exec rubocop README.md
Inspecting 1 file
W

Offenses:

README.md:69:6: C: [Correctable] Style/NumericPredicate: Use array.size.positive? instead of array.size > 0.
a if array.size > 0
     ^^^^^^^^^^^^^^
README.md:69:6: C: [Correctable] Style/ZeroLengthPredicate: Use !empty? instead of size > 0.
a if array.size > 0
     ^^^^^^^^^^^^^^
README.md:57:1: W: Lint/Void: Literal "a" used in void context.
"a"
^^^
README.md:57:1: C: [Correctable] Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.
"a"
^^^
README.md:59:1: C: [Correctable] Style/CharacterLiteral: Do not use the character literal - use string literal instead.
?c
^^

1 file inspected, 5 offenses detected, 4 offenses autocorrectable
# Ruby code block.
"a"
b
?c
# Not Ruby code block.
"a"
# Ruby code block.
a if array.size > 0

Related projects