diff --git a/.erb-lint.yml b/.erb_lint.yml similarity index 100% rename from .erb-lint.yml rename to .erb_lint.yml diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 92a9a83624..3b9dcd0f8f 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -221,7 +221,7 @@ Before submitting a pull request, run all tests and lints. Fix any broken tests - Once your first PR has been merged, all commits pushed to an open PR will also run these workflows. #### Local testing -- Run all lints with `bin/lint`. +- Run all lints with `bin/lint`. (You can lint a single file/folder with `bin/lint {path_to_folder_or_file}`.) - Run all tests with `bundle exec rspec` - You can run a single test with `bundle exec rspec {path_to_test_name}_spec.rb` or on a specific line by appending `:LineNumber` - If you need to skip a failing test, place `pending("Reason you are skipping the test")` into the `it` block rather than skipping with `xit`. This will allow rspec to deliver the error message without causing the test suite to fail. diff --git a/bin/lint b/bin/lint index fa2178887a..daed34265e 100755 --- a/bin/lint +++ b/bin/lint @@ -1,4 +1,16 @@ #!/bin/bash -bundle exec rubocop -A -bundle exec erblint --lint-all -a +# Note: Any arguments passed in will be passed along to rubocop or erb_lint +# +# Example to only lint Rails models: +# $ bin/lint app/models +# +echo "Running rubocop" +bundle exec rubocop -A $@ + +echo "Running erb_lint" +if [ $# -eq 0 ]; then # If no arguments are supplied check all files + bundle exec erb_lint --lint-all -a +else # otherwise pass those arguments along (likely a specific file or folder) + bundle exec erb_lint $@ -a +fi