Coder Social home page Coder Social logo

pocke / dont_comment Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 0.0 35 KB

Do not comment out unused code, use version control system instead and remove it!

Home Page: https://rubygems.org/gems/dont_comment

License: Apache License 2.0

Ruby 98.88% Shell 1.12%

dont_comment's Introduction

DontComment

Gem Version Build Status

Do not comment out unused code, use version control system instead and remove it!

What's this?

If you use version control system, you must not comment out unused code.

For example, you can remove the old implementation in the following code.

# def some_method
#   puts 'an old implementation'
# end

def some_method
  puts 'a new implementation'
end

This tool detects this problem.

Detect comment outs for debug

class ExampleController < ApplicationController
  # before_action :validate_foobar
end

Sometime we comment out validation or something for debug. If we forget to restore the comment before we commit the change, it will be a serious bug.

We can avoid the bug by this tool.

False positives

Maybe, This tools will make many false positives. I design this tools to use with a pull-request. Do not use use this tool for all ruby files in your repository. It probably will not be useful.

Installation

Add this line to your application's Gemfile:

gem 'dont_comment'

And then execute:

$ bundle

Or install it yourself as:

$ gem install dont_comment

Requirements

  • Ruby 2.4 or higher

Usage

$ dont_comment some/ruby/file/path.rb
some/ruby/file/path.rb:3: Do not comment out unused code, use version control system instead and remove it!
some/ruby/file/path.rb:7: Do not comment out unused code, use version control system instead and remove it!

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/pocke/dont_comment.

dont_comment's People

Contributors

pocke avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

dont_comment's Issues

Ignore URL

# https://example.com

Maybe it is not a ruby code.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.