devbonzai 2.1.9 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
const fs = require('fs');
|
|
2
2
|
const path = require('path');
|
|
3
3
|
const glob = require('glob');
|
|
4
|
+
const { getIgnorePatterns, shouldIgnore } = require('../utils/ignore');
|
|
4
5
|
|
|
5
6
|
module.exports = async function scanCodeQuality(req, res) {
|
|
6
7
|
try {
|
|
@@ -10,15 +11,20 @@ module.exports = async function scanCodeQuality(req, res) {
|
|
|
10
11
|
return res.status(400).json({ error: 'projectPath required' });
|
|
11
12
|
}
|
|
12
13
|
|
|
14
|
+
// Get ignore patterns from .ignore file (same blacklist used throughout the codebase)
|
|
15
|
+
const ignorePatterns = getIgnorePatterns();
|
|
16
|
+
|
|
13
17
|
const issues = [];
|
|
14
18
|
|
|
15
19
|
// 1. Check file sizes
|
|
16
|
-
const
|
|
20
|
+
const allFiles = glob.sync('**/*.{js,ts,jsx,tsx,py,java,go}', {
|
|
17
21
|
cwd: projectPath,
|
|
18
|
-
nodir: true
|
|
19
|
-
ignore: ['node_modules/**', 'dist/**', 'build/**', '.git/**']
|
|
22
|
+
nodir: true
|
|
20
23
|
});
|
|
21
24
|
|
|
25
|
+
// Filter out files that match ignore patterns
|
|
26
|
+
const files = allFiles.filter(file => !shouldIgnore(file, ignorePatterns));
|
|
27
|
+
|
|
22
28
|
files.forEach(file => {
|
|
23
29
|
const fullPath = path.join(projectPath, file);
|
|
24
30
|
const content = fs.readFileSync(fullPath, 'utf8');
|
|
@@ -35,11 +41,13 @@ module.exports = async function scanCodeQuality(req, res) {
|
|
|
35
41
|
});
|
|
36
42
|
|
|
37
43
|
// 2. Check folder sizes
|
|
38
|
-
const
|
|
39
|
-
cwd: projectPath
|
|
40
|
-
ignore: ['node_modules/**', 'dist/**', 'build/**', '.git/**']
|
|
44
|
+
const allFolders = glob.sync('**/', {
|
|
45
|
+
cwd: projectPath
|
|
41
46
|
});
|
|
42
47
|
|
|
48
|
+
// Filter out folders that match ignore patterns
|
|
49
|
+
const folders = allFolders.filter(folder => !shouldIgnore(folder, ignorePatterns));
|
|
50
|
+
|
|
43
51
|
folders.forEach(folder => {
|
|
44
52
|
const fullPath = path.join(projectPath, folder);
|
|
45
53
|
const contents = fs.readdirSync(fullPath);
|