Merge pull request #710 from darko-poljak/shellcheck-makefile-target
Shellcheck makefile target
This commit is contained in:
		
				commit
				
					
						cdfa2dc628
					
				
			
		
					 3 changed files with 70 additions and 2 deletions
				
			
		
							
								
								
									
										22
									
								
								Makefile
									
										
									
									
									
								
							
							
						
						
									
										22
									
								
								Makefile
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -39,6 +39,11 @@ PYTHON_VERSION=cdist/version.py
 | 
			
		|||
SPHINXM=make -C $(DOCS_SRC_DIR) man
 | 
			
		||||
SPHINXH=make -C $(DOCS_SRC_DIR) html
 | 
			
		||||
SPHINXC=make -C $(DOCS_SRC_DIR) clean
 | 
			
		||||
 | 
			
		||||
SHELLCHECKCMD=shellcheck -s sh -f gcc -x
 | 
			
		||||
# Skip SC2154 for variables starting with __ since such variables are cdist
 | 
			
		||||
# environment variables.
 | 
			
		||||
SHELLCHECK_SKIP=grep -v ': __.*is referenced but not assigned.*\[SC2154\]'
 | 
			
		||||
################################################################################
 | 
			
		||||
# Manpages
 | 
			
		||||
#
 | 
			
		||||
| 
						 | 
				
			
			@ -253,3 +258,20 @@ test-remote:
 | 
			
		|||
 | 
			
		||||
pep8:
 | 
			
		||||
	$(helper) $@
 | 
			
		||||
 | 
			
		||||
shellcheck-global-explorers:
 | 
			
		||||
	@find cdist/conf/explorer -type f -exec $(SHELLCHECKCMD) {} + | $(SHELLCHECK_SKIP)
 | 
			
		||||
shellcheck-manifests:
 | 
			
		||||
	@find cdist/conf/type -type f -name manifest -exec $(SHELLCHECKCMD) {} + | $(SHELLCHECK_SKIP)
 | 
			
		||||
 | 
			
		||||
shellcheck-local-gencodes:
 | 
			
		||||
	@find cdist/conf/type -type f -name gencode-local -exec $(SHELLCHECKCMD) {} + | $(SHELLCHECK_SKIP)
 | 
			
		||||
 | 
			
		||||
shellcheck-remote-gencodes:
 | 
			
		||||
	@find cdist/conf/type -type f -name gencode-remote -exec $(SHELLCHECKCMD) {} + | $(SHELLCHECK_SKIP)
 | 
			
		||||
 | 
			
		||||
shellcheck-gencodes: shellcheck-local-gencodes shellcheck-remote-gencodes
 | 
			
		||||
 | 
			
		||||
shellcheck-types: shellcheck-manifests shellcheck-gencodes
 | 
			
		||||
 | 
			
		||||
shellcheck: shellcheck-global-explorers shellcheck-types
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -250,6 +250,7 @@ eof
 | 
			
		|||
        "$0" check-date
 | 
			
		||||
        "$0" check-unittest
 | 
			
		||||
        "$0" check-pep8
 | 
			
		||||
        "$0" shellcheck
 | 
			
		||||
 | 
			
		||||
        # Generate version file to be included in packaging
 | 
			
		||||
        "$0" target-version
 | 
			
		||||
| 
						 | 
				
			
			@ -370,7 +371,29 @@ eof
 | 
			
		|||
 | 
			
		||||
    check-pep8)
 | 
			
		||||
        "$0" pep8
 | 
			
		||||
        echo "Please review pep8 report."
 | 
			
		||||
        printf "\\nPlease review pep8 report.\\n"
 | 
			
		||||
        while true
 | 
			
		||||
        do
 | 
			
		||||
            echo "Continue (yes/no)?"
 | 
			
		||||
            any=
 | 
			
		||||
            read any
 | 
			
		||||
            case "$any" in
 | 
			
		||||
                yes)
 | 
			
		||||
                    break
 | 
			
		||||
                ;;
 | 
			
		||||
                no)
 | 
			
		||||
                    exit 1
 | 
			
		||||
                ;;
 | 
			
		||||
                *)
 | 
			
		||||
                    echo "Please answer with 'yes' or 'no' explicitly."
 | 
			
		||||
                ;;
 | 
			
		||||
        esac
 | 
			
		||||
        done
 | 
			
		||||
    ;;
 | 
			
		||||
 | 
			
		||||
    shellcheck)
 | 
			
		||||
        make helper=${helper} WEBDIR=${WEBDIR} shellcheck
 | 
			
		||||
        printf "\\nPlease review shellcheck report.\\n"
 | 
			
		||||
        while true
 | 
			
		||||
        do
 | 
			
		||||
            echo "Continue (yes/no)?"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -285,6 +285,7 @@ eof
 | 
			
		|||
        "$0" check-date
 | 
			
		||||
        "$0" check-unittest
 | 
			
		||||
        "$0" check-pep8
 | 
			
		||||
        "$0" shellcheck
 | 
			
		||||
 | 
			
		||||
        # Generate version file to be included in packaging
 | 
			
		||||
        "$0" target-version
 | 
			
		||||
| 
						 | 
				
			
			@ -432,7 +433,29 @@ eof
 | 
			
		|||
 | 
			
		||||
    check-pep8)
 | 
			
		||||
        "$0" pep8
 | 
			
		||||
        echo "Please review pep8 report."
 | 
			
		||||
        printf "\\nPlease review pep8 report.\\n"
 | 
			
		||||
        while true
 | 
			
		||||
        do
 | 
			
		||||
            echo "Continue (yes/no)?"
 | 
			
		||||
            any=
 | 
			
		||||
            read any
 | 
			
		||||
            case "$any" in
 | 
			
		||||
                yes)
 | 
			
		||||
                    break
 | 
			
		||||
                ;;
 | 
			
		||||
                no)
 | 
			
		||||
                    exit 1
 | 
			
		||||
                ;;
 | 
			
		||||
                *)
 | 
			
		||||
                    echo "Please answer with 'yes' or 'no' explicitly."
 | 
			
		||||
                ;;
 | 
			
		||||
        esac
 | 
			
		||||
        done
 | 
			
		||||
    ;;
 | 
			
		||||
 | 
			
		||||
    shellcheck)
 | 
			
		||||
        make helper=${helper} WEBDIR=${WEBDIR} shellcheck
 | 
			
		||||
        printf "\\nPlease review shellcheck report.\\n"
 | 
			
		||||
        while true
 | 
			
		||||
        do
 | 
			
		||||
            echo "Continue (yes/no)?"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue