agentsqripts
Version:
Comprehensive static code analysis toolkit for identifying technical debt, security vulnerabilities, performance issues, and code quality problems
38 lines (34 loc) • 813 B
JavaScript
/**
* @file Security analysis utilities
* @description Utility functions for security vulnerability analysis
*/
const fs = require('fs');
const path = require('path');
/**
* Detect programming language from file extension
* @param {string} filePath - Path to the file
* @returns {string} Detected language
*/
function detectLanguage(filePath) {
const ext = path.extname(filePath).toLowerCase();
const languageMap = {
'.js': 'javascript',
'.jsx': 'javascript',
'.ts': 'typescript',
'.tsx': 'typescript',
'.py': 'python',
'.java': 'java',
'.php': 'php',
'.cs': 'csharp',
'.rb': 'ruby',
'.go': 'go',
'.cpp': 'cpp',
'.c': 'c',
'.html': 'html',
'.htm': 'html'
};
return languageMap[ext] || 'unknown';
}
module.exports = {
detectLanguage
};