From c2935af068a326daa7d7b4316acfe9f5347a82fd Mon Sep 17 00:00:00 2001 From: Peter Bhat Harkins Date: Thu, 14 Sep 2023 08:16:26 -0500 Subject: [PATCH] remove last vestiges of rubocop --- CONTRIBUTING.md | 11 +++++-- Rakefile | 5 --- app/controllers/application_controller.rb | 2 -- app/helpers/traffic_helper.rb | 2 -- app/models/domain.rb | 2 +- config/initializers/heinous_inline_partial.rb | 2 -- .../new_framework_defaults_7_0.rb | 2 -- extras/prohibit_safe_navigation.rb | 32 ------------------- extras/utils.rb | 2 -- spec/routing/user_spec.rb | 2 -- 10 files changed, 10 insertions(+), 52 deletions(-) delete mode 100644 extras/prohibit_safe_navigation.rb diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e606a22c..258cb297 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -12,6 +12,10 @@ require little knowledge of the codebase or community. Please don't hesitate to ask questions in the issue or in [our chat room](https://lobste.rs/chat), we'd love to help you get involved. +You can jump right in to issues tagged `good first issue`, you don't have to ask permission. +Please don't post a comment asking because if you don't finish, +the comment confuses a potential contributor who might not pick it up. + While this project's license allows for modification and use to run your own website, this source code repository is for the code running the website at [lobste.rs](https://lobste.rs/). @@ -27,7 +31,10 @@ to avoid wasted efforts. * (Optional) Create a branch to house your changes. -* Run `bundle exec rubocop && bundle exec ruumba` to check the style of your Ruby. +* Run `bundle exec standardrb` to check the style of your Ruby. + No messages means success. + Adding `--fix` will take care of most issues automatically, and there's excellent + editor integration available. (3rd party, externally-maintained code such as Javascript libraries can remain in their own style.) * Check for unnecessary whitespace with `git diff --check` before committing. @@ -35,7 +42,7 @@ Commit whitespace and other code cleanups separately so that your actual changes can be easily understood. * Write a proper commit message with the first line being a short, -present-tense explanation of the change. Wrap all lines at 80 characters. +present-tense explanation of the change. Wrap message lines at 80 characters. * If applicable, add tests for your changes. Not all changes require tests, and tests should not be added just for the sake of code coverage. diff --git a/Rakefile b/Rakefile index d9d6ba0c..27134d7e 100644 --- a/Rakefile +++ b/Rakefile @@ -3,9 +3,4 @@ require File.expand_path("../config/application", __FILE__) -if Rails.env.development? || Rails.env.test? - require "rubocop/rake_task" - RuboCop::RakeTask.new -end - Lobsters::Application.load_tasks diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 812eea68..49b6b3a6 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -108,13 +108,11 @@ class ApplicationController < ActionController::Base color = :red [ - # rubocop:disable Layout/LineLength, [2_000_000, :blue, "background-color: #0000#{hex};"], [6, :yellow, "background-color: ##{hex}#{hex}00;"], [3, :calico, "background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAACXBIWXMAAC4jAAAuIwF4pT92AAAABmJLR0QA/wD/AP+gvaeTAAACpElEQVQYGQXBWW8bVRgA0Hu/u814NsdxGsUxztJUzaJSVS1CCCTKE7zxxiP/gH+I+lKKQEVCLUlJ5YTsU8f2eJvxbHfjHLz7sKeU2mhNfvl579vnEPKUEUJxji1YoBaIob4m6+cX8Our/m99TBwmpKGV0hZjz+EO06FHOAKlFNKIcE+p8HYo3rwd/Xk8m+pVEjW4EzIFdjopVVG6Nt1ocpc3ALnIhqMRnF3afz6qd2flcMElAOWu3nm4tr6xMh2cyDpprqwBwdjQ0Uz9fXJ9el0lRTOekVQ13DCKvCXVWO7sdl6+/Gp01cbpv/uHPcqGlUKIr50NZq+Pi7mymrt+GOxvbz9+zKjS5OLi1uV/ZeObAC3un4qgt+c0bL8/v5qJ64WbaocIPC2HzbaDGCOeF0ySJI7vzz9eLuZFpfDq2lZWmd/fx6/e3twkuDIiL3KCysV83D+/xZ/1uhYXjuC6lg0BVk2fHPXcQMWD7L+bvJCettzhEPpgzRIxjbe3u6VMCcXWMEY5E9qisqo1QlRLjDVwxqxSQpBW5CFnSB2PaulyRleCSEtNhDPLltjkdQWYCC+gDVF6pHzU8z8/7IKgVFaVtshSWaQxA2Osz4FiokTQrLRrQCLIXzxr/fT94cFWVFlGmXExNQznnbbzaGcVgb0bJqO8kS5BzmusNAMdYN5mPlsihRh5sL7pRYHXQM+OOj/+8MV3Xx+2mmQ8qQZxkmfKSGXq1Odyt9MShByffKLgcc3JsqrHk3Eyumu6LbkYFHcfsjttSaR5OFP29H755nzw/sq8+yMh/sYKYiRL76dxzOqr9RBsmeisnCWqVlZaMIyxgC5U9eEy7p9awj0ByDiQ7XfgmyfRl0fRwZbb7bLVNmOOXynADDY3Hxzs7+WL5XSY/w/0MGrkMYhXjAAAAABJRU5ErkJggg==) no-repeat center"], [2, :split, "background: linear-gradient(90deg, ##{hex}0000 50%, #0000#{hex} 50%)"], [2, :albino, "filter: invert(100%);"] - # rubocop:enable Layout/LineLength, ].each do |cumulative_odds, name, style| break unless rand(cumulative_odds) == 0 color = name diff --git a/app/helpers/traffic_helper.rb b/app/helpers/traffic_helper.rb index b134e2cc..a6f1b58f 100644 --- a/app/helpers/traffic_helper.rb +++ b/app/helpers/traffic_helper.rb @@ -57,7 +57,6 @@ module TrafficHelper Keystore.value_for("traffic:intensity") || 0.5 end - # rubocop:disable Layout/LineLength def self.novelty_logo time = Time.current @@ -69,5 +68,4 @@ module TrafficHelper nil end - # rubocop:enable Layout/LineLength end diff --git a/app/models/domain.rb b/app/models/domain.rb index 8f9d57a7..da2a0cc2 100644 --- a/app/models/domain.rb +++ b/app/models/domain.rb @@ -1,5 +1,5 @@ class Domain < ApplicationRecord - has_many :stories # rubocop:disable Rails/HasManyOrHasOneDependent + has_many :stories belongs_to :banned_by_user, class_name: "User", inverse_of: false, diff --git a/config/initializers/heinous_inline_partial.rb b/config/initializers/heinous_inline_partial.rb index ad903121..42784fc2 100644 --- a/config/initializers/heinous_inline_partial.rb +++ b/config/initializers/heinous_inline_partial.rb @@ -5,11 +5,9 @@ # gives a 25-50% speedup over 'render collection: @comment', and 80-90% speedup over looping to # 'render partial: "_comment"'. -# rubocop:disable Style/MutableConstant HEINOUS_INLINE_PARTIALS = { # including template filename => partial filename } -# rubocop:enable Style/MutableConstant Dir["app/views/**/*.erb"].each do |filename| template = File.read(filename) diff --git a/config/initializers/new_framework_defaults_7_0.rb b/config/initializers/new_framework_defaults_7_0.rb index f9ce8f5b..a579326e 100644 --- a/config/initializers/new_framework_defaults_7_0.rb +++ b/config/initializers/new_framework_defaults_7_0.rb @@ -1,4 +1,3 @@ -# rubocop:disable Layout/LineLength # Be sure to restart your server when you modify this file. # # This file eases your Rails 7.0 framework defaults upgrade. @@ -116,4 +115,3 @@ # "X-Permitted-Cross-Domain-Policies" => "none", # "Referrer-Policy" => "strict-origin-when-cross-origin" # } -# rubocop:enable Layout/LineLength diff --git a/extras/prohibit_safe_navigation.rb b/extras/prohibit_safe_navigation.rb deleted file mode 100644 index 51ce03d6..00000000 --- a/extras/prohibit_safe_navigation.rb +++ /dev/null @@ -1,32 +0,0 @@ -require "rails" -require "rubocop" - -unless Rails.env.production? - module RuboCop - module Cop - module Style - # The "safe navigation" operator &. makes it easier to work with and - # propagate nil values. This will disallow the use of the safe navigation - # operator - # - # @example - # - # # bad - # foo&.bar - # a.foo&.bar - # - class DisallowSafeNavigation < Cop - extend TargetRubyVersion - - MSG = "Do not use &.".freeze - - minimum_target_ruby_version 2.3 - - def on_csend(node) - add_offense(node) - end - end - end - end - end -end diff --git a/extras/utils.rb b/extras/utils.rb index 96269247..4aadfe8e 100644 --- a/extras/utils.rb +++ b/extras/utils.rb @@ -1,6 +1,5 @@ class Utils # URI.parse is not lenient enough - # rubocop: disable Style/RegexpLiteral def self.normalize_url url return "" if url == "" return nil if url.nil? @@ -32,7 +31,6 @@ class Utils 'youtube.com/playlist?list=\k' ) end - # rubocop: enable Style/RegexpLiteral def self.random_str(len) str = "" diff --git a/spec/routing/user_spec.rb b/spec/routing/user_spec.rb index b6b3b9b0..9f550623 100644 --- a/spec/routing/user_spec.rb +++ b/spec/routing/user_spec.rb @@ -1,6 +1,5 @@ require "rails_helper" -# rubocop:disable RSpec/MultipleDescribes describe "user routing" do it "users#tree" do assert_routing( @@ -63,4 +62,3 @@ describe "user redirects", type: :request do expect(Time.zone.today).to be_before(Date.new(2024, 1, 1)) end end -# rubocop:enable RSpec/MultipleDescribes