From 27b76f78413f7afcbb1c4e40175f6b9936721c6f Mon Sep 17 00:00:00 2001 From: Michael Scrivo Date: Tue, 24 Nov 2026 15:32:49 -0500 Subject: [PATCH] chore(rubocop): ratchet Metrics limits to current worst case Re-enable the AbcSize, Cyclomatic/PerceivedComplexity and Documentation cops instead of disabling them, with limits set to today's worst offender so complexity can't grow. Tighten MethodLength and ClassLength to actual usage, drop the unused ModuleLength override, and exclude specs from BlockLength. Co-Authored-By: Claude Opus 5.5 --- .rubocop.yml | 34 +++++++++++++++------------------- lib/html2text.rb | 1 + 2 files changed, 16 insertions(+), 19 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 069012c..aff55a6 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -6,30 +6,26 @@ AllCops: NewCops: enable TargetRubyVersion: 3.3 -Metrics/MethodLength: - Max: 30 - -Metrics/ClassLength: - Max: 200 +Gemspec/DevelopmentDependencies: + EnforcedStyle: gemspec -Metrics/ModuleLength: - Max: 200 +# Metrics limits are ratcheted to the current worst case so complexity can't grow. +# Lower them as methods are simplified. +Metrics/AbcSize: + Max: 33 Metrics/BlockLength: - Max: 50 + Exclude: + - spec/**/* -Gemspec/DevelopmentDependencies: - EnforcedStyle: gemspec +Metrics/ClassLength: + Max: 165 -# TODO: Enable these cops after fixing the issues Metrics/CyclomaticComplexity: - Enabled: false - -Metrics/PerceivedComplexity: - Enabled: false + Max: 15 -Metrics/AbcSize: - Enabled: false +Metrics/MethodLength: + Max: 28 -Style/Documentation: - Enabled: false +Metrics/PerceivedComplexity: + Max: 17 diff --git a/lib/html2text.rb b/lib/html2text.rb index 448c2a9..a1664df 100644 --- a/lib/html2text.rb +++ b/lib/html2text.rb @@ -2,6 +2,7 @@ require 'nokogiri' +# Converts HTML into plain text, approximating how a browser would render it. class Html2Text attr_reader :doc