UDQN File

########################################################################
# Resource Standard Metrics
# User Defined Quality Notices (UDQN) using Perl Compatible Regular
# Expressions (PCRE).  These expressions can be developed interactively
# using the M2 RegX Tool.  This tool is free via the M Squared
# Technologies web site.
#
# PCRE is documented at: http://www.pcre.org/ We acknowledge the use
# of their public domain code and their copyright.
#
# PCRE Tutorials
# http://www.regular-expressions.info/tutorial.html
#
# PCRE Tools
# M Squared Technologies offers a free tool called M2 Regx
# http://msquaredtechnologies.com/m2regx/index.htm
#
# The RegEx Coach is also a very good interactive tool
# http://weitz.de/regex-coach/
#
# RSM UDQN File Format is illustrated in the examples
# Lines with # are considered comments
# 
# Message Macros
# _LINE#_ Line number in the file processed
# _LINE_  Line of code analyzed
# _FILE_  File name processed
# _FUNC_  Current Function Scope if applicable
# _CLASS_ Current Class if applicable
# \n      New Line Break
# Note: You can use HTML tags in the message string, but this will
#       effect your text output.
#
########################################################################
# These premade examples are believed to be correct but are provided
# without warranty, although we would like notice for improving this
# body of work.  Please report updates to support@mSquaredTechnologies.com
# 
# All UDQN are set to Active: No
# To Activate them set Active: Yes
########################################################################
# PCRE Control Settings
# These should not be changed unless you really understand PCRE
# and demand some functional behavior.
REG_ICASE: OFF
REG_NEWLINE: OFF
REG_NOSUB: OFF
REG_EXTENDED: OFF
REG_NOTBOL: OFF
REG_NOTEOL: OFF

########################################################################
# include other UDQN files.  The path must be relative to the master
# UDQN file specified in the rsm.cfg file or be exact to the path/file
# location
# Include: other_udqn.cfg

########################################################################
# Format User Defined Quality Notices, must have unique IDs.
#

# Line Marking the Beginning of a UDQN Block
UDQN Begin :

# User defined identifier must be greater than 100 and less than 4000
UDQN Id    : 101

# Turns the UDQN on of off, Yes - processed, No - not processed
Active     : No

# List of sources for file extenstion which apply to the UDQN
Sources    : c, cpp, java

# Content for which to apply the UDQN
# Context values are Code, Comment, String, Line
Context    : Code

# Perl Compatible Regular Expression
Pattern    : [\s]*if[\s]*\([\w][\s]*=[\s]*[\w]\)

# Test String which you know works, documentation only
String     :   if (d = 5)

# List of flags to be set upon match numbered 1 to 2000
# with a maximum of 32 flags in the list.  All flags
# are cleared at the end of each file.
# Example 1,202,5
Set Flags  :

# List of flags to be cleared upon match
# with a maximum of 32 flags in the list
# Example 1,2,5
Clear Flags:

# List of flags which must be set plus the expression for a match
# with a maximum of 32 flags in the list
# Example 1,2,5
Check Flags:

# List of flags which must not be set plus the expression for a match
# with a maximum of 32 flags in the list
# Example 1,2,5
Not Check Flags:

# Emit this UDQN at the end of the file.  Usually used with the
# not check flags for conditions which have not been met by
# previous UDQN flag sets.
Emit Eof Flag: 

# The silent flag causes a match to not emit messages or summary.
# This is useful for setting flags without a visual notice.
Silent Flag: No

# Message to be displayed for code analysis, can be multiple lines
# with proper line break formatting.
Message    : Line: _LINE#_ An assignment has been found in an if condition

# Summary line to be used in the profile summary
Summary    : An assignment has been found in an if condition

# Ending UDQN Indicator
UDQN End   :

