Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create rule S6146: "Option Explicit" should be enabled #4582

Merged
merged 3 commits into from
Dec 18, 2024

Conversation

github-actions[bot]
Copy link
Contributor

@github-actions github-actions bot commented Dec 18, 2024

You can preview this rule here (updated a few minutes after each push).

Implementation-Ticket: SONARVBSIX-344

Review

A dedicated reviewer checked the rule description successfully for:

  • logical errors and incorrect information
  • information gaps and missing content
  • text style and tone
  • PR summary and labels follow the guidelines

Copy link
Contributor

@sebastien-marichal sebastien-marichal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use the LaYC format


==== Noncompliant code example
=== Noncompliant code example
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please follow the LaYC format: https://github.com/SonarSource/rspec/blob/master/docs/description.adoc#2-learn-as-you-code-rule-format

The file generated with the github action contains the correct format:

== Why is this an issue?
== How to fix it
You can add here a small sentence to give a short description of the fix to do.
=== Code examples
==== Noncompliant code example
==== Compliant solution

Comment on lines 20 to 22
Sub DoSomething(Parameter As String)
' ...
End Sub
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this can be excluded of the example, it does not bring value to the description IMO.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@@ -0,0 +1,42 @@
== Why is this an issue?

There are several compilations options available for Visual Basic source code and ``++Option Explicit++`` defines compiler behavior for implicit variable declarations. Not specifying ``++Option Explicit++`` will allow creating a variable by it's first usage. This behavior can lead to unexpected runtime errors due to typos in variable names.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
There are several compilations options available for Visual Basic source code and ``++Option Explicit++`` defines compiler behavior for implicit variable declarations. Not specifying ``++Option Explicit++`` will allow creating a variable by it's first usage. This behavior can lead to unexpected runtime errors due to typos in variable names.
There are several compilations options available for Visual Basic source code and `Option Explicit` defines compiler behavior for implicit variable declarations. Not specifying `Option Explicit` will allow creating a variable by it's first usage. This behavior can lead to unexpected runtime errors due to typos in variable names.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@sebastien-marichal sebastien-marichal changed the title Create rule S6146 Create rule S6146: "Option Explicit" should be enabled Dec 18, 2024
Copy link

Quality Gate passed Quality Gate passed for 'rspec-tools'

Issues
0 New issues
0 Fixed issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarQube

Copy link

Quality Gate passed Quality Gate passed for 'rspec-frontend'

Issues
0 New issues
0 Fixed issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarQube

@thahnen thahnen marked this pull request as ready for review December 18, 2024 15:24
Copy link
Contributor

@sebastien-marichal sebastien-marichal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@sebastien-marichal sebastien-marichal merged commit 38ffd02 into master Dec 18, 2024
14 checks passed
@sebastien-marichal sebastien-marichal deleted the rule/S6146-add-vb6 branch December 18, 2024 15:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants