SonarSource Rules
  • Products

    In-IDE

    Code Quality and Security in your IDE with SonarQube Ide

    IDE extension that lets you fix coding issues before they exist!

    Discover SonarQube for IDE

    SaaS

    Code Quality and Security in the cloud with SonarQube Cloud

    Setup is effortless and analysis is automatic for most languages

    Discover SonarQube Cloud

    Self-Hosted

    Code Quality and Security Self-Hosted with SonarQube Server

    Fast, accurate analysis; enterprise scalability

    Discover SonarQube Server
  • SecretsSecrets
  • ABAPABAP
  • AnsibleAnsible
  • ApexApex
  • AzureResourceManagerAzureResourceManager
  • CC
  • C#C#
  • C++C++
  • CloudFormationCloudFormation
  • COBOLCOBOL
  • CSSCSS
  • DartDart
  • DockerDocker
  • FlexFlex
  • GitHub ActionsGitHub Actions
  • GoGo
  • HTMLHTML
  • JavaJava
  • JavaScriptJavaScript
  • JSONJSON
  • JCLJCL
  • KotlinKotlin
  • KubernetesKubernetes
  • Objective CObjective C
  • PHPPHP
  • PL/IPL/I
  • PL/SQLPL/SQL
  • PythonPython
  • RPGRPG
  • RubyRuby
  • RustRust
  • ScalaScala
  • ShellShell
  • SwiftSwift
  • TerraformTerraform
  • TextText
  • TypeScriptTypeScript
  • T-SQLT-SQL
  • VB.NETVB.NET
  • VB6VB6
  • XMLXML
  • YAMLYAML
VB6

VB6 static code analysis

Unique rules to find Bugs, Security Hotspots, and Code Smells in your VB6 code

  • All rules 45
  • Bug1
  • Security Hotspot1
  • Code Smell43
Filtered: 3 rules found
cwe
    Impact
      Clean code attribute
        1. "Select" statements should end with a "Case Else" clause

           Code Smell
        2. Track uses of "TODO" tags

           Code Smell
        3. Track uses of "FIXME" tags

           Code Smell

        "Select" statements should end with a "Case Else" clause

        intentionality - clear
        maintainability
        Code Smell
        • cwe

        Why is this an issue?

        More Info

        The requirement for a final Case Else clause is defensive programming. The clause should either take appropriate action or contain a suitable comment as to why no action is taken. Even when the Select covers all current values of an enum, a Case Else case should still be used because there is no guarantee that the enum won’t be extended.

        Noncompliant code example

        Dim number As Integer = 8
        Select Case number   'Non-Compliant, what to do when number is not between 1 and 10 ?
            Case 1 To 5
                Debug.WriteLine("Between 1 and 5, inclusive")
                ' The following is the only Case clause that evaluates to True.
            Case 6, 7, 8
                Debug.WriteLine("Between 6 and 8, inclusive")
            Case 9 To 10
                Debug.WriteLine("Equal to 9 or 10")
        End Select
        

        Compliant solution

        Dim number As Integer = 8
        Select Case number
            Case 1 To 5
                Debug.WriteLine("Between 1 and 5, inclusive")
                ' The following is the only Case clause that evaluates to True.
            Case 6, 7, 8
                Debug.WriteLine("Between 6 and 8, inclusive")
            Case 9 To 10
                Debug.WriteLine("Equal to 9 or 10")
            Case Else
                Debug.WriteLine("Greater than 10")
        End Select
        
          Available In:
        • SonarQube ServerAnalyze code in your
          on-premise CI
          Enterprise
          Edition
          Available Since
          9.1

        © 2008-2025 SonarSource SA. All rights reserved.

        Privacy Policy | Cookie Policy | Terms of Use