| 32 | // implementation. Let those observed connections rank companion headers; |
| 33 | // do not special-case a repository's module names. |
| 34 | const connectedness = (path: string) => /\.(h|hpp)$/.test(path) |
| 35 | ? Math.max(degree.get(path) ?? 0, ...['c', 'cc', 'cpp', 'cxx'].map(extension => degree.get(path.replace(/\.(h|hpp)$/, `.${extension}`)) ?? 0)) |
| 36 | : degree.get(path) ?? 0; |
| 37 | const score = (path: string) => (/\/README\.md$/i.test(path) ? 30000 : 0) + (/\.(h|hpp)$/.test(path) ? 10000 : 0) + (path.split('/').at(-1)?.split('.')[0] === part ? 20000 : 0) |
| 38 | + Math.min(5000, connectedness(path)) - path.split('/').length; |
| 39 | return area.files.filter(path => /\.(h|hpp|c|cc|cpp|cxx|ts|tsx|js|jsx|py|rs|go|java|cs|md)$/.test(path)) |