Skip to content

Commit

Permalink
Merge pull request #184 from notengrafik/pr/analyze-tool-skips-folders
Browse files Browse the repository at this point in the history
Analyze tool: Recursively process folders
  • Loading branch information
ahankinson authored Sep 10, 2021
2 parents 1a913ca + 1cff1a5 commit ba82d50
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions tools/analyze.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,20 @@ function reportIssue(filePath, lineIndex, line, message) {
}


function* mssPaths(folder) {
for (const item of fs.readdirSync(folder).map(f => path.join(folder, f))) {
if (fs.lstatSync(item).isDirectory()) {
yield* mssPaths(item);
} else if (item.match(/\.mss$/)) {
yield item;
}
}
}


function analyzeUsage(methods, attributes) {
console.log('Analyze libmei and attribute usage...');
for (const fileName of fs.readdirSync(directories.src)) {
const filePath = path.join(directories.src, fileName);
for (filePath of mssPaths(directories.src)) {
const lines = fs.readFileSync(filePath, {encoding: 'utf8'}).split("\n");

for (let lineIndex = 0; lineIndex < lines.length; lineIndex ++) {
Expand Down

0 comments on commit ba82d50

Please sign in to comment.