guluo2016 commented on code in PR #7167: URL: https://github.com/apache/hbase/pull/7167#discussion_r2237215541
########## hbase-shell/src/main/ruby/irb/hirb.rb: ########## @@ -23,6 +23,70 @@ module IRB # Subclass of IRB so can intercept methods class HIRB < Irb + # Method for checking the variable name conflict with the hbase command name + def check_variable_assignment_conflict(line) + # checks when a single variable is defined at a time (eg a = 10) or multiple variable assignment (e.g., a,b,c = 1,2,3) + single_match = line.strip.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\s*=\s*(.+)/) + multiple_match = line.strip.match(/^([a-zA-Z_][a-zA-Z0-9_]*(?:\s*,\s*[a-zA-Z_][a-zA-Z0-9_]*)+)\s*=\s*(.+)/) + + # Match comma-based expressions that may result in nil assignment to a variable + comma_expression = line.strip.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\s*,\s*(.+)/) + + variable_names = [] + + if multiple_match + # Extract all variable names during multiple assignment + left_side = multiple_match[1] + variable_names = left_side.split(',').map(&:strip) + elsif single_match + # Extracting variable name for single assignment + variable_names = [single_match[1]] + elsif comma_expression + # Handle comma expressions that create variables (like list_namespace,'ns.*') + variable_names = [comma_expression[1]] + else + # if no assignment pattern found + return false + end + + # return false if variable_names is empty + return false if variable_names.empty? + + receiver = @context.workspace.binding.receiver Review Comment: `receiver` seems unused. do we need this line of code? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@hbase.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org