_acs-tcl__files__trailing_whitespace (private)
_acs-tcl__files__trailing_whitespace
Defined in packages/acs-tcl/tcl/test/file-test-procs.tcl
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
Source code: set _aa_export {} set body_count 1 foreach testcase_body {{ # if startdir is not $::acs::rootdir/packages, then somebody checked in the wrong thing by accident set startdir $::acs::rootdir/packages aa_log "Checks starting from $startdir" # get tcl files from installed packages set files [list] apm_get_installed_versions -array installed_versions foreach {package_key version} [array get installed_versions] { lappend files {*}[lmap f [apm_get_package_files -package_key $package_key] { if {[ad_file extension $f] ne ".tcl"} continue set f $startdir/$package_key/$f }] } #inspect every Tcl file in the directory tree starting with $startdir set count 0 set good 0 foreach file $files { set f [open $file "r"] set line_numbers "" incr count set whitespace_count 0 set line_number 0 # Check for trailing whitespace in every line while {[gets $f line] >= 0} { incr line_number set last_line $line if {[regexp {[ \t]+$} $line]} { # Found trailing whitespace! incr whitespace_count lappend line_numbers $line_number } } close $f # Check for empty lines at the end of the file if {[regexp {^\s*$} $last_line]} { incr whitespace_count lappend line_numbers "end of file" } # Check results on $file if { $whitespace_count == 0 } { incr good } else { aa_silence_log_entries -severities notice { # # On large installations, these might be too many, # .. we have these lines in the regression log anyway. # aa_log_result fail "$file: trailing whitespace in lines: $line_numbers" } } } aa_log "$good of $count tcl files checked have no trailing whitespace" }} { aa_log "Running testcase body $body_count" set ::__aa_test_indent [info level] set catch_val [catch $testcase_body msg] if {$catch_val != 0 && $catch_val != 2} { aa_log_result "fail" "files__trailing_whitespace (body $body_count): Error during execution: $msg, stack trace: \n$::errorInfo" } incr body_count }XQL Not present: Generic, PostgreSQL, Oracle