UNPKG

unqommented

Version:

A Node.js utility that quickly identifies files with uncommented code in your codebase. Designed for developers who want to efficiently tell LLMs exactly which files need comments added.

31 lines (26 loc) 988 B
require('qtests/setup'); const { test, expect, describe, beforeAll, afterAll } = require('@jest/globals'); const fs = require('fs'); const path = require('path'); const os = require('os'); const utils = require('../utils'); let tmpDir; beforeAll(() => { tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'unqommented-ext-')); fs.writeFileSync(path.join(tmpDir, 'sample.py'), 'print("hi")\n# comment'); fs.writeFileSync( path.join(tmpDir, 'Example.java'), '// a comment\npublic class Example { public static void main(String[] args) { System.out.println("hi"); } }' ); }); afterAll(() => { fs.rmSync(tmpDir, { recursive: true, force: true }); }); describe('findUncommentedFiles other extensions', () => { test('detects uncommented .py and .java files', async () => { const result = await utils.findUncommentedFiles(tmpDir); const files = result.uncommentedFiles; expect(files).toContain('sample.py'); expect(files).toContain('Example.java'); }); });