mirror of
https://github.com/usetrmnl/terminus.git
synced 2026-08-13 14:29:27 -07:00
Updated to SimpleCov 1.0.0
link:https://github.com/simplecov-ruby/simplecov/blob/main/CHANGELOG.md#100-2026-07-12[Details]. This includes the following: * My long standing bug has been fixed which allows for implicit elses to be ignored. This cleans up code related to using monads with pattern matching which is nice to see. * We still can't enable ERB code coverage (this is why the templates are skipped). I've logged a few more new bugs on the SimpleCov side to tackle. This might take a while because I noticed Erik Berlin logged issues with Ruby core in order to make this possible. * Use of the *strict* profile ensures all code committed to this project must be 100%. This also cleans up having to be explicit about this. Milestone: patch
This commit is contained in:
@@ -56,7 +56,7 @@ group :quality do
|
||||
gem "git-lint", "~> 11.0"
|
||||
gem "reek", "~> 6.5", require: false
|
||||
gem "rubocop-sequel", "~> 0.3"
|
||||
gem "simplecov", "~> 0.22", require: false
|
||||
gem "simplecov", "~> 1.0", require: false
|
||||
end
|
||||
|
||||
group :development, :test do
|
||||
|
||||
+3
-12
@@ -71,7 +71,6 @@ GEM
|
||||
reline (>= 0.3.8)
|
||||
debug_inspector (1.2.0)
|
||||
diff-lcs (1.6.2)
|
||||
docile (1.4.1)
|
||||
domain_name (0.6.20240107)
|
||||
dotenv (3.2.0)
|
||||
down (5.6.0)
|
||||
@@ -500,12 +499,7 @@ GEM
|
||||
sidekiq-scheduler (6.0.2)
|
||||
rufus-scheduler (~> 3.2)
|
||||
sidekiq (>= 7.3, < 9)
|
||||
simplecov (0.22.0)
|
||||
docile (~> 1.1)
|
||||
simplecov-html (~> 0.11)
|
||||
simplecov_json_formatter (~> 0.1)
|
||||
simplecov-html (0.13.2)
|
||||
simplecov_json_formatter (0.1.4)
|
||||
simplecov (1.0.2)
|
||||
sod (2.4.0)
|
||||
cogger (~> 2.3)
|
||||
containable (~> 2.3)
|
||||
@@ -641,7 +635,7 @@ DEPENDENCIES
|
||||
shrine (~> 3.6)
|
||||
sidekiq (~> 8.0)
|
||||
sidekiq-scheduler (~> 6.0)
|
||||
simplecov (~> 0.22)
|
||||
simplecov (~> 1.0)
|
||||
trmnl-api (~> 0.19)
|
||||
trmnl-liquid (~> 0.6)
|
||||
versionaire (~> 15.3)
|
||||
@@ -678,7 +672,6 @@ CHECKSUMS
|
||||
debug (1.11.1) sha256=2e0b0ac6119f2207a6f8ac7d4a73ca8eb4e440f64da0a3136c30343146e952b6
|
||||
debug_inspector (1.2.0) sha256=9bdfa02eebc3da163833e6a89b154084232f5766087e59573b70521c77ea68a2
|
||||
diff-lcs (1.6.2) sha256=9ae0d2cba7d4df3075fe8cd8602a8604993efc0dfa934cff568969efb1909962
|
||||
docile (1.4.1) sha256=96159be799bfa73cdb721b840e9802126e4e03dfc26863db73647204c727f21e
|
||||
domain_name (0.6.20240107) sha256=5f693b2215708476517479bf2b3802e49068ad82167bcd2286f899536a17d933
|
||||
dotenv (3.2.0) sha256=e375b83121ea7ca4ce20f214740076129ab8514cd81378161f11c03853fe619d
|
||||
down (5.6.0) sha256=48ec6ddb078cbf3b425d02596bb388303316f976143c6e94a7b3169d6712b593
|
||||
@@ -824,9 +817,7 @@ CHECKSUMS
|
||||
shrine (3.9.0) sha256=3ccc2dd1cff89efc034449675f6524017084485b8b387059d68b4f303c848aa7
|
||||
sidekiq (8.1.6) sha256=be20cd051124b1a16cf97ea9157137abbd30a515c16a5ae9312d2eadd045e40f
|
||||
sidekiq-scheduler (6.0.2) sha256=1065f1a989e750849de1d23d1f34338c104ed6ec5a6dc22a2620c5af54a2d6fc
|
||||
simplecov (0.22.0) sha256=fe2622c7834ff23b98066bb0a854284b2729a569ac659f82621fc22ef36213a5
|
||||
simplecov-html (0.13.2) sha256=bd0b8e54e7c2d7685927e8d6286466359b6f16b18cb0df47b508e8d73c777246
|
||||
simplecov_json_formatter (0.1.4) sha256=529418fbe8de1713ac2b2d612aa3daa56d316975d307244399fa4838c601b428
|
||||
simplecov (1.0.2) sha256=c6459434efe4b948b46477cc2df2faa73ab365f83a33c7c17f81262f4f7f1244
|
||||
sod (2.4.0) sha256=e948a13d2f8231568bb1252661a4f6d85228dd77e86097ea8daa87a6733ab11e
|
||||
spek (5.4.0) sha256=c163b87135c04c1ce10f6455e3686eae4f91e1cc61753fcb64bfae0830e74975
|
||||
stringio (3.2.0) sha256=c37cb2e58b4ffbd33fe5cd948c05934af997b36e0b6ca6fdf43afa234cf222e1
|
||||
|
||||
@@ -29,7 +29,6 @@ module Terminus
|
||||
def handle_rodauth_redirect rodauth, response
|
||||
halted = catch(:halt) { yield }
|
||||
|
||||
# :nocov:
|
||||
return unless halted
|
||||
|
||||
code, headers, body = *halted
|
||||
@@ -38,7 +37,6 @@ module Terminus
|
||||
response.redirect headers["Location"], code
|
||||
|
||||
throw :halt, [code, body]
|
||||
# :nocov:
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -26,7 +26,9 @@ module Terminus
|
||||
|
||||
attr_reader :petail
|
||||
|
||||
# simplecov:disable
|
||||
def verify_csrf_token?(*) = false
|
||||
# simplecov:enable
|
||||
|
||||
private
|
||||
|
||||
|
||||
@@ -29,8 +29,6 @@ module Terminus
|
||||
case provisioner.call(**parameters[:device])
|
||||
in Success(device) then response.body = {data: serializer.new(device).to_h}.to_json
|
||||
in Failure(String => error) then not_found error, response
|
||||
# :nocov:
|
||||
# :nocov:
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -19,8 +19,6 @@ module Terminus
|
||||
case firmware_parser.call request.env
|
||||
in Success(model) then create model, response
|
||||
in Failure(result) then unprocessable_content result.errors.to_h, response
|
||||
# :nocov:
|
||||
# :nocov:
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -33,8 +33,6 @@ module Terminus
|
||||
case cloner.call parameters[:extension_id], **parameters[:extension]
|
||||
in Success then response.redirect_to routes.path(:extensions)
|
||||
in Failure(errors) then error parameters, errors, response
|
||||
# :nocov:
|
||||
# :nocov:
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -24,8 +24,6 @@ module Terminus
|
||||
case exporter.call extension
|
||||
in Success(body) then response.with body: body.read
|
||||
in Failure(message) then response.with body: message, status: 500
|
||||
# :nocov:
|
||||
# :nocov:
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -29,8 +29,6 @@ module Terminus
|
||||
case creator.call temp_file
|
||||
in Success then flash[:notice] = "Extension imported!"
|
||||
in Failure(message) then flash[:alert] = message
|
||||
# :nocov:
|
||||
# :nocov:
|
||||
end
|
||||
|
||||
response.redirect_to routes.path(:extensions)
|
||||
|
||||
@@ -26,8 +26,6 @@ module Terminus
|
||||
case cloner.call parameters[:model_id], **parameters[:model]
|
||||
in Success then response.redirect_to routes.path(:models)
|
||||
in Failure(errors) then render_form_error parameters, errors, response
|
||||
# :nocov:
|
||||
# :nocov:
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -34,8 +34,6 @@ module Terminus
|
||||
case cloner.call parameters[:playlist_id], **parameters[:playlist]
|
||||
in Success then response.redirect_to routes.path(:playlists)
|
||||
in Failure(errors) then render_form_error parameters, errors, response
|
||||
# :nocov:
|
||||
# :nocov:
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -18,8 +18,6 @@ module Terminus
|
||||
in Success(Structs::User)
|
||||
response.render index_view, users: repository.all, layout: htmx_layout.call(request)
|
||||
in Failure(result) then error request, response, result
|
||||
# :nocov:
|
||||
# :nocov:
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -16,8 +16,6 @@ module Terminus
|
||||
case updater.call(**request.params.to_h)
|
||||
in Success(user) then save user, response
|
||||
in Failure(result) then error request, result, response
|
||||
# :nocov:
|
||||
# :nocov:
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -38,21 +38,21 @@ module Terminus
|
||||
end
|
||||
|
||||
def configure_server
|
||||
# :nocov:
|
||||
# simplecov:disable
|
||||
sidekiq.configure_server do |configuration|
|
||||
configuration.redis = {url: slice[:settings].keyvalue_url}
|
||||
configuration.logger = slice[:logger]
|
||||
configuration.on(:startup) { load_schedule }
|
||||
end
|
||||
# :nocov:
|
||||
# simplecov:enable
|
||||
end
|
||||
|
||||
def sidekiq
|
||||
@sidekiq ||= resolver.call
|
||||
end
|
||||
|
||||
# simplecov:disable
|
||||
def load_schedule
|
||||
# :nocov:
|
||||
jobs = YAML.load_file slice.root.join("config/sidekiq_scheduler.yml")
|
||||
|
||||
jobs.each do |schedule_name, options|
|
||||
@@ -62,8 +62,8 @@ module Terminus
|
||||
rescue NameError, TypeError
|
||||
logger.error { "Unable to initialize job: #{job_name}." }
|
||||
end
|
||||
# :nocov:
|
||||
end
|
||||
# simplecov:enable
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -9,9 +9,7 @@ require_relative "initializers/universal_logger_patch"
|
||||
module Terminus
|
||||
# The application base configuration.
|
||||
class App < Hanami::App
|
||||
# :nocov:
|
||||
RubyVM::YJIT.enable if defined? RubyVM::YJIT
|
||||
# :nocov:
|
||||
Dry::Schema.load_extensions :monads
|
||||
Dry::Validation.load_extensions :monads
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
require "ipaddr"
|
||||
require "rack/attack"
|
||||
|
||||
# :nocov:
|
||||
allowed_subnets = [
|
||||
IPAddr.new("10.0.0.0/8"),
|
||||
IPAddr.new("172.16.0.0/12"),
|
||||
@@ -12,7 +11,6 @@ allowed_subnets = [
|
||||
IPAddr.new("::1"),
|
||||
*ENV.fetch("RACK_ATTACK_ALLOWED_SUBNETS", "").split(",").map { IPAddr.new it }
|
||||
]
|
||||
# :nocov:
|
||||
|
||||
Rack::Attack.safelist "allow subnets" do |request|
|
||||
allowed_subnets.any? { |subnet| subnet.include? request.ip }
|
||||
|
||||
@@ -23,5 +23,7 @@ Hanami.app.register_provider :http do
|
||||
register :http, http
|
||||
end
|
||||
|
||||
# simplecov:disable
|
||||
stop { slice[:http].close }
|
||||
# simplecov:enable
|
||||
end
|
||||
|
||||
@@ -10,12 +10,12 @@ Hanami.app.register_provider :shrine do
|
||||
Shrine.storages = if Hanami.env? :test
|
||||
{cache: Shrine::Storage::Memory.new, store: Shrine::Storage::Memory.new}
|
||||
else
|
||||
# simplecov:disable
|
||||
{
|
||||
# :nocov:
|
||||
cache: Shrine::Storage::FileSystem.new("public", prefix: "uploads/cache"),
|
||||
store: Shrine::Storage::FileSystem.new("public", prefix: "uploads")
|
||||
# :nocov:
|
||||
}
|
||||
# simplecov:enable
|
||||
end
|
||||
|
||||
Shrine.plugin :add_metadata
|
||||
|
||||
@@ -8,7 +8,7 @@ require_relative "feature"
|
||||
|
||||
module Authentication
|
||||
# Specialized Roda middleware for authentication.
|
||||
# :nocov:
|
||||
# simplecov:disable
|
||||
class Middleware < Roda
|
||||
UNVERIFIED_ID = 1
|
||||
VERIFIED_ID = 2
|
||||
@@ -150,5 +150,5 @@ module Authentication
|
||||
request.rodauth
|
||||
end
|
||||
end
|
||||
# :nocov:
|
||||
# simplecov:enable
|
||||
end
|
||||
|
||||
+21
-22
@@ -3,28 +3,27 @@
|
||||
require "simplecov"
|
||||
|
||||
unless ENV["COVERAGE"] == "no"
|
||||
SimpleCov.start do
|
||||
add_filter %r(^/spec/)
|
||||
enable_coverage :branch
|
||||
minimum_coverage_by_file line: 95, branch: 95
|
||||
|
||||
add_group "Actions", "app/actions"
|
||||
add_group "Aspects", "app/aspects"
|
||||
add_group "Config", "config"
|
||||
add_group "Contracts", "app/contracts"
|
||||
add_group "DB", "app/db"
|
||||
add_group "Jobs", "app/jobs"
|
||||
add_group "Lib", "lib"
|
||||
add_group "Models", "app/models"
|
||||
add_group "Providers", "app/providers"
|
||||
add_group "Relations", "app/relations"
|
||||
add_group "Repositories", "app/repositories"
|
||||
add_group "Schemas", "app/schemas"
|
||||
add_group "Serializers", "app/serializers"
|
||||
add_group "Slices", "slices"
|
||||
add_group "Structs", "app/structs"
|
||||
add_group "Uploaders", "app/uploaders"
|
||||
add_group "Views", "app/views"
|
||||
SimpleCov.start "strict" do
|
||||
group "Actions", "app/actions"
|
||||
group "Aspects", "app/aspects"
|
||||
group "Config", "config"
|
||||
group "Contracts", "app/contracts"
|
||||
group "DB", "app/db"
|
||||
group "Jobs", "app/jobs"
|
||||
group "Lib", "lib"
|
||||
group "Models", "app/models"
|
||||
group "Providers", "app/providers"
|
||||
group "Relations", "app/relations"
|
||||
group "Repositories", "app/repositories/"
|
||||
group "Schemas", "app/schemas"
|
||||
group "Serializers", "app/serializers"
|
||||
group "Slices", "slices"
|
||||
group "Structs", "app/structs"
|
||||
group "Uploaders", "app/uploaders"
|
||||
group "Views", "app/views"
|
||||
ignore_branches :implicit_else
|
||||
skip "app/templates"
|
||||
skip "slices/authentication/templates"
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user