sm-commit AT lists.ibiblio.org
Subject: Source Mage code commit list
List archive
[SM-Commit] GIT changes to master cauldron by Justin Boffemmyer (00d2ac14379e52ab669be3da3c85c23caefc759c)
- From: Justin Boffemmyer <scm AT sourcemage.org>
- To: sm-commit AT lists.ibiblio.org
- Subject: [SM-Commit] GIT changes to master cauldron by Justin Boffemmyer (00d2ac14379e52ab669be3da3c85c23caefc759c)
- Date: Sun, 4 Apr 2010 18:46:04 -0500
GIT changes to master cauldron by Justin Boffemmyer <flux AT sourcemage.org>:
delint/libdelint | 62
++++++++++++++++++++++++++++++++++++++++++++++++-
delint/test-configvars | 2 +
delint/test-errorcodes | 14 +++++++++++
3 files changed, 77 insertions(+), 1 deletion(-)
New commits:
commit 00d2ac14379e52ab669be3da3c85c23caefc759c
Author: Justin Boffemmyer <flux AT sourcemage.org>
Commit: Justin Boffemmyer <flux AT sourcemage.org>
delint: notice of what's being processed
Notify the user of what's being processed. If the processing takes a
long time, the user may just think the delinter is hung if no
notification is given.
commit 097cc74757112b578570cfad8ae00a664cd9fd91
Author: Justin Boffemmyer <flux AT sourcemage.org>
Commit: Justin Boffemmyer <flux AT sourcemage.org>
delint: use warn color for possible errors
Instead of using the notice color, use the warn color for possible
errors. The notice color should be for informational messages
demonstrating what is currently being processed instead.
commit 3e97c367ee24f230583bcf2af28d8b8547c2d354
Author: Justin Boffemmyer <flux AT sourcemage.org>
Commit: Justin Boffemmyer <flux AT sourcemage.org>
delint: check error codes for internel consistency
Added some new checks against the error codes. Error codes are now
cross-checked against the error messages to make sure that for every
code defined there is a corresponding message, and vice versa.
diff --git a/delint/libdelint b/delint/libdelint
index f32a7a8..318a8a5 100644
--- a/delint/libdelint
+++ b/delint/libdelint
@@ -65,12 +65,72 @@ function delint_global_variables() {
do
if ! grep -q "$search=" "$defines"
then
- echo "$(libcolor_file $file): $(libcolor_notice $search)"
+ echo "$(libcolor_file $file): $(libcolor_warn $search)"
fi
done
done
}
+function delint_error_codes() {
+ local errorcodes="$1"
+ local codes=()
+ local msgcode=""
+ local count=""
+
+ # make sure the defines file exists, otherwise we can't check anything
+ if [[ ! -f "$errorcodes" ]]
+ then
+ libcolor_error "error: error code file \"$errorcodes\" not found"
+ echo ""
+ liberror_die $ERR_FATAL
+ fi
+
+ if ! source "$errorcodes" 2 > /dev/null
+ then
+ libcolor_error "error: could not source error code file \"$errorcodes\""
+ echo ""
+ fi
+
+ # get the list of defined error codes
+ codes=( $(grep -o '^ERR_[A-Z_]\+[0-9]*' "$errorcodes" | grep -v
'ERR_MSGS') )
+
+ # test if the number of messages matches the number of error codes
+ if [[ "${#codes[@]}" -ne "${#ERR_MSGS[@]}" ]]
+ then
+ libcolor_error "error: number of error codes not equal to "
+ libcolor_error "number of messages in \"$errorcodes\""
+ echo ""
+ libcolor_error " codes: ${#codes[@]}"
+ echo ""
+ libcolor_error " messages: ${#ERR_MSGS[@]}"
+ echo ""
+
+ echo "${codes[@]}"
+ fi
+
+ # for every error code defined, make sure there is a corresponding message
+ for ((count=0; "$count" < "${#codes[@]}"; count++))
+ do
+ if ! grep -q "${codes[count]}\$" "$errorcodes"
+ then
+ libcolor_error "error: ${codes[count]} defined but has no
corresponding message"
+ echo ""
+ fi
+ done
+
+ # for every error message defined, make sure there is a corresponding code
+ for ((count=0; "$count" < "${#ERR_MSGS[@]}"; count++))
+ do
+ msgcode=$(grep "${ERR_MSGS[count]}.*# " "$errorcodes" | sed 's/.*# //')
+
+ if ! grep -q "^${msgcode}=" "$errorcodes"
+ then
+ libcolor_error "error: $msgcode not defined but message is"
+ echo ""
+ fi
+ done
+}
+
#-------------------------------------------------------------------------------
##
## This software is free software; you can redistribute it and/or modify
diff --git a/delint/test-configvars b/delint/test-configvars
index dfd5927..a8b1970 100755
--- a/delint/test-configvars
+++ b/delint/test-configvars
@@ -74,10 +74,12 @@ then
fi
# check cauldron files
+libcolor_notice "Checking cauldron config variables"
delint_global_variables "$c_conf" "${cauldron_srcs[@]}" | \
grep -v '[^A-Z_]ERR_[A-Z_]*'
# check enchantment files
+libcolor_notice "Checking enchantment config variables"
delint_global_variables "$e_conf" "${enchantment_srcs[@]}" | \
grep -v '[^A-Z_]ERR_[A-Z_]*'
diff --git a/delint/test-errorcodes b/delint/test-errorcodes
index 3849906..d5f557c 100755
--- a/delint/test-errorcodes
+++ b/delint/test-errorcodes
@@ -71,11 +71,25 @@ then
fi
fi
+# check cauldron error codes/messages files for internal consistency
+libcolor_notice "Checking cauldron error codes for internal consistency"
+echo ""
+delint_error_codes "$c_codes"
+
# check cauldron files
+libcolor_notice "Checking cauldron sources against cauldron error codes"
+echo ""
delint_global_variables "$c_codes" "${cauldron_srcs[@]}" | \
grep '[^A-Z_]ERR_[A-Z_]*'
+# check enchantment error codes/messages files for internal consistency
+libcolor_notice "Checking enchantment error codes for internal consistency"
+echo ""
+delint_error_codes "$e_codes"
+
# check enchantment files
+libcolor_notice "Checking enchantment sources against enchantment error
codes"
+echo ""
delint_global_variables "$e_codes" "${enchantment_srcs[@]}" | \
grep '[^A-Z_]ERR_[A-Z_]*'
- [SM-Commit] GIT changes to master cauldron by Justin Boffemmyer (00d2ac14379e52ab669be3da3c85c23caefc759c), Justin Boffemmyer, 04/04/2010
Archive powered by MHonArc 2.6.24.