Move haml-lint from hound to reviewdog

We can somewhat easily get it passing and integrate nice with reviewdog
by adding a TODO file for the rules that we had enabled, so that we
don't need to correct anything now, but we still get alerted for new
offenses. So I say let's keep it and enforce it from now on.
This commit is contained in:
David Rodríguez
2025-10-30 10:25:15 +01:00
parent 43da235d15
commit 8f07ee5bf7
6 changed files with 179 additions and 26 deletions

View File

@@ -2,19 +2,12 @@
# frameworks such as Jekyll/Middleman # frameworks such as Jekyll/Middleman
skip_frontmatter: false skip_frontmatter: false
inherits_from: .haml-lint_todo.yml
linters: linters:
AltText: AltText:
enabled: false enabled: false
ClassAttributeWithStaticValue:
enabled: true
ClassesBeforeIds:
enabled: true
ConsecutiveComments:
enabled: true
ConsecutiveSilentScripts: ConsecutiveSilentScripts:
enabled: true enabled: true
max_consecutive: 2 max_consecutive: 2
@@ -32,7 +25,6 @@ linters:
enabled: true enabled: true
LineLength: LineLength:
enabled: true
max: 80 max: 80
MultilinePipe: MultilinePipe:
@@ -47,24 +39,11 @@ linters:
RuboCop: RuboCop:
enabled: false enabled: false
RubyComments:
enabled: true
SpaceBeforeScript:
enabled: true
SpaceInsideHashAttributes: SpaceInsideHashAttributes:
enabled: true
style: no_space style: no_space
TagName: TagName:
enabled: true enabled: true
TrailingWhitespace:
enabled: true
UnnecessaryInterpolation: UnnecessaryInterpolation:
enabled: true enabled: true
UnnecessaryStringOutput:
enabled: true

153
.haml-lint_todo.yml Normal file
View File

@@ -0,0 +1,153 @@
# This configuration was generated by
# `haml-lint --auto-gen-config`
# on 2025-10-30 09:19:50 +0100 using Haml-Lint version 0.66.0.
# The point is for the user to remove these configuration records
# one by one as the lints are removed from the code base.
# Note that changes in the inspected code, or installation of new
# versions of Haml-Lint, may require this file to be generated again.
linters:
# Offense count: 35
ClassAttributeWithStaticValue:
enabled: false
# Offense count: 77
ClassesBeforeIds:
enabled: false
# Offense count: 18
ConsecutiveComments:
enabled: false
# Offense count: 22
ConsecutiveSilentScripts:
exclude:
- "app/views/admin/contents/_fieldset.html.haml"
- "app/views/admin/enterprises/form/_tag_rules.html.haml"
- "app/views/admin/order_cycles/edit.html.haml"
- "app/views/admin/products_v3/product_preview.turbo_stream.haml"
- "app/views/admin/reports/_date_range_form.html.haml"
- "app/views/checkout/_details.html.haml"
- "app/views/checkout/_payment.html.haml"
- "app/views/spree/admin/adjustments/_adjustments_table.html.haml"
- "app/views/spree/admin/orders/customer_details/_address_form.html.haml"
- "app/views/spree/admin/tax_categories/index.html.haml"
- "app/views/spree/admin/users/index.html.haml"
# Offense count: 14
FinalNewline:
exclude:
- "app/assets/javascripts/templates/shared/question_mark_with_tooltip.html.haml"
- "app/views/admin/enterprises/form/_social.html.haml"
- "app/views/admin/json/_injection_ams.html.haml"
- "app/views/admin/order_cycles/_date_time_warning_modal_content.html.haml"
- "app/views/admin/order_cycles/edit.html.haml"
- "app/views/admin/product_import/_ams_data.html.haml"
- "app/views/admin/reports/_row_group.haml"
- "app/views/admin/reports/filters/_enterprise_fee_summary.html.haml"
- "app/views/admin/reports/filters/_users_and_enterprises.html.haml"
- "app/views/shop/_blocked_cookies.html.haml"
- "app/views/spree/admin/orders/_invoice/_order_note.html.haml"
- "app/views/spree/admin/orders/invoice4.html.haml"
- "app/views/spree/admin/taxons/destroy_taxon.turbo_stream.haml"
- "app/views/spree/admin/users/_email_confirmation.html.haml"
# Offense count: 130
IdNames:
enabled: false
# Offense count: 5
Indentation:
exclude:
- "app/views/admin/products_v3/clone.turbo_stream.haml"
- "app/views/admin/products_v3/destroy_product_variant.turbo_stream.haml"
- "app/views/spree/admin/taxons/destroy_taxon.turbo_stream.haml"
# Offense count: 191
InlineStyles:
enabled: false
# Offense count: 589
InstanceVariables:
enabled: false
# Offense count: 2
LeadingCommentSpace:
exclude:
- "app/views/admin/reports/_row_group.haml"
# Offense count: 2331
LineLength:
enabled: false
# Offense count: 1
MultilinePipe:
exclude:
- "app/views/admin/reports/_rendering_options.html.haml"
# Offense count: 2
MultilineScript:
exclude:
- "app/views/admin/products_v3/product_preview.turbo_stream.haml"
- "app/views/checkout/_voucher_section.html.haml"
# Offense count: 2
RepeatedId:
exclude:
- "app/assets/javascripts/templates/admin/save_bar.html.haml"
# Offense count: 24
RubyComments:
enabled: false
# Offense count: 104
SpaceBeforeScript:
enabled: false
# Offense count: 3345
SpaceInsideHashAttributes:
enabled: false
# Offense count: 22
TrailingEmptyLines:
enabled: false
# Offense count: 73
TrailingWhitespace:
enabled: false
# Offense count: 13
UnnecessaryInterpolation:
exclude:
- "app/components/example_component/example_component.html.haml"
- "app/views/admin/product_import/_entries_table.html.haml"
- "app/views/admin/product_import/import.html.haml"
- "app/views/admin/variant_overrides/_filters.html.haml"
- "app/views/registration/steps/_introduction.html.haml"
- "app/views/spree/order_mailer/_shipping.html.haml"
- "app/views/spree/order_mailer/invoice_email.html.haml"
- "app/views/spree/shared/_shipment_delivery_details.html.haml"
- "app/views/spree/shared/_shipment_pickup_details.html.haml"
# Offense count: 68
UnnecessaryStringOutput:
enabled: false
# Offense count: 14
ViewLength:
exclude:
- "app/assets/javascripts/templates/admin/panels/enterprise_package.html.haml"
- "app/views/admin/customers/index.html.haml"
- "app/views/admin/enterprises/_new_form.html.haml"
- "app/views/admin/enterprises/form/_shop_preferences.html.haml"
- "app/views/admin/product_import/_import_review.html.haml"
- "app/views/admin/products_v3/product_preview.turbo_stream.haml"
- "app/views/checkout/_details.html.haml"
- "app/views/groups/show.html.haml"
- "app/views/producer_mailer/order_cycle_report.html.haml"
- "app/views/shared/_footer.html.haml"
- "app/views/spree/admin/orders/bulk_management.html.haml"
- "app/views/spree/admin/orders/invoice4.html.haml"
- "app/views/spree/admin/products/new.html.haml"
- "app/views/spree/admin/variants/_form.html.haml"