#######################################################################
UDQN Begin   :
UDQN Id      : 102
Active       : Yes
Sources      : c, cpp
Context      : Code
Pattern      : ([\s]*|=)malloc
String       :     =   malloc
Set Flags    : 
Clear Flags  : 
Check Flags  : 
!Check Flags : 
Emit EOF Flag: 
Silent Flag  : No
Message      : Line: _LINE#_ Dynamic memory using malloc is not initialized,\nconsider using the calloc function.
Summary      : Dynamic memory using malloc is not initialized
UDQN End     :

#######################################################################
UDQN Begin   :
UDQN Id      : 103
Active       : Yes
Sources      : c, cpp
Context      : Code
Pattern      : ([\s]*|=)realloc
String       :     =  realloc
Set Flags    : 
Clear Flags  :
Check Flags  :
!Check Flags : 
Emit EOF Flag: 
Silent Flag  : No
Message      : The realloc function has been identified.\nFile: _FILE_\nLine: _LINE#_ \nThis function allocates memory an can cause a memory leak.
Summary      : The realloc function has been identified
UDQN End     :

#######################################################################
UDQN Begin   :
UDQN Id      : 104
Active       : Yes
Sources      : c, cpp, java, cs
Context      : Code
Pattern      : ^[\s]*;[\s]*$
String       : ;
Set Flags    :
Clear Flags  : 
Check Flags  :
!Check Flags : 
Emit EOF Flag: 
Silent Flag  : No
Message      : Line: _LINE#_ A line containing just a semicolon has been identified.
Summary      : A line containing just a semicolon
UDQN End     :

#######################################################################
UDQN Begin   :
UDQN Id      : 105
Active       : Yes
Sources      : c, cpp
Context      : Code
Pattern      : [\s]*#[\s]*define[\s]+[\w]+[\s]*[\d]+
Set Flags    :
Clear Flags  :
Check Flags  :
!Check Flags : 
Emit EOF Flag: 
Silent Flag  : No
String       : #define SOMEMACRO 12345
Message      : Line: _LINE#_ A symbolic constant using #define has been identified.
Summary      : A symbolic constant using #define
UDQN End     :
 
#######################################################################
UDQN Begin   :
UDQN Id      : 106
Active       : No
Sources      : c, cpp, java, cs
Context      : Code
Pattern      : ([\S]+[\s]*}.*)|(.*}[\s]*[;]*[\s]*[^;\s]+)
String       : some code }some code; some code
Set Flags    :
Clear Flags  :
Check Flags  :
!Check Flags : 
Emit EOF Flag: 
Silent Flag  : No
Message      : Line: _LINE#_ The closing brace is not on a standalone line.
Summary      : The closing brace is not on a standalone line
UDQN End     :

#######################################################################
UDQN Begin   :
UDQN Id      : 107
Active       : Yes
Sources      : c, cpp, java, cs
Context      : Code
Pattern      : .*;[\s]*[;]+.*
String       : some code ; some ;;some
Set Flag     :
Clear Flags  :
Check Flags  :
!Check Flags : 
Emit EOF Flag: 
Silent Flag  : No
Message      : Line: _LINE#_ A double ;; has been identified
Summary      : The closing brace is not on a standalone line
UDQN End     :

