Skip to Content.
Sympa Menu

sm-commit - [SM-Commit] GIT changes to master cauldron by Justin Boffemmyer (1db20a0945f921dc02c9361a7b9d461449550c2e)

sm-commit AT lists.ibiblio.org

Subject: Source Mage code commit list

List archive

Chronological Thread  
  • 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 (1db20a0945f921dc02c9361a7b9d461449550c2e)
  • Date: Wed, 7 Apr 2010 07:41:11 -0500

GIT changes to master cauldron by Justin Boffemmyer <flux AT sourcemage.org>:

delint/global_variables | 2 +-
delint/libdelint | 44 +++++++++++++++++++++++++++++++++-----------
delint/test-configvars | 4 +++-
delint/test-errorcodes | 10 +++++-----
delint/test-localvars | 0
5 files changed, 42 insertions(+), 18 deletions(-)

New commits:
commit 1db20a0945f921dc02c9361a7b9d461449550c2e
Author: Justin Boffemmyer <flux AT sourcemage.org>
Commit: Justin Boffemmyer <flux AT sourcemage.org>

delint: don't force the delint path setting

Allow the user to override the path setting by testing if the variable
is set before determining what to set it to.

commit cebd04675fda5eae6fb2ff13010bd0194520169d
Author: Justin Boffemmyer <flux AT sourcemage.org>
Commit: Justin Boffemmyer <flux AT sourcemage.org>

delint: add missing function descriptions

Add missing function headers in libdelint that describe the arguments
the functions take and what they do.

commit d181e8b7ee6599f07493fb17125d3c4dc8ea156f
Author: Justin Boffemmyer <flux AT sourcemage.org>
Commit: Justin Boffemmyer <flux AT sourcemage.org>

delint: better output messages and formatting

Improved the wording of the output messages to be more clear, and
formatted/colored them for better readability as well.

diff --git a/delint/global_variables b/delint/global_variables
index dbd10a7..747abc5 100755
--- a/delint/global_variables
+++ b/delint/global_variables
@@ -16,7 +16,7 @@
##

#-------------------------------------------------------------------------------

-DELINT_PATH="$(dirname $0)"
+DELINT_PATH="${DELINT_PATH:-$(dirname $0)}"

if ! . "$DELINT_PATH/libdelint"
then
diff --git a/delint/libdelint b/delint/libdelint
index ae1ca19..ec9ae65 100644
--- a/delint/libdelint
+++ b/delint/libdelint
@@ -20,7 +20,7 @@
export LC_COLLATE="C"

# ensure that DELINT_PATH has a value
-[[ -z "$DELINT_PATH" ]] && DELINT_PATH="$(dirname $0)"
+DELINT_PATH="${DELINT_PATH:-$(dirname $0)}"

# load liberror (this is not optional)
if ! . "$DELINT_PATH/../lib/liberror"
@@ -36,6 +36,16 @@ then
exit 1
fi

