ci: add shell check
This commit is contained in:
		
							parent
							
								
									3f5a85197a
								
							
						
					
					
						commit
						598e1b232d
					
				
					 2 changed files with 25 additions and 0 deletions
				
			
		|  | @ -82,6 +82,12 @@ steps: | ||||||
|   commands: |   commands: | ||||||
|     - ./tools/ci/static_analysis/clang_tidy.sh |     - ./tools/ci/static_analysis/clang_tidy.sh | ||||||
| 
 | 
 | ||||||
|  | - name: shell check | ||||||
|  |   image: ci:latest | ||||||
|  |   pull: if-not-exists | ||||||
|  |   commands: | ||||||
|  |     - ./tools/ci/static_analysis/shell_check.sh | ||||||
|  | 
 | ||||||
| - name: clang format | - name: clang format | ||||||
|   image: ci:latest |   image: ci:latest | ||||||
|   pull: if-not-exists |   pull: if-not-exists | ||||||
|  |  | ||||||
							
								
								
									
										19
									
								
								tools/ci/static_analysis/shell_check.sh
									
										
									
									
									
										Executable file
									
								
							
							
						
						
									
										19
									
								
								tools/ci/static_analysis/shell_check.sh
									
										
									
									
									
										Executable file
									
								
							|  | @ -0,0 +1,19 @@ | ||||||
|  | #!/bin/bash | ||||||
|  | 
 | ||||||
|  | set -euo pipefail | ||||||
|  | cd "$(git rev-parse --show-toplevel)/" | ||||||
|  | 
 | ||||||
|  | has_shellcheck_issues=0 | ||||||
|  | while IFS= read -r -d '' file; do | ||||||
|  |     echo "Checking shell script $file" | ||||||
|  | 
 | ||||||
|  |     if ! shellcheck "$file"; then | ||||||
|  |         echo "❌ Shellcheck issue detected in $file" | ||||||
|  |         has_shellcheck_issues=1 | ||||||
|  |     fi | ||||||
|  | done < <(find ./modules ./tools -name '*.sh' -print0) | ||||||
|  | 
 | ||||||
|  | if [ "$has_shellcheck_issues" -eq 0 ]; then | ||||||
|  |     echo "✅ All files are properly shellchecked! Well done! ^~^" | ||||||
|  | fi | ||||||
|  | exit ${has_shellcheck_issues} | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue