Skip to content

Commit

Permalink
💄 endless and ever appeasing of the coppers
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremyf committed Mar 29, 2024
1 parent c166f8c commit c970fdf
Show file tree
Hide file tree
Showing 11 changed files with 96 additions and 12 deletions.
78 changes: 78 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
inherit_gem:
bixby: bixby_default.yml

AllCops:
NewCops: disable
TargetRubyVersion: 3.2.2
DisplayCopNames: true
Exclude:
# NOTE: When we run knapsack's rubocop, we don't want to check the submodule
# for Hyku. We'll assume it's okay and has it's own policing policies.
- "hyrax-webapp/**/*"

Metrics/BlockLength:
IgnoredMethods: ['included', 'describe', 'it', 'context']
Exclude:
- "spec/**/*.rb"

Style/AsciiComments:
Enabled: false

# rubocop suggests !thing.nil? instead, but that is NOT equivalent
Style/DoubleNegation:
Enabled: false

Style/CollectionMethods:
PreferredMethods:
collect: 'map'
collect!: 'map!'
inject: 'reduce'
detect: 'find'
find_all: 'select'

Style/SymbolArray:
Enabled: false

Style/ClassAndModuleChildren:
Enabled: false

Style/SingleLineBlockParams:
Enabled: false

Rails/ApplicationJob:
Enabled: false

Rails/ApplicationMailer:
Enabled: false

Rails/ApplicationRecord:
Enabled: false

Rails/RakeEnvironment:
Enabled: false

# We define custom methods like `find_by_user_key`,
# `find_by_created_date`, etc
Rails/DynamicFindBy:
Enabled: false

# # By default RSpec/MessageSpies has the following:
# # Prefer have_received for setting message expectations. Setup form as a spy using allow or instance_spy.
# # The default assumes EnforcedStyle is 'have_received'. Most of our specs are 'receive'
RSpec/MessageSpies:
Enabled: false

RSpec/ExpectActual:
Enabled: false

RSpec/LetSetup:
Enabled: false

RSpec/MessageExpectation:
Enabled: false

RSpec/NestedGroups:
Enabled: false

RSpec/LeadingSubject:
Enabled: false
1 change: 1 addition & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
require "bundler/setup"

load "rails/tasks/statistics.rake"
Expand Down
16 changes: 7 additions & 9 deletions bin/knapsacker
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
#!/usr/bin/env ruby -wU
# frozen_string_literal: true

# The purpose of this script is to quickly assess which specs should:
#
# - be removed (e.g. duplicate in Knapsack and Hyku)
# - be reviewed (e.g. differences between Knapsack and Hyku)
# - kept outright (e.g. in Knapsack but not Hyku)

require 'English'
require 'optparse'
config = { yours: './', upstream: './hyrax-webapp', patterns_to_check: ["spec/**/*.*", "app/**/*.*", "lib/**/*.*"] }

command_name = File.basename(__FILE__)


nlp = new_line_padding = " " * 37
nlp = _new_line_padding = " " * 37
optparse = OptionParser.new do |options|
# This banner is the first line of your help documentation.
options.set_banner "Usage: #{command_name} [options]\n\n" \
Expand All @@ -38,7 +39,7 @@ begin
missing = mandatory.select { |param| config[param].nil? }
raise OptionParser::MissingArgument, missing.join(', ') unless missing.empty?
rescue OptionParser::InvalidOption, OptionParser::MissingArgument
warn "\e[0m\e[1m\e[31m#{$!}\e[0m\n"
warn "\e[0m\e[1m\e[31m#{$ERROR_INFO}\e[0m\n"
warn optparse
exit
end
Expand Down Expand Up @@ -80,10 +81,9 @@ dir_glob_patterns_to_check.each do |pattern|
end
end


puts "-"*72
puts "-" * 72
puts "Knapsacker run context:"
puts "-"*72
puts "-" * 72
puts "- Working Directory: #{FileUtils.pwd}"
puts "- Your Dir: #{yours}"
puts "- Upstream Dir: #{upstream}"
Expand All @@ -99,9 +99,7 @@ puts "They are prefixed with a `='"
puts "------------------------------------------------------------------"
duplicates.each do |path|
puts "= #{path}"
if ENV['RM_DUPS']
File.unlink(path)
end
File.unlink(path) if ENV['RM_DUPS']
end

puts ""
Expand Down
1 change: 1 addition & 0 deletions bin/rails
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env ruby
# frozen_string_literal: true
APP_PATH = File.expand_path('../config/application', __dir__)
require_relative '../config/boot'
require 'rails/commands'
1 change: 1 addition & 0 deletions bundler.d/example.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
# see https://github.com/kbrock/bundler-inject/tree/gem_path

# specify one or more ruby files in this directory to be injected into bundler
Expand Down
1 change: 1 addition & 0 deletions config/initializers/hyrax.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true
# Use this to override any Hyrax configuration from the Knapsack

Hyrax.config do |config|
config.register_curation_concern :mobius_work
Expand Down
1 change: 1 addition & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# frozen_string_literal: true
HykuKnapsack::Engine.routes.draw do
end
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
require 'rails/generators'
require 'rails/generators/model_helpers'

# rubocop:disable Metrics/ClassLength
class HykuKnapsack::WorkResourceGenerator < Rails::Generators::NamedBase
# ActiveSupport can interpret models as plural which causes
# counter-intuitive route paths. Pull in ModelHelpers from
Expand Down Expand Up @@ -177,3 +178,4 @@ def revoking?
behavior == :revoke
end
end
# rubocop:enable Metrics/ClassLength
1 change: 1 addition & 0 deletions lib/hyku_knapsack.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
require "hyku_knapsack/version"
require "hyku_knapsack/engine"

Expand Down
4 changes: 2 additions & 2 deletions lib/hyku_knapsack/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def self.load_translations!
config.before_initialize do
config.i18n.load_path += Dir["#{config.root}/config/locales/**/*.yml"]

#if Hyku::Application.respond_to?(:user_devise_parameters=)
# if Hyku::Application.respond_to?(:user_devise_parameters=)
# Hyku::Application.user_devise_parameters = %i[
# database_authenticatable
# invitable
Expand All @@ -42,7 +42,7 @@ def self.load_translations!
# validatable
# omniauthable
# ]
#end
# end
end

config.after_initialize do
Expand Down
2 changes: 1 addition & 1 deletion spec/rails_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,5 @@
# TODO is this needed?
config.include HykuKnapsack::Engine.routes.url_helpers

## End override
## End override
end

0 comments on commit c970fdf

Please sign in to comment.