Conversation
|
Hey @trusche, could you please review this PR? |
|
Hi @italomatos , thank you for the work, but I have no intention of using rubocop on this project. In principle I'm all for it, but we're monkeypatching a lot of other gems here, and I want to mirror their syntax, idiosynchracies and all, as closely as possible. I'm also not in favour of this style, personally, for lines of any length: HttpLog.log_connection(site.host, site.port) if HttpLog.url_approved?("#{site.host}:#{site.port}")It tends to hide the important bit, which is the condition, from a casual glance. So now we're getting into personal preferences. Tabs vs spaces. |
it makes sense , thank you for quick review |
🔧 Fix Rubocop violations and modernize configuration
📋 Summary
This PR resolves 48+ Rubocop style violations across the codebase and modernizes the Rubocop configuration files for compatibility with newer versions.
🚨 Problem Identified
When attempting to run Rubocop on the current codebase, the following compatibility error occurs:
This error prevents contributors using newer Rubocop versions from running style checks or auto-corrections, creating a barrier to contribution.
🎯 What's Changed
✅ Compatibility Fixes
.rubocop_todo.ymland.rubocop.yml✅ Code Quality Improvements
📁 Files Modified
Core Files
lib/httplog/http_log.rb- 44+ violations fixedlib/httplog/configuration.rb- Layout and alias improvementslib/httplog/version.rb- Removed unnecessary.freezeAdapters
lib/httplog/adapters/ethon.rb- Lambda literal spacinglib/httplog/adapters/httpclient.rb- Redundant begin blocks, conditional formattingConfiguration Files
.rubocop.yml- Updated deprecated cop names for newer Rubocop versionsLayout/IndentArray→Layout/FirstArrayElementIndentationTargetRubyVersionto match gemspec (>= 2.6).rubocop_todo.yml- Fixed obsolete configuration referencesMetrics/LineLength→Layout/LineLength🔍 Types of Violations Fixed
Layout & Formatting
Style Improvements
-> (*)→->(*)ifusage for single-line statementsbeginblock removalCompatibility Updates
Metrics/LineLength→Layout/LineLengthLayout/IndentArray→Layout/FirstArrayElementIndentationTargetRubyVersionto match gemspec requirement (>= 2.6)🧪 Testing
📊 Before & After
Before
After
rubocop lib/ # ✅ 10 files inspected, no offenses detected🎉 Benefits
🔗 Related Issues
This PR addresses a compatibility issue that was preventing contributors from using modern development tools, while simultaneously improving overall code quality.
🚨 Breaking Changes
None - This PR contains only style improvements and configuration updates with zero functional changes.
📝 Checklist
💬 Notes for Reviewers
This PR addresses both a practical compatibility issue and code quality improvements. The main driver was the obsolete Rubocop configuration that was blocking contributors using newer versions. While fixing that, I took the opportunity to resolve the existing style violations.
All changes are either:
Feel free to run the tests to confirm no functional changes were introduced! 🚀
Type:
refactor| Priority:medium| Size:medium