mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-03 21:43:21 +00:00 
			
		
		
		
	In tools/test-documentation line 6:
    echo -e "\e[${color_code}m${message}\e[0m" >&2
             ^-- SC1117: Backslash is literal in "\e". Prefer explicit escaping: "\\e".
                                        ^-- SC1117: Backslash is literal in "\e". Prefer explicit escaping: "\\e".
In tools/test-documentation line 41:
scrapy crawl_with_status documentation_crawler $loglevel
                                               ^-- SC2086: Double quote to prevent globbing and word splitting.
Signed-off-by: Anders Kaseorg <andersk@mit.edu>
		
	
		
			
				
	
	
		
			52 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			52 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
#!/usr/bin/env bash
 | 
						|
set -e
 | 
						|
 | 
						|
color_message () {
 | 
						|
    local color_code="$1" message="$2"
 | 
						|
    printf '\e[%sm%s\e[0m\n' "$color_code" "$message" >&2
 | 
						|
}
 | 
						|
 | 
						|
loglevel=()
 | 
						|
 | 
						|
case $1 in
 | 
						|
    -h|--help)
 | 
						|
        echo "--help, -h                   show this help message and exit"
 | 
						|
        echo "--loglevel=LEVEL, -L LEVEL   log level (default: ERROR)"
 | 
						|
        exit 0
 | 
						|
        ;;
 | 
						|
    -L|--loglevel)
 | 
						|
        loglevel=("$1" "$2")
 | 
						|
        ;;
 | 
						|
    --skip-check-links)
 | 
						|
        skip_check_links=1
 | 
						|
        ;;
 | 
						|
esac
 | 
						|
 | 
						|
cd "$(dirname "$0")"/../docs
 | 
						|
rm -rf _build
 | 
						|
 | 
						|
# collapse_navigation is set to False in conf.py to improve sidebar navigation for users.
 | 
						|
# However, we must change its value to True before we begin testing links.
 | 
						|
# Otherwise, sphinx would generate a large number of links we don't need to test.
 | 
						|
# The crawler would take a very long time to finish and TravisCI would fail as a result.
 | 
						|
sphinx-build -j8 -b html -d _build/doctrees -D html_theme_options.collapse_navigation=True . _build/html
 | 
						|
 | 
						|
if [ -n "$skip_check_links" ]; then
 | 
						|
    color_message 94 "Skipped testing links in documentation."
 | 
						|
    exit 0
 | 
						|
fi
 | 
						|
 | 
						|
color_message 94 "Testing links in documentation..."
 | 
						|
 | 
						|
cd ../tools/documentation_crawler
 | 
						|
set +e
 | 
						|
scrapy crawl_with_status documentation_crawler "${loglevel[@]}"
 | 
						|
result=$?
 | 
						|
if [ "$result" = 1 ]; then
 | 
						|
    color_message 91 "Failed!"
 | 
						|
    exit 1
 | 
						|
else
 | 
						|
    color_message 92 "Passed!"
 | 
						|
    exit 0
 | 
						|
fi
 |