Skip to content

Conversation

@ccutrer
Copy link
Contributor

@ccutrer ccutrer commented Oct 9, 2023

What was the end-user or developer problem that led to this PR?

If you changed a man page, it was force-feeding that to rubocop when committing, and it would fail every line as unparseable.

What is your fix for the problem, implemented in this PR?

Add the rubocop flag that tells it to apply file-type filters to the list of files passed on the command line.

Make sure the following tasks are checked

if you changed a man page, it was force-feeding that to rubocop,
and it would fail every line as unparseable
# Run rubocop hook only when analyzable files are present
if [[ $length -ne 0 ]]; then
./bin/rubocop $files
./bin/rubocop --only-recognized-file-types $files
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this go directly into bin/rubocop? I'm not sure I'd ever want to run rubocop on an unrecognized file.

@ccutrer
Copy link
Contributor Author

ccutrer commented Oct 10, 2023

At that point... why does Rubocop allow it at all?? To be clear, if you provide no files on the command line, or directories, then rubocop will only include files that match its include config. It's only if a file is explicitly named will rubocop ignore the config and always process it. Which is why the precommit hook is doing.

@martinemde
Copy link
Contributor

Good point, haha. Fixing it here makes sense then.

@martinemde martinemde merged commit 7ac275c into ruby:master Oct 10, 2023
@martinemde
Copy link
Contributor

The test failure is the windows segfault. I'm ignoring that for now since it's happening on master too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants