fix: 修复CodeQL检测到的代码问题
This commit is contained in:
8
.github/codeql/codeql-config.yml
vendored
Normal file
8
.github/codeql/codeql-config.yml
vendored
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
name: "CodeQL Config"
|
||||||
|
|
||||||
|
# Paths to exclude from analysis
|
||||||
|
paths-ignore:
|
||||||
|
- thirdparty
|
||||||
|
- "**/node_modules"
|
||||||
|
- "**/dist"
|
||||||
|
- "**/bin"
|
||||||
1
.github/workflows/codeql.yml
vendored
1
.github/workflows/codeql.yml
vendored
@@ -31,6 +31,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
languages: ${{ matrix.language }}
|
languages: ${{ matrix.language }}
|
||||||
queries: security-and-quality
|
queries: security-and-quality
|
||||||
|
config-file: ./.github/codeql/codeql-config.yml
|
||||||
|
|
||||||
- name: Autobuild
|
- name: Autobuild
|
||||||
uses: github/codeql-action/autobuild@v3
|
uses: github/codeql-action/autobuild@v3
|
||||||
|
|||||||
@@ -237,7 +237,6 @@ export class UICanvasScalerSystem extends EntitySystem {
|
|||||||
|
|
||||||
let finalCanvasWidth = this.screenInfo.width;
|
let finalCanvasWidth = this.screenInfo.width;
|
||||||
let finalCanvasHeight = this.screenInfo.height;
|
let finalCanvasHeight = this.screenInfo.height;
|
||||||
let finalScale = 1;
|
|
||||||
|
|
||||||
// 处理 CanvasScaler 组件
|
// 处理 CanvasScaler 组件
|
||||||
// Process CanvasScaler components
|
// Process CanvasScaler components
|
||||||
@@ -252,8 +251,8 @@ export class UICanvasScalerSystem extends EntitySystem {
|
|||||||
|
|
||||||
finalCanvasWidth = scaler.computedCanvasWidth;
|
finalCanvasWidth = scaler.computedCanvasWidth;
|
||||||
finalCanvasHeight = scaler.computedCanvasHeight;
|
finalCanvasHeight = scaler.computedCanvasHeight;
|
||||||
finalScale = scaler.computedScale;
|
// scaler.computedScale is stored in the component for other uses
|
||||||
break; // 只使用第一个 CanvasScaler
|
break; // 只使用第一个 CanvasScaler | Only use the first CanvasScaler
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -36,30 +36,24 @@ function updateModuleSizes() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
// Read module.json first
|
||||||
|
const content = fs.readFileSync(moduleJsonPath, 'utf-8');
|
||||||
|
const moduleJson = JSON.parse(content);
|
||||||
|
const oldSize = moduleJson.estimatedSize;
|
||||||
|
|
||||||
// Get actual file size
|
// Get actual file size
|
||||||
const stat = fs.statSync(distIndexPath);
|
const stat = fs.statSync(distIndexPath);
|
||||||
const actualSize = stat.size;
|
const actualSize = stat.size;
|
||||||
|
|
||||||
// Read module.json - use file descriptor to avoid race condition
|
// Update if different
|
||||||
const fd = fs.openSync(moduleJsonPath, 'r+');
|
if (oldSize !== actualSize) {
|
||||||
try {
|
moduleJson.estimatedSize = actualSize;
|
||||||
const content = fs.readFileSync(fd, 'utf-8');
|
const newContent = JSON.stringify(moduleJson, null, 2) + '\n';
|
||||||
const moduleJson = JSON.parse(content);
|
fs.writeFileSync(moduleJsonPath, newContent, 'utf-8');
|
||||||
const oldSize = moduleJson.estimatedSize;
|
const oldKB = oldSize ? (oldSize / 1024).toFixed(1) : 'N/A';
|
||||||
|
const newKB = (actualSize / 1024).toFixed(1);
|
||||||
// Update if different
|
console.log(` ${pkg}: ${oldKB} KB -> ${newKB} KB`);
|
||||||
if (oldSize !== actualSize) {
|
updated++;
|
||||||
moduleJson.estimatedSize = actualSize;
|
|
||||||
const newContent = JSON.stringify(moduleJson, null, 2) + '\n';
|
|
||||||
fs.ftruncateSync(fd, 0);
|
|
||||||
fs.writeSync(fd, newContent, 0, 'utf-8');
|
|
||||||
const oldKB = oldSize ? (oldSize / 1024).toFixed(1) : 'N/A';
|
|
||||||
const newKB = (actualSize / 1024).toFixed(1);
|
|
||||||
console.log(` ${pkg}: ${oldKB} KB -> ${newKB} KB`);
|
|
||||||
updated++;
|
|
||||||
}
|
|
||||||
} finally {
|
|
||||||
fs.closeSync(fd);
|
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error(` Error processing ${pkg}:`, err.message);
|
console.error(` Error processing ${pkg}:`, err.message);
|
||||||
|
|||||||
Reference in New Issue
Block a user