+#-------------------------------------------------------------------------------
+## @param definition file
+## @param source1 [source2 source3...]
+##
+## Tests whether any variables used in source1 (source2, source3, etc.) are
+## defined in the definition file. Any variables that are used but not
defined
+## in the definition file are output via libcolor_warn, preceded by the file
+## they were found in via libcolor_file.
+##
+#-------------------------------------------------------------------------------
function delint_global_variables() {
local defines=""
local file=""
@@ -71,8 +81,17 @@ function delint_global_variables() {
done
}

+#-------------------------------------------------------------------------------
+## @param error code file
+##
+## Ensures that the error code file itself is properly defined, making sure
that
+## for every error code there is a matching error message, and for every
error
+## message there is a matching error code.
+##
+#-------------------------------------------------------------------------------
function delint_error_codes() {
local errorcodes="$1"
+ local leader=" "
local codes=()
local msgcode=""
local count=""
@@ -80,14 +99,17 @@ function delint_error_codes() {
# 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"
+ libcolor_error "error: error code file "
+ libcolor_file "$errorcodes"
+ libcolor_error " 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\""
+ libcolor_error "error: could not source error code file "
+ libcolor_file "$errorcodes"
echo ""
fi

@@ -97,15 +119,13 @@ function delint_error_codes() {
# 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\""
+ libcolor_error "error: "
+ libcolor_error "number of error codes not equal to number of messages"
echo ""
- libcolor_error " codes: ${#codes[@]}"
+ libcolor_error "${leader}codes: ${#codes[@]}"
echo ""
- libcolor_error " messages: ${#ERR_MSGS[@]}"
+ libcolor_error "${leader}messages: ${#ERR_MSGS[@]}"
echo ""
-
- echo "${codes[@]}"
fi

# for every error code defined, make sure there is a corresponding message
@@ -113,7 +133,8 @@ function delint_error_codes() {
do
if ! grep -q "${codes[count]}\$" "$errorcodes"
then
- libcolor_error "error: ${codes[count]} defined but has no
corresponding message"
+ libcolor_error "error: ${codes[count]}: "
+ libcolor_error "DEFINED but has no corresponding message"
echo ""
fi
done
@@ -125,7 +146,8 @@ function delint_error_codes() {

if ! grep -q "^${msgcode}=" "$errorcodes"
then
- libcolor_error "error: $msgcode not defined but message is"
+ libcolor_error "error: $msgcode: "
+ libcolor_error "NOT DEFINED but message is"
echo ""
fi
done
diff --git a/delint/local_variables b/delint/local_variables
new file mode 100755
index 0000000..e69de29
diff --git a/delint/return_values b/delint/return_values
new file mode 100755
index 0000000..e69de29
diff --git a/delint/test-configvars b/delint/test-configvars
index a8b1970..0ad5034 100755
--- a/delint/test-configvars
+++ b/delint/test-configvars
@@ -19,7 +19,7 @@

#-------------------------------------------------------------------------------


-DELINT_PATH="$(dirname $0)"
+DELINT_PATH="${DELINT_PATH:-$(dirname $0)}"

cauldron="$DELINT_PATH/../cauldron"
c_conf="$cauldron/etc/config"
@@ -75,11 +75,13 @@ fi

# check cauldron files
libcolor_notice "Checking cauldron config variables"
+echo ""
delint_global_variables "$c_conf" "${cauldron_srcs[@]}" | \
grep -v '[^A-Z_]ERR_[A-Z_]*'

# check enchantment files
libcolor_notice "Checking enchantment config variables"
+echo ""
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 d5f557c..5e42663 100755
--- a/delint/test-errorcodes
+++ b/delint/test-errorcodes
@@ -17,7 +17,7 @@
##

#-------------------------------------------------------------------------------

-DELINT_PATH="$(dirname $0)"
+DELINT_PATH="${DELINT_PATH:-$(dirname $0)}"

cauldron="$DELINT_PATH/../cauldron"
c_codes="$cauldron/errorcodes"
@@ -72,23 +72,23 @@ then
fi

# check cauldron error codes/messages files for internal consistency
-libcolor_notice "Checking cauldron error codes for internal consistency"
+libcolor_notice "Checking cauldron errorcodes for internal consistency"
echo ""
delint_error_codes "$c_codes"

# check cauldron files
-libcolor_notice "Checking cauldron sources against cauldron error codes"
+libcolor_notice "Checking cauldron sources for undefined 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"
+libcolor_notice "Checking enchantment errorcodes for internal consistency"
echo ""
delint_error_codes "$e_codes"

# check enchantment files
-libcolor_notice "Checking enchantment sources against enchantment error
codes"
+libcolor_notice "Checking enchantment sources for undefined error codes"
echo ""
delint_global_variables "$e_codes" "${enchantment_srcs[@]}" | \
grep '[^A-Z_]ERR_[A-Z_]*'
diff --git a/delint/test-localvars b/delint/test-localvars
new file mode 100755
index 0000000..e69de29



  • [SM-Commit] GIT changes to master cauldron by Justin Boffemmyer (1db20a0945f921dc02c9361a7b9d461449550c2e), Justin Boffemmyer, 04/07/2010

Archive powered by MHonArc 2.6.24.

Top of Page