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

Dealing with Gemfile.lock #618

Closed
whysthatso opened this issue Mar 15, 2024 · 7 comments
Closed

Dealing with Gemfile.lock #618

whysthatso opened this issue Mar 15, 2024 · 7 comments

Comments

@whysthatso
Copy link

I think i am missing something about how to set up my linting/syntax checking, but for some reason in all my ruby projects, i get this error on the Gemfile.lock:

unexpected token tCOLON
(Using Ruby 3.3 parser; configure using `TargetRubyVersion` parameter, under `AllCops`)

this is the part in question:

  remote: https://rubygems.org/

Context:

GEM
  remote: https://rubygems.org/
  specs:

Should the file just be ignored, or what is exactly wrong here?

@searls
Copy link
Contributor

searls commented Mar 15, 2024

The Gemfile.lock is not listed by default, and no default globs should be catching it. How are you running standard and what's in your .standard.yml file, if you have one?

@whysthatso
Copy link
Author

whysthatso commented Mar 15, 2024

so this is:

  • vscodium/vscode 1.87.2
  • testdouble.vscode-standard-ruby 0.0.16,
  • standardrb 1.35.1 via bundler inside asdf
  • linux

default config, no .standard.yml file

@whysthatso
Copy link
Author

okay, i added a simple .standard.yml file, but that does not seem to be honored.

ruby_version: 3.3
ignore:
  - Gemfile.lock
  - tmp/**/*
  - test/fixture/**/*

@whysthatso
Copy link
Author

sometimes there is a weird conflict about extensions when one has multiple sections in a workspace, but i've just opened the plain folder inside a simple vscodium instance (open vscode > open folder), and it's the same problem.

@whysthatso
Copy link
Author

hang on, just to be very clear:

Gemfile.lock is not being ignored by default, right?

Reference:

https://github.com/rubocop/rubocop/blob/v0.61.1/config/default.yml#L60-L63

If it is correct, why? What is the value in linting the Gemfile? And why does it create above mentioned error?

@searls
Copy link
Contributor

searls commented May 22, 2024

Gemfile.lock is not included in any of the default globs in RuboCop or Standard Ruby, so whatever is causing your issue must be configuration.

To show a trivial example, given this folder with two files that are both non-compliant in the same way, only the rb file raises a violation:

$ tree .
.
├── Gemfile.lock
└── bar.rb

1 directory, 2 files

$ cat bar.rb 
puts 's'
$ cat Gemfile.lock 
puts 's'
$ standardrb
standard: Use Ruby Standard Style (https://github.com/standardrb/standard)
  bar.rb:1:6: Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
standard: Run `standardrb --fix` to potentially fix one problem.

@searls searls closed this as completed May 22, 2024
@djchadderton
Copy link

I get the same for Gemfile.lock, i.e. this in VSCode:

unexpected token tCOLON
(Using Ruby 3.3 parser; configure using `TargetRubyVersion` parameter, under `AllCops`) (fatal:Lint/Syntax)

The first colon in remote: https://rubygems.org/ at the top of the file is marked as the source of the error.

I'm using the official StandardRB VSCode extension, and I have the following in .rubocop.yml:

require: standard

inherit_gem:
  standard: config/base.yml
AllCops:
  TargetRubyVersion: 3.3.1

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

No branches or pull requests

3 participants