sds/slim-lint

View on GitHub
lib/slim_lint/linter/empty_control_statement.rb

Summary

Maintainability
A
0 mins
Test Coverage
# frozen_string_literal: true

module SlimLint
  # Searches for control statements with no code.
  class Linter::EmptyControlStatement < Linter
    include LinterRegistry

    on [:slim, :control] do |sexp|
      _, _, code = sexp
      next unless code[/\A\s*\Z/]

      report_lint(sexp, 'Empty control statement can be removed')
    end
  end
end