Skip to main content

Visual Basic 6 Scan rules

 

Contrast supports these rules for Visual Basic 6.

Severity

Contrast rule

Engine rule ID

Description

Critical 

B I T N 

OPT.VB6.VBCC.BITN 

BITN: Nested if...then sentences are not allowed 

Critical 

R A D L 

OPT.VB6.VBDS.RADL 

RADL: Avoid absolute paths in Lib definition 

Critical 

O E R N 

OPT.VB6.VBEH.OERN 

OERN: Use of 'On Error Resume Next' 

Critical 

K C R A 

OPT.VB6.VBFA.KCRA 

KCRA: 'Kill' command must not contain absolute paths 

Critical 

O C R A 

OPT.VB6.VBFA.OCRA 

OCRA: 'Open' command must not contain absolute pahts 

Critical 

S C R A 

OPT.VB6.VBFA.SCRA 

SCRA: 'Shell' command must not contain absolute pahts 

Critical 

N C P F 

OPT.VB6.VBFD.NCPF 

NCPF: Maximum number of controls per form 

Critical 

F A O E 

OPT.VB6.VBSF.FAOE 

FAOE: In every source code file must appear 'Option Explicit' declaration 

Critical 

F R D P 

OPT.VB6.VBSF.FRDP 

FRDP: Source files must be in the same directory than project (.vpb file) 

Critical 

E U F P 

OPT.VB6.VBUK.EUFP 

EUFP: Avoid using pointer functions 

Critical 

V N U C 

OPT.VB6.VBVD.VNUC 

VNUC: Public variables must not be used in class modules 

High 

A N E M 

OPT.VB6.VBCC.ANEM 

ANEM: Check number of arguments in the methods 

High 

C P C L 

OPT.VB6.VBCC.CPCL 

CPCL: Cyclomatic complexity for VB6 procedures should be low 

High 

D E V L 

OPT.VB6.VBCC.DEVL 

DEVL: Avoid excessive local variables 

High 

E U V G 

OPT.VB6.VBCC.EUVG 

