Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow Haml 6.3 #459

Merged
merged 1 commit into from
Dec 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ jobs:
- haml6.0
- haml6.1
- haml6.2
- haml6.3
- rubocop1.0
os:
- ubuntu
Expand Down
4 changes: 4 additions & 0 deletions Appraisals
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ appraise 'haml6.2' do
gem 'haml', '~> 6.2.0'
end

appraise 'haml6.3' do
gem 'haml', '~> 6.3.0'
end

appraise 'rubocop1.0' do
gem 'rubocop', '~> 1.0.0'
end
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
# HAML-Lint Changelog

### main

* Add Haml 6.3 compatibility

### 0.51.0

* Allow HAML > 6.1
* Allow Haml > 6.1

### 0.50.0

Expand Down
15 changes: 15 additions & 0 deletions gemfiles/haml6.3.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# This file was generated by Appraisal

source "https://rubygems.org"

gem "rake"
gem "rspec", "~> 3.8"
gem "rspec-its", "~> 1.0"
gem "appraisal"
gem "overcommit", "0.60.0"
gem "rubocop", "1.57.2"
gem "simplecov", "~> 0.22.0"
gem "simplecov-lcov", "~> 0.8.0"
gem "haml", "~> 6.3.0"

gemspec path: "../"
2 changes: 1 addition & 1 deletion lib/haml_lint/adapter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def self.detect_class
case version
when '~> 4.0' then HamlLint::Adapter::Haml4
when '~> 5.0', '~> 5.1', '~> 5.2' then HamlLint::Adapter::Haml5
when '~> 6.0', '~> 6.0.a', '~> 6.1', '~> 6.2' then HamlLint::Adapter::Haml6
when '~> 6.0', '~> 6.0.a', '~> 6.1', '~> 6.2', '~> 6.3' then HamlLint::Adapter::Haml6
Comment on lines 21 to +24
Copy link
Contributor Author

@tagliala tagliala Dec 11, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we change haml_version to haml_major_version, return segments.first.to_i, and go for:

      when 4 then HamlLint::Adapter::Haml4
      when 5 then HamlLint::Adapter::Haml5
      when 6 then HamlLint::Adapter::Haml6

or dynamic adapter resolution?

      adapter = "HamlLint::Adapter::Haml#{haml_major_version}".safe_constantize
      fail HamlLint::Exceptions::UnknownHamlVersion, "Cannot handle Haml version: #{haml_version}" unless adapter

      adapter

or any other suggestion.

The problem is that, as far as I can understand, it is possible that a single major version of Haml may require two different adapters, and then the dynamic resolution will fail

Maybe even drop Haml 4 and 5

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm supportive of dropping older versions of HAML, especially v4. I don't see a legitimate reason to continue supporting such an old version in light of how long v6 has been available.

else fail HamlLint::Exceptions::UnknownHamlVersion, "Cannot handle Haml version: #{version}"
end
end
Expand Down