#######################################################################
UDQN Begin   :
UDQN Id      : 108
Active       : No
Sources      : c, cpp, java, cs
Context      : Line
Pattern      : .*\(C\) Acme Systems 2004.*
String       : /* Require Copyright (C) Acme Systems 2004
Set Flags    :
Clear Flag   :
Check Flag   :
!Check Flags : 
Emit EOF Flag: 
Silent Flag  : No
Message      : Line: _LINE#_ The correct Copyright has been found.
Summary      : The correct Copyright has been found
UDQN End     :

#######################################################################
UDQN Begin   :
UDQN Id      : 109
Active       : Yes
Sources      : c, cpp
Context      : Code
Pattern      : .*\*[\s]*\*.*
String       : char  **x;
Set Flags    :
Clear Flags  :
Check Flags  :
!Check Flags : 
Emit EOF Flag: 
Silent Flag  : No
Message      : Line: _LINE#_ Double pointer indirection identified.
Summary      : Double pointer indirection identified
UDQN End     :

#######################################################################
UDQN Begin   :
UDQN Id      : 110
Active       : No
Sources      : c, cpp, java, cs
Context      : Code
Pattern      :  [\s]*[a-z_]+[\s]*\(.*
String       :   _myfunc    (
Set Flags    :
Clear Flags  :
Check Flags  :
!Check Flags : 
Emit EOF Flag: 
Silent Flag  : No
Message      : Line: _LINE#_ Idenitifier name is all lower case.
Summary      : Identifier name is all lower case
UDQN End     :

#######################################################################
UDQN Begin   :
UDQN Id      : 111
Active       : No
Sources      : cpp
Context      : Code
Pattern      : [\s]*using[\s]*
String       :       using std::cout;
Set Flags    :
Clear Flags  :
Check Flags  :
!Check Flags : 
Emit EOF Flag: 
Silent Flag  : No
Message      : Line: _LINE#_ Identified a using construct\nwhich may comprise the naming in\nthe global namespace.
Summary      : Identified a using construct
UDQN End     :

#######################################################################
UDQN Begin   :
UDQN Id      : 112
Active       : No
Sources      : cpp
Context      : Code
Pattern      : [\s]*\#[\s]*include[\s]*<[\s\w]+\.[\w]+>
String       : #include <stdio.h>
Set Flags    :
Clear Flags  :
Check Flags  :
!Check Flags : 
Emit EOF Flag: 
Silent Flag  : No
Message      : Line: _LINE#_ Non ANSI C++ #include format
Summary      : Non ANSI C++ #include format
UDQN End     :

#######################################################################
UDQN Begin   :
UDQN Id      : 113
Active       : No
Sources      : c, cpp, java
Context      : Code
Pattern      : [\s]*(while|if|for)[\s]*\([\s]*.*[\s]*\)[\s]*;
String       :     while ( x == 7 )  ;
Set Flags    :
Clear Flags  :
Check Flags  :
!Check Flags : 
Emit EOF Flag: 
Silent Flag  : No
Message      : Line: _LINE#_ Control scope prematurely terminated.
Summary      : Control scope prematurely terminated
UDQN End     :

#######################################################################
UDQN Begin   :
UDQN Id      : 114
Active       : No
Sources      : c, cpp, java
Context      : Code
Pattern      : [\s]*(while|if|for)[\s]*\([\s]*.*[\s]*\)[\s]*{
String       :     while ( x == 7 )  {
Set Flags    :
Clear Flags  :
Check Flags  :
!Check Flags : 
Emit EOF Flag: 
Silent Flag  : No
Message      : Line: _LINE#_ Old style control scoping.
Summary      : Old style control scoping
UDQN End     :

#######################################################################
UDQN Begin   :
UDQN Id      : 115
Active       : No
Sources      : c, cpp
Context      : Code
Pattern      : [\s]*[\w]+[\s]*\*[\s]*[\w]+_ptr
String       :   int * my_ptr;
Set Flags    :
Clear Flags  :
Check Flags  :
!Check Flags : 
Emit EOF Flag: 
Silent Flag  : No
Message      : Line: _LINE#_ Pointer does not have a _ptr suffix.
Summary      : Pointer does not have a _ptr suffix
UDQN End     :

#######################################################################
UDQN Begin   :
UDQN Id      : 116
Active       : Yes
Sources      : c, cpp
Context      : Code
Pattern      : [\s]*[\w]+[\s]*\*[\s]*[\w]+_ptr[;,]
String       :   int * my_ptr,
Set Flags    :
Clear Flags  :
Check Flags  :
!Check Flags : 
Emit EOF Flag: 
Silent Flag  : No
Message      : Line: _LINE#_ Pointer variable uninitialized.
Summary      : Pointer variable uninitialized
UDQN End     :

#######################################################################
UDQN Begin   :
UDQN Id      : 117
Active       : Yes
Sources      : cpp
Context      : Code
Pattern      : [\s]*#[\s]*define[\s]*[\w]+[\s]*\(
String       :   #define assign(a,b) a=(char)b
Set Flags    :
Clear Flag   :
Check Flag   :
!Check Flags : 
Emit EOF Flag: 
Silent Flag  : No
Message      : Line: _LINE#_ C style macro identified,\nsuggest inline function.
Summary      : C style macro identified
UDQN End     :

#######################################################################
UDQN Begin   :
UDQN Id      : 118
Active       : Yes
Sources      : cpp, cs, java
Context      : Code
Pattern      : [\s]*struct[\s]*
String       :   struct somestruct
Set Flags    :
Clear Flags  :
Check Flags  :
!Check Flags : 
Emit EOF Flag: 
Silent Flag  : No
Message      : Line: _LINE#_ Keyword struct identified,\nsuggest a class.
Summary      : Keyword struct identified
UDQN End     :

#######################################################################
UDQN Begin   :
UDQN Id      : 119
Active       : Yes
Sources      : c, cpp, java, cs
Context      : Code
Pattern      : [\s]*return[\s]*\(
String       :   return (var);
Set Flags    :
Clear Flags  :
Check Flags  :
!Check Flags : 
Emit EOF Flag: 
Silent Flag  : No
Message      : Line: _LINE#_ Return is not a function,\nno parenthesis should be used.
Summary      : Return is not a function
UDQN End     :

#######################################################################
UDQN Begin   :
UDQN Id      : 120
Active       : No
Sources      : c, cpp
Context      : Code
Pattern      : [\s]*const[\s]*[a-z_]+
String       :  const foo = 10;
Set Flags    :
Clear Flags  :
Check Flags  :
!Check Flags : 
Emit EOF Flag: 
Silent Flag  : No
Message      : Line: _LINE#_ const followed by a lowercase variable.
Summary      : const followed by a lowercase variable
UDQN End     :

#######################################################################
UDQN Begin   :
UDQN Id      : 121
Active       : Yes
Sources      : cpp, java, cs
Context      : Code
Pattern      : [\s]*class[\s]*[a-z_]+
String       :  class myclass
Set Flags    :
Clear Flags  :
Check Flags  :
!Check Flags : 
Emit EOF Flag: 
Silent Flag  : No
Message      : Line: _LINE#_ class name not proper cased
Summary      : class name not proper cased
UDQN End     :

#######################################################################
UDQN Begin   :
UDQN Id      : 122
Active       : No
Sources      : c, cpp
Context      : Code
Pattern      : [\s]*[\w]+[\s]+[a-z_]*[A-Z_]+[\w]*[\s]*[;=,]
String       :    MyObject Object;
Set Flags    :
Clear Flags  :
Check Flags  :
!Check Flags : 
Emit EOF Flag: 
Silent Flag  : No
Message      : Line: _LINE#_ A variable name with a capital\nletter has been found.
Summary      : A variable name with a capital letter
UDQN End     :

#######################################################################
# The following is an example of how to use the !Check Flags with the Emit EOF Flag
# One UDQN sets a flag with the string is found and another UDQN emits a notice
# if this flag is not set by the end of the file.
# These notices will have to set active to work
#######################################################################
UDQN Begin   :
UDQN Id      : 123
Active       : No
Sources      : c
Context      : Line
Pattern      : .*Test Copyright.*
String       : Test Copyright
Set Flags    : 11
Clear Flags  : 
Check Flags  : 
!Check Flags : 
Emit EOF Flag: 
Silent Flag  : Yes
Message      : NA
Summary      : NA
UDQN End     :

#######################################################################
UDQN Begin   :
UDQN Id      : 124
Active       : No
Sources      : c, cpp
Context      : line
Pattern      : .*
String       : any text  
Set Flags    : 
Clear Flags  :
Check Flags  :
!Check Flags : 11
Emit EOF Flag: Yes
Silent Flag  : No
Message      : The test string was not found in the file\nFile: _FILE_\nLine: _LINE#_ \n
Summary      : The test string was not found
UDQN End     :

########################################################################
# UDQN File End