Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sort analyzed file alphabetically #7181

Merged
merged 1 commit into from
Jun 28, 2019
Merged

Sort analyzed file alphabetically #7181

merged 1 commit into from
Jun 28, 2019

Conversation

pocke
Copy link
Collaborator

@pocke pocke commented Jun 27, 2019

The order of files that RuboCop analyzes is not fixed. Because RuboCop uses Dir.glob and the order of the Dir.glob is not fixed.

Note that the pattern is not a regexp, it’s closer to a shell glob. See File.fnmatch for the meaning of the flags parameter. Case sensitivity depends on your system (File::FNM_CASEFOLD is ignored), as does the order in which the results are returned.
http://ruby-doc.org/core-2.6.3/Dir.html#method-c-glob

It is not a bug, but it confused me while debugging the regression test. pocke/rubocop-regression-test#12

I think sorted files is better than randomized. It will be easier to debug because everyone gets the same output by RuboCop.


Before submitting the PR make sure the following are checked:

  • Wrote good commit messages.
  • Commit message starts with [Fix #issue-number] (if the related issue exists).
  • Feature branch is up-to-date with master (if not - rebase it).
  • Squashed related commits together.
  • Added tests.
  • Added an entry to the Changelog if the new code introduces user-observable changes. See changelog entry format.
  • The PR relates to only one subject with a clear title
    and description in grammatically correct, complete sentences.
  • Run bundle exec rake default. It executes all tests and RuboCop for itself, and generates the documentation.

Copy link
Member

@koic koic left a comment

Choose a reason for hiding this comment

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

Looks like it makes sense to me 👍

@bbatsov
Copy link
Collaborator

bbatsov commented Jun 28, 2019

I also like the suggested change.

@pocke
Copy link
Collaborator Author

pocke commented Jun 28, 2019

Thank you for reviewing! I'll merge it after resolving the conflict.

@pocke pocke merged commit ebb8990 into rubocop:master Jun 28, 2019
@pocke pocke deleted the sort-files branch June 28, 2019 16:58
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.

None yet

3 participants