Project

rubocopfmt

0.0
Repository is archived
No commit activity in last 3 years
No release in over 3 years
Easy formatting of Ruby code using RuboCop
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.13
>= 0
~> 12.0
~> 3.0

Runtime

~> 3.1.0
!= 0.41.0, != 0.44.0, < 0.57, >= 0.38.0
~> 2.1.0
 Project Readme

rubocopfmt Gem Version Build Status

DEPRECATED!

This project is no longer maintained. My focus has shifted towards rubocopfmt.el for Emacs. There are no plans to support for other editors at this time.


Easy formatting of Ruby code using RuboCop. Analogous to gofmt.

Currently the main focus is to provide a simple way to format Ruby code on save in various editors. As such the feature set is very minimal for the time being.

Installation

gem install rubocopfmt --pre

Usage

Usage: rubocopfmt [options] [path ...]

Reads from STDIN if no path is given.

Options:
  -d, --diff               Display diffs instead of rewriting files
  -l, --list               List files whose formatting is incorrect
  -w, --write              Write result to (source) file instead of STDOUT
  -i, --interactive        Disable cops that cause confusion in text editors
  -F, --src-file=<s>       Specify filename when providing input via STDIN
  -D, --diff-format=<s>    Display diffs using format: unified, rcs, context

  -v, --version            Print version and exit
  -h, --help               Show this message

Configure

Please refer to RuboCop's Documentation.

Editor Integration

Interactive Mode

When called from an editor on save, there's a few of Cops that causes confusion when run against half-finished code. Interactive mode disables those cops and should be used by all editor plugins.

Cops disabled in Interactive mode:

  • Lint/Debugger: Removes debugger statements. Not helpful when you need to debug something.
  • Lint/UnusedBlockArgument: Don't prefix unused block variable names with _. This causes issues if you save after defining a block, but before you use all arguments of the block.
  • Lint/UnusedMethodArgument: Don't prefix unused method variable names with _. This causes issues if you save after defining a method, but before you use all arguments of the method.

License

(The MIT license)

Copyright (c) 2017 Jim Myhrberg.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.