<commit_before>/*---------------------------------------------------------------------------------------------
 *  Copyright (c) Microsoft Corporation. All rights reserved.
 *  Licensed under the MIT License. See License.txt in the project root for license information.
 *--------------------------------------------------------------------------------------------*/

import * as assert from 'assert';
import * as vscode from 'vscode';

suite('vscode', function () {

	test('rpc protocol, proxies not reachable', function () {

		const symProxy = Symbol.for('rpcProxy');
		const symProtocol = Symbol.for('rpcProtocol');

		const proxyPaths: string[] = [];
		const rpcPaths: string[] = [];

		function walk(obj: any, path: string, seen: Set<any>) {
			if (!obj) {
				return;
			}
			if (typeof obj !== 'object' && typeof obj !== 'function') {
				return;
			}
			if (seen.has(obj)) {
				return;
			}
			seen.add(obj);

			if (obj[symProtocol]) {
				rpcPaths.push(`PROTOCOL via ${path}`);
			}
			if (obj[symProxy]) {
				proxyPaths.push(`PROXY '${obj[symProxy]}' via ${path}`);
			}

			for (const key in obj) {
				walk(obj[key], `${path}.${String(key)}`, seen);
			}
		}

		try {
			walk(vscode, 'vscode', new Set());
		} catch (err) {
			assert.fail(err);
		}
		assert.strictEqual(rpcPaths.length, 0, rpcPaths.join('\n'));
		assert.strictEqual(proxyPaths.length, 0, proxyPaths.join('\n'));
	});

});<commit_msg>add todo<commit_after>/*---------------------------------------------------------------------------------------------
 *  Copyright (c) Microsoft Corporation. All rights reserved.
 *  Licensed under the MIT License. See License.txt in the project root for license information.
 *--------------------------------------------------------------------------------------------*/

import * as assert from 'assert';
import * as vscode from 'vscode';

suite('vscode', function () {

	test('rpc protocol, proxies not reachable', function () {

		const symProxy = Symbol.for('rpcProxy');
		const symProtocol = Symbol.for('rpcProtocol');

		const proxyPaths: string[] = [];
		const rpcPaths: string[] = [];

		function walk(obj: any, path: string, seen: Set<any>) {
			if (!obj) {
				return;
			}
			if (typeof obj !== 'object' && typeof obj !== 'function') {
				return;
			}
			if (seen.has(obj)) {
				return;
			}
			seen.add(obj);

			if (obj[symProtocol]) {
				rpcPaths.push(`PROTOCOL via ${path}`);
			}
			if (obj[symProxy]) {
				proxyPaths.push(`PROXY '${obj[symProxy]}' via ${path}`);
			}

			for (const key in obj) {
				walk(obj[key], `${path}.${String(key)}`, seen);
			}
		}

		try {
			walk(vscode, 'vscode', new Set());
		} catch (err) {
			assert.fail(err);
		}
		assert.strictEqual(rpcPaths.length, 0, rpcPaths.join('\n'));
		assert.strictEqual(proxyPaths.length, 0, proxyPaths.join('\n'));

		// todo@jrieken
		// this should be run after/before each test because some objects are short lived,
		// like notebook-editor, documents etc.
	});

});
{'fraction_non_alphanumeric': 0.2791792801883619, 'fraction_numerical': 0.0013454423141607804, 'mean_word_length': 2.1011470281543274, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5216121', 'n_tokens_mistral': 1014, 'n_tokens_neox': 888, 'n_words': 233}