mirror of
				https://github.com/luanti-org/luanti.git
				synced 2025-10-31 15:35:21 +01:00 
			
		
		
		
	Check for indent spaces and fixed found problems. Lib C/C++ code is not checked.
This commit is contained in:
		
							
								
								
									
										28
									
								
								.github/workflows/whitespace_checks.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										28
									
								
								.github/workflows/whitespace_checks.yml
									
									
									
									
										vendored
									
									
								
							| @@ -14,6 +14,7 @@ on: | ||||
|       - '**.sh' | ||||
|       - '**.cmake' | ||||
|       - '**.glsl' | ||||
|       - '**.lua' | ||||
|   pull_request: | ||||
|     paths: | ||||
|       - '**.txt' | ||||
| @@ -24,6 +25,7 @@ on: | ||||
|       - '**.sh' | ||||
|       - '**.cmake' | ||||
|       - '**.glsl' | ||||
|       - '**.lua' | ||||
|  | ||||
| jobs: | ||||
|   trailing_whitespaces: | ||||
| @@ -34,6 +36,32 @@ jobs: | ||||
|       - name: Check trailing whitespaces | ||||
|         run: if git ls-files | grep -E '\.txt$|\.md$|\.[ch]$|\.cpp$|\.hpp$|\.sh$|\.cmake$|\.glsl$' | xargs grep -n '\s$'; then echo -e "\033[0;31mFound trailing whitespace"; (exit 1); else (exit 0); fi | ||||
|  | ||||
|   indent_spaces: | ||||
|     runs-on: ubuntu-latest | ||||
|     steps: | ||||
|       - uses: actions/checkout@v4 | ||||
|       # Line endings are already ensured by .gitattributes | ||||
|       # Multiple multline comments in one line is not supported by this check  | ||||
|       # and there is no reason to use them | ||||
|       # So lines like: "/* */ /*" or "*/ a = 5; /*" will result in error | ||||
|       - name: Check for unsupported multiline comments | ||||
|         run: | | ||||
|           if git ls-files | grep -E '^src/.*\.cpp$|^src/.*\.[ch]$' | xargs grep -n '\*/.*/\*'; then echo -e "\033[0;31mUnsupported combination of multiline comments. New multiline comment should begin on new line."; (exit 1); else (exit 0); fi | ||||
|           if git ls-files | grep -E '\.lua$' | xargs grep -n -e '\]\].*--\[\['; then echo -e "\033[0;31mUnsupported combination of multiline comments. New multiline comment should begin on new line."; (exit 1); else (exit 0); fi | ||||
|       # This prepare files for final check  | ||||
|       # See python script ./util/ci/indent_tab_preprocess.py for details. | ||||
|       - name: Preprocess files | ||||
|         run: | | ||||
|           git ls-files | grep -E '^src/.*\.cpp$|^src/.*\.[ch]$' | xargs -L 1 -P $(($(nproc) + 1)) python3 ./util/ci/indent_tab_preprocess.py "/*" "*/" | ||||
|           git ls-files | grep -E '\.lua$' | xargs -L 1 -P $(($(nproc) + 1))  python3 ./util/ci/indent_tab_preprocess.py "--[[" "]]" | ||||
|       # Check for bad indent. | ||||
|       # This runs over preprocessed files. | ||||
|       # If there is any remaining space on line beginning or after tab, | ||||
|       # error is generated | ||||
|       - name: Check indent spaces | ||||
|         run: | | ||||
|           if git ls-files | grep -E '^src/.*\.cpp$|^src/.*\.[ch]$|\.lua' | xargs grep -n -P '^\t*[ ]'; then echo -e "\033[0;31mFound incorrect indent whitespaces"; (exit 1); else (exit 0); fi | ||||
|  | ||||
|   tabs_lua_api_files: | ||||
|     runs-on: ubuntu-latest | ||||
|     steps: | ||||
|   | ||||
		Reference in New Issue
	
	Block a user