Advertisement
AlvinSeville7cf

pre-commit

May 23rd, 2021
303
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.04 KB | None | 0 0
  1. #!/usr/bin/env bash
  2.  
  3. declare -i SUCCESS=0
  4. declare -i SEVERAL_ERRORS_IN_CSHARP_CODE=1
  5. declare -i SEVERAL_ERRORS_IN_MARKDOWN=2
  6. declare -i SEVERAL_UNIT_TESTS_FAILED=3
  7.  
  8. logs_folder="logs"
  9.  
  10. resharper_logs="$logs_folder/resharper-logs.log"
  11. jb inspectcode CommandLineArgumentParser.sln -s=warning -o="$resharper_logs" &> /dev/null
  12. grep -q '<Issues />' "$resharper_logs" || {
  13.     echo "There are several errors in your C# code. Please consider $resharper_logs file for more info."
  14.     exit "$SEVERAL_ERRORS_IN_CSHARP_CODE"
  15. }
  16.  
  17. markdownlint_logs="$logs_folder/markdownlint-logs.log"
  18. markdownlint-cli2 -- *.md &> "$markdownlint_logs" || {
  19.     echo "There are several errors in your Markdown code. Please consider $markdownlint_logs file for more info."
  20.     exit "$SEVERAL_ERRORS_IN_MARKDOWN"
  21. }
  22.  
  23. unittest_logs="$logs_folder/unittest-logs.log"
  24. dotnet test &> "$unittest_logs" || {
  25.     echo "There are several failed unit tests for your C# code. Please consider $unittest_logs file for more info."
  26.     exit "$SEVERAL_UNIT_TESTS_FAILED"
  27. }
  28.  
  29. exit "$SUCCESS"
  30.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement