Compare commits

...

3 Commits

Author SHA1 Message Date
Florian Rival
9bfde5425f Update lint-with-clang-tidy.js 2025-01-22 19:35:46 +01:00
Florian Rival
542d799cc7 Temporarily run clang-tidy on this branch 2025-01-22 19:25:21 +01:00
Florian Rival
8782b5d5b4 Enable clang-tidy on extension C++ files 2025-01-22 19:24:17 +01:00
2 changed files with 12 additions and 14 deletions

View File

@@ -301,13 +301,7 @@ workflows:
- build-gdevelop_js-wasm-only
gdevelop_js-wasm-extra-checks:
jobs:
- build-gdevelop_js-debug-sanitizers-and-extra-checks:
# Extra checks are resource intensive so don't all run them.
filters:
branches:
only:
- master
- /experimental-build.*/
- build-gdevelop_js-debug-sanitizers-and-extra-checks
builds:
jobs:
- build-macos:

View File

@@ -4,11 +4,13 @@ const path = require('path');
const { makeSimplePromisePool } = require('./utils/SimplePromisePool');
const gdevelopRootPath = path.resolve(__dirname, '../../');
const sourcesRootPath = path.join(gdevelopRootPath, 'Core/GDCore');
const coreSourcesRootPath = path.join(gdevelopRootPath, 'Core/GDCore');
const extensionSourcesRootPath = path.join(gdevelopRootPath, 'Extensions');
const excludedPaths = [
'Tools/Localization.cpp', // emscripten code which can't be linted
'Serialization/Serializer.cpp', // Diagnostic that can't be ignored in rapidjson.
'Core/GDCore/Tools/Localization.cpp', // emscripten code which can't be linted
'Core/GDCore/Serialization/Serializer.cpp', // Diagnostic that can't be ignored in rapidjson.
];
const supportedExtensions = ['.cpp', '.h', '.hpp'];
async function findClangTidy() {
const tryClangTidy = (clangTidyCommandName) =>
@@ -78,18 +80,18 @@ function findFiles(directoryPath) {
list.forEach((file) => {
const filePath = path.resolve(directoryPath, file);
const relativePath = path.relative(sourcesRootPath, filePath);
const relativePath = path.relative(gdevelopRootPath, filePath);
const stat = fs.statSync(filePath);
if (stat && stat.isDirectory() && !excludedPaths.includes(relativePath)) {
results = results.concat(findFiles(filePath));
} else {
if (
path.extname(filePath) === '.inl' ||
(!supportedExtensions.includes(path.extname(filePath))) ||
path.basename(filePath) === '.gitignore' ||
excludedPaths.includes(relativePath)
) {
// Ignore .inl files
// Ignore the file.
} else {
results.push(filePath);
}
@@ -108,7 +110,9 @@ async function main() {
process.exit(1);
}
const filesToCheck = findFiles(sourcesRootPath);
const coreFilesToCheck = findFiles(coreSourcesRootPath);
const extensionFilesToCheck = findFiles(extensionSourcesRootPath);
const filesToCheck = [...coreFilesToCheck, ...extensionFilesToCheck];
// Run clang-tidy on each file.
const filesWithErrors = [];