Skip to content

minitest/minitest-lint

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

minitest-lint

home

github.com/zenspider/minitest-lint

rdoc

docs.seattlerb.org/minitest-lint

DESCRIPTION:

Lint your minitest assertions.

FEATURES/PROBLEMS:

  • Scans assertions for common patterns.

  • Provides multiple rewrites until it can’t be improved anymore.

  • Uses pattern matching to be as flexible as possible.

  • TODO: still needs a lot more added to it. This is just the beginning.

SYNOPSIS:

% mt_lint my_test.rb

my_test.rb:10:
  assert(([1, 2, 3].include?(b) == true), "is b in 1..3?") # original
  assert_operator([1, 2, 3].include?(b), :==, true) # assert_operator obj, :msg, val
  assert_equal([1, 2, 3].include?(b), true)         # assert_equal exp, act
  assert_equal(true, [1, 2, 3].include?(b))         # assert_equal lit, act
  assert_operator([1, 2, 3], :include?, b)          # assert_operator obj, :msg, val
  assert_includes([1, 2, 3], b)                     # assert_includes obj, val

my_test.rb:20:
  [1, 2, 3].include?(b).must_equal(true) # original
  _([1, 2, 3].include?(b)).must_equal(true) # _(obj).must_<something> val
  _([1, 2, 3]).must_be(:include?, b)        # _(obj).must_be :msg, val
  _([1, 2, 3]).must_include(b)              # _(obj).must_include val

REQUIREMENTS:

  • ruby_parser

  • ruby2ruby

  • path_expander

  • sexp_processor

  • graph

  • minitest (duh)

INSTALL:

  • sudo

    gem install minitest-lint

LICENSE:

(The MIT License)

Copyright © Ryan Davis, seattle.rb

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.

Releases

No releases published

Packages

No packages published

Languages