diff --git a/app/views/groups/milestones/index.html.haml b/app/views/groups/milestones/index.html.haml index 048606e2db46770a3a15993b145470bb54d6413e..5c0487db0fc9cd9cbbdfafb92c09b2d5fa3a1543 100644 --- a/app/views/groups/milestones/index.html.haml +++ b/app/views/groups/milestones/index.html.haml @@ -12,7 +12,7 @@ = link_to _('New milestone'), new_group_milestone_path(@group), class: "btn gl-button btn-confirm", data: { qa_selector: "new_group_milestone_link" } - if @milestones.blank? - = render 'shared/empty_states/milestones_tab', learn_more_path: help_page_path('user/group/milestones') do + = render 'shared/empty_states/milestones_tab', learn_more_path: help_page_path('user/project/milestones/index') do - if can?(current_user, :admin_milestone, @group) .text-center = link_to _('New milestone'), new_group_milestone_path(@group), class: "btn gl-button btn-confirm", data: { qa_selector: "new_group_milestone_link" } @@ -26,7 +26,7 @@ = render 'milestone', milestone: milestone = paginate @milestones, theme: "gitlab" - else - = render 'shared/empty_states/milestones', learn_more_path: help_page_path('user/group/milestones') do + = render 'shared/empty_states/milestones', learn_more_path: help_page_path('user/project/milestones/index') do - if can?(current_user, :admin_milestone, @group) .text-center = link_to _('New milestone'), new_group_milestone_path(@group), class: "btn gl-button btn-confirm", data: { qa_selector: "new_group_milestone_link" } diff --git a/haml_lint/linter/documentation_links.rb b/haml_lint/linter/documentation_links.rb index 8c696b26b13d6f025dbad1880f12bece20996dcd..0cabae40c4b5a6187022a038b1557c4e376bf249 100644 --- a/haml_lint/linter/documentation_links.rb +++ b/haml_lint/linter/documentation_links.rb @@ -68,7 +68,15 @@ def fetch_ast_tree(node) # Sometimes links are provided via data attributes in html tag return node.parsed_attributes.syntax_tree if node.type == :tag - node.parsed_script.syntax_tree + parse_script(node).syntax_tree + end + + def parse_script(node) + # It's a workaround for cases for scripts ending with "do" + # For some reason they don't parse correctly + code = node.script.delete_suffix(' do') + + HamlLint::ParsedRuby.new(HamlLint::RubyParser.new.parse(code)) end def detect_path_to_file(link) diff --git a/spec/haml_lint/linter/documentation_links_spec.rb b/spec/haml_lint/linter/documentation_links_spec.rb index 75002097d698376838d4a0667c3b6d2bc7129c42..f2aab4304c1f1710b9dc99e263d4e95e227dc9bd 100644 --- a/spec/haml_lint/linter/documentation_links_spec.rb +++ b/spec/haml_lint/linter/documentation_links_spec.rb @@ -43,6 +43,12 @@ let(:haml) { "= link_to 'Description', #{link_pattern}('wrong.md'), target: '_blank'" } it { is_expected.to report_lint } + + context 'when haml ends with block definition' do + let(:haml) { "= link_to 'Description', #{link_pattern}('wrong.md') do" } + + it { is_expected.to report_lint } + end end context 'when link with wrong file path is assigned to a variable' do