Skip to content

Commit 1fce009

Browse files
authored
Allow linting subset of files with bin/lint and fix deprecation errors (#4852)
1 parent 5538cc5 commit 1fce009

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed
File renamed without changes.

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ Before submitting a pull request, run all tests and lints. Fix any broken tests
221221
- Once your first PR has been merged, all commits pushed to an open PR will also run these workflows.
222222
223223
#### Local testing
224-
- Run all lints with `bin/lint`.
224+
- Run all lints with `bin/lint`. (You can lint a single file/folder with `bin/lint {path_to_folder_or_file}`.)
225225
- Run all tests with `bundle exec rspec`
226226
- You can run a single test with `bundle exec rspec {path_to_test_name}_spec.rb` or on a specific line by appending `:LineNumber`
227227
- 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.

bin/lint

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,16 @@
11
#!/bin/bash
22

3-
bundle exec rubocop -A
4-
bundle exec erblint --lint-all -a
3+
# Note: Any arguments passed in will be passed along to rubocop or erb_lint
4+
#
5+
# Example to only lint Rails models:
6+
# $ bin/lint app/models
7+
#
8+
echo "Running rubocop"
9+
bundle exec rubocop -A $@
10+
11+
echo "Running erb_lint"
12+
if [ $# -eq 0 ]; then # If no arguments are supplied check all files
13+
bundle exec erb_lint --lint-all -a
14+
else # otherwise pass those arguments along (likely a specific file or folder)
15+
bundle exec erb_lint $@ -a
16+
fi

0 commit comments

Comments
 (0)