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

Fix problem with variables in comments #96

Merged
merged 1 commit into from
Jul 13, 2023

Conversation

panopticoncentral
Copy link

The code to detect variables in SPL2 code is a bit primitive at the moment and currently will catch commented-out variables. This tweaks the regex to require a variable to occur at the start of the line with just whitespace before it.

@@ -129,7 +129,7 @@ export function dispatchSpl2Module(service: any, spl2Module: string, app: string
namespace = '';
app = app || 'search'; // default to search app
// Get last statement assignment '$my_statement = ...' -> 'my_statement'
const statementMatches = [...spl2Module.matchAll(/\$([a-zA-Z0-9_]+)[\s]*=/gm)];
const statementMatches = [...spl2Module.matchAll(/^\s*\$([a-zA-Z0-9_]+)[\s]*=/gm)];

Choose a reason for hiding this comment

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

seems to be still matching inside doc comment, are we cool with that for now?
Screenshot 2023-07-12 at 2 26 03 PM

Choose a reason for hiding this comment

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

My bad. We're targetting fix for single line comments for now

Copy link

@thesplunker thesplunker left a comment

Choose a reason for hiding this comment

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

🚀

@JasonConger JasonConger merged commit 4226eea into splunk:master Jul 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants