$line) { $line_number = $line_num + 1; // Skip comments $trimmed_line = trim($line); if (str_starts_with($trimmed_line, '//') || str_starts_with($trimmed_line, '*')) { continue; } // Check for window.ClassName = ClassName pattern // This matches window.Anything = Anything if (preg_match('/window\.(\w+)\s*=\s*\1\s*;?/', $line, $matches)) { $class_name = $matches[1]; $this->add_violation( $file_path, $line_number, "Manual window assignment detected for class '{$class_name}'. RSX framework automatically makes classes global.", trim($line), "Remove the line 'window.{$class_name} = {$class_name}' - the class is already global via the RSX manifest system.", 'high' ); } // Also check for generic window assignments that might be problematic // This catches window.SomeName = OtherName patterns that may also be incorrect if (preg_match('/^\s*window\.([A-Z]\w+)\s*=\s*([A-Z]\w+)\s*;?/', $line, $matches)) { // Only flag if it's not the same-name pattern (already handled above) if ($matches[1] !== $matches[2]) { $this->add_violation( $file_path, $line_number, "Manual window assignment detected. Consider if this is necessary - RSX classes are automatically global.", trim($line), "Verify if this manual window assignment is needed. RSX framework classes don't need window assignment.", 'medium' ); } } } } }