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 resolving `inherit_gem` in remote configs #7990

Merged
merged 1 commit into from May 26, 2020

Conversation

@CvX
Copy link
Contributor

CvX commented May 18, 2020

When a file inherits from a url inheriting from a gem, like so:

# .rubocop.yml
inherit_from: http://example.com/default.yml
# http://example.com/default.yml
inherit_gem:
    somegem: default.yml
# somegem's default.yml
Layout/LineLength:
    Max: 48

Rubocop would then incorrectly try to resolve a URL like this:

http://example.com//private/var/folders/69/bjrqv8v1225f7yqnxknm3fb80000gn/T/d20200518-94245-6dqeew/work/gems/somegem/default.yml

With this change, local gem paths are no longer taken by mistake for relative remote paths.


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.
@CvX CvX force-pushed the CvX:inherit-from-url-from-gem branch from 0ae0c20 to f8b62e0 May 18, 2020
@CvX CvX force-pushed the CvX:inherit-from-url-from-gem branch from f8b62e0 to 6c979e8 May 23, 2020
When a file inherits from a url inheriting from a gem, like so:

```yaml
# .rubocop.yml
inherit_from: http://example.com/default.yml
```

```yaml
# http://example.com/default.yml
inherit_gem:
    somegem: default.yml
```

```yaml
# somegem's default.yml
Layout/LineLength:
    Max: 48
```

Rubocop would then incorrectly try to resolve a URL like this:

`http://example.com//private/var/folders/69/bjrqv8v1225f7yqnxknm3fb80000gn/T/d20200518-94245-6dqeew/work/gems/somegem/default.yml`

With this change, local gem paths are no longer taken by mistake for relative remote paths.
@CvX CvX force-pushed the CvX:inherit-from-url-from-gem branch from 6c979e8 to f08165d May 25, 2020
@bbatsov bbatsov merged commit 8f3b950 into rubocop-hq:master May 26, 2020
5 checks passed
5 checks passed
windows 2.4
Details
windows 2.5
Details
windows 2.6
Details
windows 2.7
Details
windows mingw
Details
@bbatsov
Copy link
Collaborator

bbatsov commented May 26, 2020

Thanks!

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

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.