remove last vestiges of rubocop
This commit is contained in:
parent
b159b661d5
commit
c2935af068
|
@ -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
|
ask questions in the issue or in [our chat room](https://lobste.rs/chat), we'd love
|
||||||
to help you get involved.
|
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
|
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
|
website, this source code repository is for the code running the website at
|
||||||
[lobste.rs](https://lobste.rs/).
|
[lobste.rs](https://lobste.rs/).
|
||||||
|
@ -27,7 +31,10 @@ to avoid wasted efforts.
|
||||||
|
|
||||||
* (Optional) Create a branch to house your changes.
|
* (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
|
||||||
|
<a href="https://github.com/standardrb/standard#user-content-editor-support">editor integration available</a>.
|
||||||
(3rd party, externally-maintained code such as Javascript libraries can remain in their own style.)
|
(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.
|
* 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.
|
changes can be easily understood.
|
||||||
|
|
||||||
* Write a proper commit message with the first line being a short,
|
* 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,
|
* 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.
|
and tests should not be added just for the sake of code coverage.
|
||||||
|
|
5
Rakefile
5
Rakefile
|
@ -3,9 +3,4 @@
|
||||||
|
|
||||||
require File.expand_path("../config/application", __FILE__)
|
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
|
Lobsters::Application.load_tasks
|
||||||
|
|
|
@ -108,13 +108,11 @@ class ApplicationController < ActionController::Base
|
||||||
|
|
||||||
color = :red
|
color = :red
|
||||||
[
|
[
|
||||||
# rubocop:disable Layout/LineLength,
|
|
||||||
[2_000_000, :blue, "background-color: #0000#{hex};"],
|
[2_000_000, :blue, "background-color: #0000#{hex};"],
|
||||||
[6, :yellow, "background-color: ##{hex}#{hex}00;"],
|
[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/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4qgt+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, :split, "background: linear-gradient(90deg, ##{hex}0000 50%, #0000#{hex} 50%)"],
|
||||||
[2, :albino, "filter: invert(100%);"]
|
[2, :albino, "filter: invert(100%);"]
|
||||||
# rubocop:enable Layout/LineLength,
|
|
||||||
].each do |cumulative_odds, name, style|
|
].each do |cumulative_odds, name, style|
|
||||||
break unless rand(cumulative_odds) == 0
|
break unless rand(cumulative_odds) == 0
|
||||||
color = name
|
color = name
|
||||||
|
|
|
@ -57,7 +57,6 @@ module TrafficHelper
|
||||||
Keystore.value_for("traffic:intensity") || 0.5
|
Keystore.value_for("traffic:intensity") || 0.5
|
||||||
end
|
end
|
||||||
|
|
||||||
# rubocop:disable Layout/LineLength
|
|
||||||
def self.novelty_logo
|
def self.novelty_logo
|
||||||
time = Time.current
|
time = Time.current
|
||||||
|
|
||||||
|
@ -69,5 +68,4 @@ module TrafficHelper
|
||||||
|
|
||||||
nil
|
nil
|
||||||
end
|
end
|
||||||
# rubocop:enable Layout/LineLength
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
class Domain < ApplicationRecord
|
class Domain < ApplicationRecord
|
||||||
has_many :stories # rubocop:disable Rails/HasManyOrHasOneDependent
|
has_many :stories
|
||||||
belongs_to :banned_by_user,
|
belongs_to :banned_by_user,
|
||||||
class_name: "User",
|
class_name: "User",
|
||||||
inverse_of: false,
|
inverse_of: false,
|
||||||
|
|
|
@ -5,11 +5,9 @@
|
||||||
# gives a 25-50% speedup over 'render collection: @comment', and 80-90% speedup over looping to
|
# gives a 25-50% speedup over 'render collection: @comment', and 80-90% speedup over looping to
|
||||||
# 'render partial: "_comment"'.
|
# 'render partial: "_comment"'.
|
||||||
|
|
||||||
# rubocop:disable Style/MutableConstant
|
|
||||||
HEINOUS_INLINE_PARTIALS = {
|
HEINOUS_INLINE_PARTIALS = {
|
||||||
# including template filename => partial filename
|
# including template filename => partial filename
|
||||||
}
|
}
|
||||||
# rubocop:enable Style/MutableConstant
|
|
||||||
|
|
||||||
Dir["app/views/**/*.erb"].each do |filename|
|
Dir["app/views/**/*.erb"].each do |filename|
|
||||||
template = File.read(filename)
|
template = File.read(filename)
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
# rubocop:disable Layout/LineLength
|
|
||||||
# Be sure to restart your server when you modify this file.
|
# Be sure to restart your server when you modify this file.
|
||||||
#
|
#
|
||||||
# This file eases your Rails 7.0 framework defaults upgrade.
|
# This file eases your Rails 7.0 framework defaults upgrade.
|
||||||
|
@ -116,4 +115,3 @@
|
||||||
# "X-Permitted-Cross-Domain-Policies" => "none",
|
# "X-Permitted-Cross-Domain-Policies" => "none",
|
||||||
# "Referrer-Policy" => "strict-origin-when-cross-origin"
|
# "Referrer-Policy" => "strict-origin-when-cross-origin"
|
||||||
# }
|
# }
|
||||||
# rubocop:enable Layout/LineLength
|
|
||||||
|
|
|
@ -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
|
|
|
@ -1,6 +1,5 @@
|
||||||
class Utils
|
class Utils
|
||||||
# URI.parse is not lenient enough
|
# URI.parse is not lenient enough
|
||||||
# rubocop: disable Style/RegexpLiteral
|
|
||||||
def self.normalize_url url
|
def self.normalize_url url
|
||||||
return "" if url == ""
|
return "" if url == ""
|
||||||
return nil if url.nil?
|
return nil if url.nil?
|
||||||
|
@ -32,7 +31,6 @@ class Utils
|
||||||
'youtube.com/playlist?list=\k<id>'
|
'youtube.com/playlist?list=\k<id>'
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
# rubocop: enable Style/RegexpLiteral
|
|
||||||
|
|
||||||
def self.random_str(len)
|
def self.random_str(len)
|
||||||
str = ""
|
str = ""
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
require "rails_helper"
|
require "rails_helper"
|
||||||
|
|
||||||
# rubocop:disable RSpec/MultipleDescribes
|
|
||||||
describe "user routing" do
|
describe "user routing" do
|
||||||
it "users#tree" do
|
it "users#tree" do
|
||||||
assert_routing(
|
assert_routing(
|
||||||
|
@ -63,4 +62,3 @@ describe "user redirects", type: :request do
|
||||||
expect(Time.zone.today).to be_before(Date.new(2024, 1, 1))
|
expect(Time.zone.today).to be_before(Date.new(2024, 1, 1))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
# rubocop:enable RSpec/MultipleDescribes
|
|
||||||
|
|
Loading…
Reference in New Issue