From 5891729691810f87844b9a39457651a8ec7ead54 Mon Sep 17 00:00:00 2001 From: Zsolt Tasnadi Date: Wed, 6 May 2026 20:15:52 +0200 Subject: [PATCH] rubocop --- .claude/settings.local.json | 5 +++- .gitignore | 2 +- apps/api/.rubocop.yml | 12 +++++++++ apps/api/Gemfile | 1 + apps/api/Gemfile.lock | 46 +++++++++++++++++++++++++++++++++ apps/api/app/admin/members.rb | 6 ++--- apps/api/app/admin/releases.rb | 2 +- apps/api/app/admin/softwares.rb | 10 +++---- 8 files changed, 73 insertions(+), 11 deletions(-) create mode 100644 apps/api/.rubocop.yml diff --git a/.claude/settings.local.json b/.claude/settings.local.json index 2a9518e..dabab47 100644 --- a/.claude/settings.local.json +++ b/.claude/settings.local.json @@ -13,7 +13,10 @@ "Bash(npx vite *)", "Bash(xargs ls -la)", "Bash(xargs ls)", - "WebFetch(domain:teletypegames.org)" + "WebFetch(domain:teletypegames.org)", + "Bash(bundle install *)", + "Bash(ruby *)", + "Bash(bundle exec *)" ] } } diff --git a/.gitignore b/.gitignore index a5cd653..327d55e 100644 --- a/.gitignore +++ b/.gitignore @@ -6,4 +6,4 @@ pma-config.user.inc.php data apps/frontend/src/events.yaml NOTES_* - +.claude diff --git a/apps/api/.rubocop.yml b/apps/api/.rubocop.yml new file mode 100644 index 0000000..18b943b --- /dev/null +++ b/apps/api/.rubocop.yml @@ -0,0 +1,12 @@ +inherit_gem: + rubocop-rails-omakase: rubocop.yml + +AllCops: + NewCops: enable + TargetRubyVersion: 3.2 + Exclude: + - "bin/**/*" + - "db/**/*" + - "config/**/*" + - "vendor/**/*" + - "node_modules/**/*" diff --git a/apps/api/Gemfile b/apps/api/Gemfile index 8e74e45..7a11ab0 100644 --- a/apps/api/Gemfile +++ b/apps/api/Gemfile @@ -14,4 +14,5 @@ gem "sassc-rails" group :development, :test do gem "debug", platforms: %i[mri windows] + gem "rubocop-rails-omakase", require: false end diff --git a/apps/api/Gemfile.lock b/apps/api/Gemfile.lock index cc0af29..edb3971 100644 --- a/apps/api/Gemfile.lock +++ b/apps/api/Gemfile.lock @@ -88,6 +88,7 @@ GEM arbre (1.7.0) activesupport (>= 3.0.0) ruby2_keywords (>= 0.0.2) + ast (2.4.3) base64 (0.3.0) bcrypt (3.1.22) bigdecimal (4.1.2) @@ -112,6 +113,7 @@ GEM drb (2.2.3) erb (6.0.4) erubi (1.13.1) + ffi (1.17.4-arm64-darwin) ffi (1.17.4-x86_64-linux-gnu) formtastic (6.0.0) actionpack (>= 7.2.0) @@ -151,6 +153,8 @@ GEM activerecord kaminari-core (= 1.2.2) kaminari-core (1.2.2) + language_server-protocol (3.17.0.5) + lint_roller (1.1.0) logger (1.7.0) loofah (2.25.1) crass (~> 1.0.2) @@ -179,9 +183,15 @@ GEM net-smtp (0.5.1) net-protocol nio4r (2.7.5) + nokogiri (1.19.3-arm64-darwin) + racc (~> 1.4) nokogiri (1.19.3-x86_64-linux-gnu) racc (~> 1.4) orm_adapter (0.5.0) + parallel (1.28.0) + parser (3.3.11.1) + ast (~> 2.4.1) + racc pp (0.6.3) prettyprint prettyprint (0.2.0) @@ -230,6 +240,7 @@ GEM thor (~> 1.0, >= 1.2.2) tsort (>= 0.2) zeitwerk (~> 2.6) + rainbow (3.1.1) rake (13.4.2) ransack (4.4.1) activerecord (>= 7.2) @@ -239,11 +250,41 @@ GEM erb psych (>= 4.0.0) tsort + regexp_parser (2.12.0) reline (0.6.3) io-console (~> 0.5) responders (3.2.0) actionpack (>= 7.0) railties (>= 7.0) + rubocop (1.86.1) + json (~> 2.3) + language_server-protocol (~> 3.17.0.2) + lint_roller (~> 1.1.0) + parallel (>= 1.10) + parser (>= 3.3.0.2) + rainbow (>= 2.2.2, < 4.0) + regexp_parser (>= 2.9.3, < 3.0) + rubocop-ast (>= 1.49.0, < 2.0) + ruby-progressbar (~> 1.7) + unicode-display_width (>= 2.4.0, < 4.0) + rubocop-ast (1.49.1) + parser (>= 3.3.7.2) + prism (~> 1.7) + rubocop-performance (1.26.1) + lint_roller (~> 1.1) + rubocop (>= 1.75.0, < 2.0) + rubocop-ast (>= 1.47.1, < 2.0) + rubocop-rails (2.34.3) + activesupport (>= 4.2.0) + lint_roller (~> 1.1) + rack (>= 1.1) + rubocop (>= 1.75.0, < 2.0) + rubocop-ast (>= 1.44.0, < 2.0) + rubocop-rails-omakase (1.1.0) + rubocop (>= 1.72) + rubocop-performance (>= 1.24) + rubocop-rails (>= 2.30) + ruby-progressbar (1.13.0) ruby2_keywords (0.0.5) rubyzip (2.4.1) sassc (2.4.0) @@ -270,6 +311,9 @@ GEM tsort (0.2.0) tzinfo (2.0.6) concurrent-ruby (~> 1.0) + unicode-display_width (3.2.0) + unicode-emoji (~> 4.1) + unicode-emoji (4.2.0) uri (1.1.1) useragent (0.16.11) warden (1.2.9) @@ -281,6 +325,7 @@ GEM zeitwerk (2.7.5) PLATFORMS + arm64-darwin-22 x86_64-linux-gnu DEPENDENCIES @@ -292,6 +337,7 @@ DEPENDENCIES mysql2 (~> 0.5) puma (>= 5.0) rails (~> 8.0) + rubocop-rails-omakase rubyzip (~> 2.3) sassc-rails sprockets-rails diff --git a/apps/api/app/admin/members.rb b/apps/api/app/admin/members.rb index 1801628..51a9a48 100644 --- a/apps/api/app/admin/members.rb +++ b/apps/api/app/admin/members.rb @@ -27,7 +27,7 @@ ActiveAdmin.register Member do filter :real_nick show title: proc { |m| m.nick } do - active_admin_form_for [:admin, resource], url: admin_member_path(resource), html: { method: :put } do |f| + active_admin_form_for [ :admin, resource ], url: admin_member_path(resource), html: { method: :put } do |f| f.inputs "Edit Member" do f.input :nick f.input :real_nick @@ -35,7 +35,7 @@ ActiveAdmin.register Member do f.input :avatar_filename, hint: "Fallback image filename (e.g. mr.zero.png) — only used when no image is selected above." f.input :image_id, as: :select, label: "Image", - collection: Image.order(:original_filename).map { |img| [img.original_filename, img.id] }, + collection: Image.order(:original_filename).map { |img| [ img.original_filename, img.id ] }, include_blank: "— no image (use avatar_filename) —" end f.actions @@ -50,7 +50,7 @@ ActiveAdmin.register Member do f.input :avatar_filename, hint: "Fallback image filename (e.g. mr.zero.png) — only used when no image is selected above." f.input :image_id, as: :select, label: "Image", - collection: Image.order(:original_filename).map { |img| [img.original_filename, img.id] }, + collection: Image.order(:original_filename).map { |img| [ img.original_filename, img.id ] }, include_blank: "— no image (use avatar_filename) —" end f.actions diff --git a/apps/api/app/admin/releases.rb b/apps/api/app/admin/releases.rb index 6e54e77..4206d56 100644 --- a/apps/api/app/admin/releases.rb +++ b/apps/api/app/admin/releases.rb @@ -12,7 +12,7 @@ ActiveAdmin.register Release do column :version column :html_folder_path column :created_at - actions only: [:show] + actions only: [ :show ] end filter :version diff --git a/apps/api/app/admin/softwares.rb b/apps/api/app/admin/softwares.rb index 2e9b3f7..1517bf3 100644 --- a/apps/api/app/admin/softwares.rb +++ b/apps/api/app/admin/softwares.rb @@ -1,8 +1,8 @@ ActiveAdmin.register Software do permit_params :name, :title, :author, :desc, :story, :license, :platform, :status, :highlighted, :image_id, - external_links_attributes: [:id, :label, :url, :_destroy], - releases_attributes: [:id, :_destroy] + external_links_attributes: [ :id, :label, :url, :_destroy ], + releases_attributes: [ :id, :_destroy ] menu priority: 2 @@ -35,7 +35,7 @@ ActiveAdmin.register Software do filter :highlighted show title: proc { |sw| sw.title } do - active_admin_form_for [:admin, resource], url: admin_software_path(resource), html: { method: :put } do |f| + active_admin_form_for [ :admin, resource ], url: admin_software_path(resource), html: { method: :put } do |f| f.inputs "Details" do f.input :name f.input :title @@ -45,7 +45,7 @@ ActiveAdmin.register Software do f.input :highlighted f.input :license f.input :image_id, as: :select, label: "Image", - collection: Image.order(:original_filename).map { |img| [img.original_filename, img.id] }, + collection: Image.order(:original_filename).map { |img| [ img.original_filename, img.id ] }, include_blank: "— no image —" f.input :desc, as: :text, input_html: { rows: 4 } f.input :story, as: :text, input_html: { rows: 8 } @@ -83,7 +83,7 @@ ActiveAdmin.register Software do f.input :highlighted f.input :license f.input :image_id, as: :select, label: "Image", - collection: Image.order(:original_filename).map { |img| [img.original_filename, img.id] }, + collection: Image.order(:original_filename).map { |img| [ img.original_filename, img.id ] }, include_blank: "— no image —" f.input :desc, as: :text, input_html: { rows: 4 } f.input :story, as: :text, input_html: { rows: 8 }