Comment on syntax errors (#656)
This commit is contained in:
		
							parent
							
								
									fe2b9718e1
								
							
						
					
					
						commit
						46502ac44a
					
				
							
								
								
									
										16
									
								
								.github/workflows/lint_c.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										16
									
								
								.github/workflows/lint_c.yml
									
									
									
									
										vendored
									
									
								
							| @ -43,7 +43,19 @@ jobs: | ||||
|         uses: ./.github/actions/docker | ||||
| 
 | ||||
|       - name: 'Check syntax' | ||||
|         id: syntax_check | ||||
|         uses: ./.github/actions/docker | ||||
|         continue-on-error: false | ||||
|         with: | ||||
|           run: /syntax_check.sh | ||||
|           run: SET_GH_OUTPUT=1 /syntax_check.sh | ||||
| 
 | ||||
|       - name: Report syntax errors | ||||
|         if: failure() && steps.syntax_check.outputs.errors && github.event.pull_request | ||||
|         uses: peter-evans/create-or-update-comment@v1 | ||||
|         with: | ||||
|           issue-number: ${{ github.event.pull_request.number }} | ||||
|           body: | | ||||
|             Please fix following syntax errors: | ||||
|             ``` | ||||
|             ${{ steps.syntax_check.outputs.errors }} | ||||
|             ``` | ||||
|             You might want to run `docker compose exec dev /syntax_check.sh` for an auto-fix. | ||||
| @ -3,7 +3,6 @@ | ||||
| # set -e | ||||
| 
 | ||||
| CLANG_FORMAT_BIN="/usr/bin/clang-format-12" | ||||
| PATH="$HOME/.cargo/bin:${PATH}" | ||||
| 
 | ||||
| PROJECT_DIR=$(pwd) | ||||
| 
 | ||||
| @ -19,14 +18,20 @@ C_FILES=$(find . \ | ||||
| 
 | ||||
| ulimit -s 65536 | ||||
| $CLANG_FORMAT_BIN --version | ||||
| $CLANG_FORMAT_BIN --verbose -style=file -n --Werror --ferror-limit=0 $C_FILES | ||||
| c_syntax_rc=$? | ||||
| errors=$($CLANG_FORMAT_BIN --verbose -style=file -n --Werror --ferror-limit=0 $C_FILES |& tee /dev/stderr | sed '/^Formatting/d') | ||||
| 
 | ||||
| if [[ $c_syntax_rc -eq 0 ]]; then | ||||
| if [[ -z "$errors" ]]; then | ||||
|     echo "Code looks fine for me!" | ||||
|     exit 0 | ||||
| fi | ||||
| 
 | ||||
| if [[ -n "${SET_GH_OUTPUT}" ]]; then | ||||
|     errors="${errors//'%'/'%25'}" | ||||
|     errors="${errors//$'\n'/'%0A'}" | ||||
|     errors="${errors//$'\r'/'%0D'}" | ||||
|     echo "::set-output name=errors::$errors" | ||||
| fi | ||||
| 
 | ||||
| read -p "Do you want fix syntax? (y/n): " confirm && [[ $confirm == [yY] || $confirm == [yY][eE][sS] ]] || exit 1 | ||||
| 
 | ||||
| cd $PROJECT_DIR | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Anna Prosvetova
						Anna Prosvetova