Skip to content

Commit 586e13a

Browse files
authored
fix(ruby): use rubyfmt instead of rubocop (#3334)
1 parent 3c57326 commit 586e13a

File tree

11 files changed

+18
-458
lines changed

11 files changed

+18
-458
lines changed

.github/actions/setup/action.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,15 @@ runs:
170170
ruby-version: ${{ steps.versions.outputs.RUBY_VERSION }}
171171
bundler-cache: true
172172

173+
- name: Install Ruby formatter
174+
if: ${{ inputs.language == 'ruby' }}
175+
shell: bash
176+
run: |
177+
curl --retry 3 -L https://github.com/fables-tales/rubyfmt/releases/download/v0.10.0/rubyfmt-v0.10.0-Linux-x86_64.tar.gz > rubyfmt.tar.gz
178+
tar -xzf rubyfmt.tar.gz
179+
mv tmp/releases/v0.10.0-Linux/rubyfmt /usr/local/bin
180+
rm -rf rubyfmt.tar.gz tmp
181+
173182
# Csharp
174183
- name: Install dotnet
175184
if: ${{ inputs.language == 'csharp' }}

clients/algoliasearch-client-ruby/.rubocop.yml

Lines changed: 0 additions & 99 deletions
This file was deleted.
Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
require 'bundler/gem_tasks'
2-
require 'rubocop/rake_task'
32

43
task(:default) { system 'rake --tasks' }
54

6-
RuboCop::RakeTask.new

clients/algoliasearch-client-ruby/algolia.gemspec

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,4 @@ Gem::Specification.new do |s|
3131

3232
s.add_development_dependency 'bundler'
3333
s.add_development_dependency 'rake'
34-
s.add_development_dependency 'rubocop'
3534
end

config/generation.config.mjs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,6 @@ export const patterns = [
118118

119119
// Ruby
120120
'!snippets/ruby/Gemfile',
121-
'!snippets/ruby/.rubocop.yml',
122121
'!clients/algoliasearch-client-ruby/**',
123122
'clients/algoliasearch-client-ruby/Gemfile.lock',
124123
'clients/algoliasearch-client-ruby/lib/algolia/**',
@@ -130,6 +129,8 @@ export const patterns = [
130129
'!clients/algoliasearch-client-ruby/lib/algolia/user_agent.rb',
131130
'!clients/algoliasearch-client-ruby/lib/algolia/transport/**',
132131

132+
'tests/output/ruby/Gemfile.lock',
133+
133134
// Scala
134135
'!snippets/scala/**',
135136
'snippets/scala/src/**',

scripts/docker/Dockerfile.ruby

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
ARG RUBY_VERSION
22
FROM ruby:${RUBY_VERSION}-bullseye
33

4+
ADD https://github.com/fables-tales/rubyfmt/releases/download/v0.10.0/rubyfmt-v0.10.0-Linux-aarch64.tar.gz rubyfmt.tar.gz
5+
RUN tar -xzf rubyfmt.tar.gz && \
6+
mv tmp/releases/v0.10.0-Linux/rubyfmt /usr/local/bin && \
7+
rm -rf rubyfmt.tar.gz tmp
8+
49
WORKDIR /app

scripts/formatter.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ export async function formatter(language: string, cwd: string): Promise<void> {
5959
);
6060
break;
6161
case 'ruby':
62-
await run('bundle install && bundle exec rubocop -a --fail-level W', { cwd, language });
62+
await run('bundle install', { cwd, language });
63+
await run('rubyfmt -i -- .', { cwd, language });
6364
break;
6465
case 'scala':
6566
await run('sbt -Dsbt.server.forcestart=true scalafmtAll scalafmtSbt', { cwd, language });

snippets/ruby/.rubocop.yml

Lines changed: 0 additions & 176 deletions
This file was deleted.

snippets/ruby/Gemfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,3 @@ source 'https://rubygems.org'
55
gem 'algolia', path: '../../clients/algoliasearch-client-ruby'
66
gem 'dotenv'
77
gem 'rake'
8-
gem 'rubocop'

0 commit comments

Comments
 (0)