EUVG: Avoid using global variables (except with 'WithEvents' 

High 

S S D O 

OPT.VB6.VBCC.SSDO 

SSDO: Do not use nested case statements 

High 

A C G E 

OPT.VB6.VBCD.ACGE 

ACGE: Global constants should be Private. 

High 

E C M N 

OPT.VB6.VBCD.ECMN 

ECMN: Avoid constants with the same name 

High 

N C C F 

OPT.VB6.VBCD.NCCF 

NCCF: Constants must follow a naming standard 

High 

D C A V 

OPT.VB6.VBCL.DCAV 

DCAV: Constants declaration should be placed before variables declaration 

High 

D V C P 

OPT.VB6.VBCL.DVCP 

DVCP: Variables declaration should be in the headers of the procedures 

High 

E D L C 

OPT.VB6.VBCL.EDLC 

EDLC: Avoid Functions and Procedures with more than 200 code lines 

High 

F P V D 

OPT.VB6.VBCL.FPVD 

FPVD: Empty function or Procedure detected 

High 

N E C F 

OPT.VB6.VBCL.NECF 

NECF: Line label names must be properly formed 

High 

P E M L 

OPT.VB6.VBCL.PEML 

PEML: PROPERTY procedures must not exceed certain number of code lines 

High 

U L I T 

OPT.VB6.VBCL.ULIT 

ULIT: Do not use inline If...Then statements 

High 

C G N U 

OPT.VB6.VBDC.CGNU 

CGNU: Avoid unused Global Constants 

High 

V G N U 

OPT.VB6.VBDC.VGNU 

VGNU: Avoid unused Global variables 

High 

V L S U 

OPT.VB6.VBDC.VLSU 

VLSU: Avoid unused Local variables 

High 

S D A P 

OPT.VB6.VBDS.SDAP 

SDAP: Declare sentences must have 'Private' scope 

High 

D E D E 

OPT.VB6.VBED.DEDE 

DEDE: 'Enum' declaration scope must be 'Public' or 'Private' 

High 

U E C T 

OPT.VB6.VBEH.UECT 

UECT: Use 'On Error Resume Next' with 'Class_Terminate' event 

High 

U O E H 

OPT.VB6.VBEH.UOEH 

UOEH: Use error-handling routines 

High 

Number used to describe files (Close) 

OPT.VB6.VBFA.CUNF 

CUNF: With 'Close' command, numbers must not be used to describe files 

High 

Number used to describe files (EOF) 

OPT.VB6.VBFA.EUNF 

EUNF: With 'EOF' command, number must not be used to describe files 

High 

Number used to describe files (LOF) 

OPT.VB6.VBFA.LUNF 

LUNF: With 'LOF' command, number must not be used to describe files 

High 

Number used to describe files (File Access) 

OPT.VB6.VBFA.NCAF 

NCAF: With file access commands, number must not be used to describe files 

High 

Close command used, without file number 

OPT.VB6.VBFA.NCSF 

NCSF: Do not use 'Close' command without file number 

High 

Number used to describe files (Open) 

OPT.VB6.VBFA.OUNF 

OUNF: With 'Open' command, number must not be used to describe files 

High 

B B I T 

OPT.VB6.VBFD.BBIT 

BBIT: 'Browser' buttons (...) or buttons with only an image should have activated 'ToolTipText' property 

High 

F C C B 

OPT.VB6.VBFD.FCCB 

FCCB: Forms must have 'ControlBox' 

High 

F I E U 

OPT.VB6.VBFD.FIEU 

FIEU: Forms must implement 'Unload' event 

High 

F T F P 

OPT.VB6.VBFD.FTFP 

FTFP: Forms must have the same font type 

High 

T B M L 

OPT.VB6.VBFD.TBML 

TBML: MaxLenght property must be specificated 

High 

I E O M 

OPT.VB6.VBOU.IEOM 

IEOM: Avoid using 'InStr()' command embedded in 'Mid()' command 

High 

U O C C 

OPT.VB6.VBP.UOCC 

UOCC: Avoid using '+' operator to concatenate strings 

High 

A D P E 

OPT.VB6.VBPD.ADPE 

ADPE: Procedure declaration scope must be always specified 

High 

A D T A 

OPT.VB6.VBPD.ADTA 

ADTA: Formal parameter types must be specified 

High 

A E V R 

OPT.VB6.VBPD.AEVR 

AEVR: Formal parameters must be specified as 'ByVal' or 'ByRef' 

High 

M U P S 

OPT.VB6.VBPD.MUPS 

MUPS: Methods must have an only exit point 

High 

N A C F 

OPT.VB6.VBPD.NACF 

NACF: Formal parameter names must be properly formed 

High 

O A D V 

OPT.VB6.VBPD.OADV 

OADV: Optional formal parameters must have a default value 

High 

N M C P 

OPT.VB6.VBSF.NMCP 

NMCP: Module names (.bas files) must have a preffix 

High 

P C N M 

OPT.VB6.VBSF.PCNM 

PCNM: Class modules names (.cls file) must have a preffix 

High 

P F M D 

OPT.VB6.VBSF.PFMD 

PFMD: MDI Forms must have a preffix 

High 

P F N M 

OPT.VB6.VBSF.PFNM 

PFNM: No MDI forms must have a preffix 

High 

P N D F 

OPT.VB6.VBSF.PNDF 

PNDF: Designer file names (.dsr files) must have a preffix 

High 

P N P P 

OPT.VB6.VBSF.PNPP 

PNPP: Property Page file names (.pag files) must have a preffix 

High 

P N U C 

OPT.VB6.VBSF.PNUC 

PNUC: User Control file names (.ctl files) must have a preffix 

High 

P N U D 

OPT.VB6.VBSF.PNUD 

PNUD: User Document file names (.dob files) must have a preffix 

High 

E T C N 

OPT.VB6.VBTU.ETCN 

ETCN: The names of the Type's elements must be properly formed 

High 

N T C D 

OPT.VB6.VBTU.NTCD 

NTCD: Type names must follow a naming standard 

High 

E S O B 

OPT.VB6.VBUK.ESOB 

ESOB: Do not use 'Option Base' sentence 

High 

E U F I 

OPT.VB6.VBUK.EUFI 

EUFI: Avoid using 'IsMissing()' function 

High 

E V M N 

OPT.VB6.VBVD.EVMN 

EVMN: Avoid variables with the same name 

High 

N V C F 

OPT.VB6.VBVD.NVCF 

NVCF: Public vars must follow a naming standard 

High 

N V L F 

OPT.VB6.VBVD.NVLF 

NVLF: Name of a local variable must follow a naming standard 

High 

N V S F 

OPT.VB6.VBVD.NVSF 

NVSF: Static (shared) vars must follow a naming standard 

High 

N V W F 

OPT.VB6.VBVD.NVWF 

NVWF: Names of 'WithEvents' variables must be properly formed 

High 

V O L D 

OPT.VB6.VBVD.VOLD 

VOLD: Local Object variables must be destroyed 

Info 

O E G0 

OPT.VB6.VBEH.OEG0 

OEG0: Use of 'On Error GoTo 0' 

Info 

U P A A 

OPT.VB6.VBPD.UPAA 

UPAA: Avoid using 'ParamArray' in formal parameters 

Low 

M C P L 

OPT.VB6.VBCL.MCPL 

MCPL: Maximum number of characters per line 

Low 

A O L E 

OPT.VB6.VBEH.AOLE 

AOLE: Avoid using 'On Local Error' 

Low 

C T F P 

OPT.VB6.VBFD.CTFP 

CTFP: Controls must have the same font type 

Low 

N C C P 

OPT.VB6.VBFD.NCCP 

NCCP: Form control names must be properly formed 

Low 

A IV N 

OPT.VB6.VBPP.AIVN 

AIVN: Auto-increment version number must be disabled 

Low 

V I C N 

OPT.VB6.VBPP.VICN 

VICN: 'VersionCompanyName' must be defined 

Low 

V I F D 

OPT.VB6.VBPP.VIFD 

VIFD: 'VersionFileDescription' must be defined 

Low 

V I L C 

OPT.VB6.VBPP.VILC 

VILC: 'VersionLegalCopyright' must be defined 

Low 

V IP N 

OPT.VB6.VBPP.VIPN 

VIPN: 'VersionProductName' must be defined 

Low 

U D M L 

OPT.VB6.VBVD.UDML 

UDML: Avoid using 'Dim' in global variable declarations 

Medium 

T C D A 

OPT.VB6.VBCD.TCDA 

TCDA: Constants must have a defined type 

Medium 

A G L S 

OPT.VB6.VBCL.AGLS 

AGLS: Place property Let/Get/Set accessors together 

Medium 

E S D F 

OPT.VB6.VBCL.ESDF 

ESDF: Avoid modules that contain only declarations 

Medium 

C S U 

OPT.VB6.VBDC.CSU 

CSU: Local constants not used 

Medium 

P S U 

OPT.VB6.VBDC.PSU 

PSU: Parameters not used 

Medium 

E E N P 

OPT.VB6.VBED.EENP 

EENP: Elements names of a statement Enum must follow a naming standard 

Medium 

V N E E 

OPT.VB6.VBED.VNEE 

VNEE: Assign numeric values to 'Enum' elements 

Medium 

T B N E 

OPT.VB6.VBFD.TBNE 

TBNE: CommandButton size must be standar 

Medium 

A N S C 

OPT.VB6.VBP.ANSC 

ANSC: Avoid String comparisons with empty strings or null string 

Medium 

A V D V 

OPT.VB6.VBP.AVDV 

AVDV: Avoid Variant variables 

Medium 

E T R E 

OPT.VB6.VBP.ETRE 

ETRE: Specify return type in functions 

Medium 

U I S C 

OPT.VB6.VBP.UISC 

UISC: Use String Constants instead of 'Chr$()' and 'Chr()' functions 

Medium 

U S C F 

OPT.VB6.VBP.USCF 

USCF: Use Chr$() instead of Chr() for Variant variables 

Medium 

U S D F 

OPT.VB6.VBP.USDF 

USDF: Use 'CurDir$()' and 'Dir$()' functions instead of 'CurDir()' and 'Dir()' 

Medium 

U S E F 

OPT.VB6.VBP.USEF 

USEF: Use 'Left$()', 'Right$()' and 'Mid$()' functions instead of 'Left()', 'Right()' and 'Mid()' 

Medium 

U S H F 

OPT.VB6.VBP.USHF 

USHF: Use 'Hex$()' function instead of 'Hex()' 

Medium 

U S S F 

OPT.VB6.VBP.USSF 

USSF: Use 'Space$()' function instead of 'Space()' 

Medium 

U S T F 

OPT.VB6.VBP.USTF 

USTF: Use 'LTrim$()', 'RTrim$()' and 'Trim$()' functions instead of 'LTrim()', 'RTrim()' and 'Trim()' 

Medium 

M IV D 

OPT.VB6.VBVD.MIVD 

MIVD: Avoid multiple variable declaration in the same declaration statement