Avoid analyzing excluded language files for line counting
This change passes in a list of file types to the line counting analysis. These are the languages for the databases being analyzed. Line count analysis is restricted to these files.
This commit is contained in:
parent
5c0a38d7e4
commit
ee2346270d
31 changed files with 436 additions and 49 deletions
10
lib/count-loc.js
generated
10
lib/count-loc.js
generated
|
|
@ -13,6 +13,13 @@ const supportedLanguages = {
|
|||
ruby: "rb",
|
||||
typescript: "js",
|
||||
};
|
||||
const supportedLanguagesReversed = Object.entries(supportedLanguages).reduce((obj, [key, value]) => {
|
||||
if (!obj[value]) {
|
||||
obj[value] = [];
|
||||
}
|
||||
obj[value].push(key);
|
||||
return obj;
|
||||
}, {});
|
||||
/**
|
||||
* Count the lines of code of the specified language using the include
|
||||
* and exclude glob paths.
|
||||
|
|
@ -26,8 +33,9 @@ const supportedLanguages = {
|
|||
async function countLoc(cwd, include, exclude, dbLanguages, logger) {
|
||||
const result = await new github_linguist_1.LocDir({
|
||||
cwd,
|
||||
include,
|
||||
include: ["**"].concat(include || []),
|
||||
exclude,
|
||||
analysisLanguages: dbLanguages.flatMap((lang) => supportedLanguagesReversed[lang]),
|
||||
}).loadInfo();
|
||||
// The analysis counts LoC in all languages. We need to
|
||||
// extract the languages we care about. Also, note that
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue