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

[Fix #10204] Add new Lint/UnsafeGlobalVariables cop #10211

Closed
wants to merge 1 commit into from
Closed

[Fix #10204] Add new Lint/UnsafeGlobalVariables cop #10211

wants to merge 1 commit into from

Conversation

dmarcoux
Copy link

@dmarcoux dmarcoux commented Oct 25, 2021

This cop looks for uses of unsafe global variables.

Since this is my first contribution, I've based this cop on Style/GlobalVars to follow coding conventions as best as possible. I'm unsure if it makes sense to introduce a new cop for this, since Style/GlobalVars is quite similar.

Fixes #10204


Before submitting the PR make sure the following are checked:

  • The PR relates to only one subject with a clear title and description in grammatically correct, complete sentences.
  • 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.
  • Ran bundle exec rake default. It executes all tests and runs RuboCop on its own code.
  • Added an entry (file) to the changelog folder named {change_type}_{change_description}.md if the new code introduces user-observable changes. See changelog entry format for details.

@dmarcoux
Copy link
Author

I don't really understand why ci/circleci: ruby-head-ascii_spec and ci/circleci: ruby-head-spec are failing. Could someone help me out with this?

@koic
Copy link
Member

koic commented Oct 26, 2021

I don't really understand why ci/circleci: ruby-head-ascii_spec and ci/circleci: ruby-head-spec are failing. Could someone help me out with this?

These CI matrices have been resolved by #10213. Can you rebase with the latest master branch?

@bbatsov
Copy link
Collaborator

bbatsov commented Mar 9, 2022

I'm unsure if it makes sense to introduce a new cop for this, since Style/GlobalVars is quite similar.

Yeah, that's a good point. Perhaps this can be a feature of the other cop controlled by a boolean flag. One more thing - we should clearly document what "unsafe" means exactly.

@dmarcoux
Copy link
Author

Thank you @bbatsov for the feedback. I don't have time to work on this now and in the foreseeable future though. Anybody can pick this up where I left it.

@bbatsov
Copy link
Collaborator

bbatsov commented Mar 11, 2022

No rush.

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

Successfully merging this pull request may close these issues.

Introduce cop to warn against usage of $! and $@.
3 participants