Skip to content

Commit 24c1de1

Browse files
committed
refactor: add early return to make code more readable
--- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed ---
1 parent 6a86074 commit 24c1de1

File tree

1 file changed

+8
-7
lines changed
  • lib/node_modules/@stdlib/_tools/remark/plugins/remark-lint-html-section-structure/lib

1 file changed

+8
-7
lines changed

lib/node_modules/@stdlib/_tools/remark/plugins/remark-lint-html-section-structure/lib/main.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -355,15 +355,16 @@ function linter( tree, file, options, clbk ) {
355355
errCode = 'missing-section-comment';
356356
reportErr( file, node, msg, errCode );
357357
}
358-
} else {
359-
// There's not enough nodes after the section closing tag...
360-
debug( 'Not enough nodes after section end' );
361-
msg = 'Missing section closing comment. Section closing tag should be followed by <!-- /.' + sectionStack[ sectionStack.length - 1 ].className + ' --> comment on a separate line.';
362-
errCode = 'missing-section-comment';
363-
reportErr( file, node, msg, errCode );
358+
359+
sectionStack.pop();
360+
return;
364361
}
365362

366-
// Fall-throughs above are intentional: regardless of errors, pop the section stack:
363+
// There's not enough nodes after the section closing tag...
364+
debug( 'Not enough nodes after section end' );
365+
msg = 'Missing section closing comment. Section closing tag should be followed by <!-- /.' + sectionStack[ sectionStack.length - 1 ].className + ' --> comment on a separate line.';
366+
errCode = 'missing-section-comment';
367+
reportErr( file, node, msg, errCode );
367368
sectionStack.pop();
368369
}
369370
}

0 commit comments

Comments
 (0)