diff --git a/.haml-lint.yml b/.haml-lint.yml index 979e351be6..f27ea4944c 100644 --- a/.haml-lint.yml +++ b/.haml-lint.yml @@ -2,19 +2,12 @@ # frameworks such as Jekyll/Middleman skip_frontmatter: false +inherits_from: .haml-lint_todo.yml + linters: AltText: enabled: false - ClassAttributeWithStaticValue: - enabled: true - - ClassesBeforeIds: - enabled: true - - ConsecutiveComments: - enabled: true - ConsecutiveSilentScripts: enabled: true max_consecutive: 2 @@ -32,7 +25,6 @@ linters: enabled: true LineLength: - enabled: true max: 80 MultilinePipe: @@ -47,24 +39,11 @@ linters: RuboCop: enabled: false - RubyComments: - enabled: true - - SpaceBeforeScript: - enabled: true - SpaceInsideHashAttributes: - enabled: true style: no_space TagName: enabled: true - TrailingWhitespace: - enabled: true - UnnecessaryInterpolation: enabled: true - - UnnecessaryStringOutput: - enabled: true diff --git a/.haml-lint_todo.yml b/.haml-lint_todo.yml new file mode 100644 index 0000000000..a5307dd4e8 --- /dev/null +++ b/.haml-lint_todo.yml @@ -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" diff --git a/.hound.yml b/.hound.yml index f84288e246..19ee0c5037 100644 --- a/.hound.yml +++ b/.hound.yml @@ -2,5 +2,3 @@ rubocop: config_file: .rubocop_styleguide.yml scss: config_file: .scss-lint.yml -haml: - config_file: .haml-lint.yml diff --git a/Gemfile b/Gemfile index 31413ad136..3df8478650 100644 --- a/Gemfile +++ b/Gemfile @@ -186,6 +186,7 @@ end group :development do gem 'foreman' + gem 'haml_lint', require: false gem 'i18n-tasks' gem 'listen' gem 'pry' diff --git a/Gemfile.lock b/Gemfile.lock index 76327fd924..54d3d10b67 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -372,6 +372,12 @@ GEM temple (>= 0.8.2) thor tilt + haml_lint (0.67.0) + haml (>= 5.0) + parallel (~> 1.10) + rainbow + rubocop (>= 1.0) + sysexits (~> 1.1) hashdiff (1.2.1) hashery (2.1.2) hashie (5.0.0) @@ -851,6 +857,7 @@ GEM attr_required (>= 0.0.5) faraday (~> 2.0) faraday-follow_redirects + sysexits (1.2.0) temple (0.8.2) terminal-table (4.0.0) unicode-display_width (>= 1.1.1, < 4) @@ -990,6 +997,7 @@ DEPENDENCIES gmaps4rails good_migrations haml + haml_lint highline (= 2.0.3) i18n i18n-js (~> 3.9.0) diff --git a/script/reviewdog.sh b/script/reviewdog.sh index 4e4d06848b..1114245e43 100755 --- a/script/reviewdog.sh +++ b/script/reviewdog.sh @@ -39,4 +39,18 @@ bundle exec 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 ))