No commit activity in last 3 years
No release in over 3 years
RuboCop plugin to check for unsafe integer parsings. A plugin for the RuboCop code style enforcing & linting tool.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0
>= 0

Runtime

>= 0.49.0
 Project Readme

RuboCop ParseInt

RuboCop plugin to check for unsafe integer parsings

This plugin is composed of:

  • Lint/KernelIntegerWithoutBase
  • Lint/StringToInt (See the 'Note' section below)

Installation

Just install the rubocop-parse_int gem

gem install rubocop-parse_int

or if you use bundler plt this in your Gemfile

gem 'rubocop-parse_int'

Usage

RuboCop configuration file

Put this into your .rubocop.yml.

require: rubocop-parse_int

Now you can run rubocop and it will automatically load the RuboCop ParseInt cops together with the standard cops.

Command line

rubocop --require rubocop-parse_int

Rake task

RuboCop::RakeTask.new do |task|
  task.requires << 'rubocop-parse_int'
end

Note

Currently, Lint/StringToInt responds to calls to #to_i on a non-String variable too.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/hashedhyphen/rubocop-parse_int.

License

The gem is available as open source under the terms of the MIT License.