Solargraph version: 0.40.0
Hi guys,
I was not able to format my Gemfile which had some offenses related to Bundler cop: https://docs.rubocop.org/rubocop/cops_bundler.html
After some investigation I found that Solargraph tried to create a new tempfile using following command:
tempfile = File.join(File.dirname(filename), "_tmp_#{SecureRandom.hex(8)}_#{File.basename(filename)}.rb")
If my file is Gemfile, the filename will be ....Gemfile.rb which wasn't satisfy the default include glob pattern of Bundler cop:

Here is example Gemfile which has Bundler/OrderedGems offense:
# frozen_string_literal: true
source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
ruby '2.6.6'
gem 'active_model_serializers', '~> 0.10.12'
gem 'aws-sdk-s3', '~> 1'
gem 'be_azure_cognitiveservices_face', '~> 0.19.6'
gem 'bootsnap', '>= 1.4.2', require: false
gem 'elasticsearch-model', '~> 7.1.1'
gem 'elasticsearch-rails', '~> 7.1.1'
gem 'firebase_id_token', '~> 2.4.0'
gem 'haml'
gem 'logdna', '~> 1.4'
gem 'pg', '>= 0.18', '< 2.0'
gem 'pry-byebug'
gem 'pry-rails', '~> 0.3.4'
gem 'puma', '~> 5.1'
gem 'rack-cors', '~> 1.1'
gem 'rails', '~> 6.0.3'
gem 'redis', '~> 4.2'
gem 'remote_syslog_logger'
gem 'rubocop', require: false
gem 'rubocop-rails', require: false
gem 'sentry-raven', '~> 3.1'
gem 'sidekiq', '~> 6.1'
gem 'sidekiq-unique-jobs'
gem 'sinatra', require: nil
gem 'whenever'
gem 'will_paginate', '~> 3.3.0'
gem 'yaml_db', '~> 0.7.0'
group :development, :test do
gem 'byebug', platforms: %i[mri mingw x64_mingw]
gem 'dotenv-rails'
gem 'factory_bot_rails'
gem 'faker'
gem 'rspec-rails', '~> 4.0.1'
end
group :development do
gem 'listen', '>= 3.0.5', '< 3.4'
gem 'spring'
gem 'spring-watcher-listen', '~> 2.0.0'
end
group :test do
gem 'webmock'
end
gem 'tzinfo-data', platforms: %i[mingw mswin x64_mingw jruby]
gem 'solargraph', group: :development
There's a fix for this in the master branch. It'll be published in the next release.
Thank you!
Released in v0.40.1.
Most helpful comment
Released in v0.40.1.