View File

@@ -2,5 +2,3 @@ rubocop:
config_file: .rubocop_styleguide.yml config_file: .rubocop_styleguide.yml
scss: scss:
config_file: .scss-lint.yml config_file: .scss-lint.yml
haml:
config_file: .haml-lint.yml

View File

@@ -186,6 +186,7 @@ end
group :development do group :development do
gem 'foreman' gem 'foreman'
gem 'haml_lint', require: false
gem 'i18n-tasks' gem 'i18n-tasks'
gem 'listen' gem 'listen'
gem 'pry' gem 'pry'

View File

@@ -372,6 +372,12 @@ GEM
temple (>= 0.8.2) temple (>= 0.8.2)
thor thor
tilt tilt
haml_lint (0.67.0)
haml (>= 5.0)
parallel (~> 1.10)
rainbow
rubocop (>= 1.0)
sysexits (~> 1.1)
hashdiff (1.2.1) hashdiff (1.2.1)
hashery (2.1.2) hashery (2.1.2)
hashie (5.0.0) hashie (5.0.0)
@@ -851,6 +857,7 @@ GEM
attr_required (>= 0.0.5) attr_required (>= 0.0.5)
faraday (~> 2.0) faraday (~> 2.0)
faraday-follow_redirects faraday-follow_redirects
sysexits (1.2.0)
temple (0.8.2) temple (0.8.2)
terminal-table (4.0.0) terminal-table (4.0.0)
unicode-display_width (>= 1.1.1, < 4) unicode-display_width (>= 1.1.1, < 4)
@@ -990,6 +997,7 @@ DEPENDENCIES
gmaps4rails gmaps4rails
good_migrations good_migrations
haml haml
haml_lint
highline (= 2.0.3) highline (= 2.0.3)
i18n i18n
i18n-js (~> 3.9.0) i18n-js (~> 3.9.0)

View File

@@ -39,4 +39,18 @@ bundle exec rubocop \
rubocop=$? rubocop=$?
! (( prettier || rubocop )) echo "::group:: Running haml-lint with reviewdog 🐶 ..."
bundle exec haml-lint \
--fail-level warning \
| reviewdog -f="haml-lint" \
-name="haml-lint" \
-reporter="github-pr-check" \
-filter-mode="nofilter" \
-level="error" \
-fail-level="any" \
-tee
haml_lint=$?
! (( prettier || rubocop || haml_lint ))