Add clangd-diag-all-source and run it
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
#include "AssetRegistry/AssetRegistryModule.h"
|
||||
#include "AssetRegistry/IAssetRegistry.h"
|
||||
#include "HAL/FileManager.h"
|
||||
#include "UObject/LinkerLoad.h"
|
||||
#include "Asset_Delete.generated.h"
|
||||
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include "CoreMinimal.h"
|
||||
#include "MCPHandler.h"
|
||||
#include "MCPUtils.h"
|
||||
#include "AssetRegistry/AssetData.h"
|
||||
#include "AssetRegistry/IAssetRegistry.h"
|
||||
#include "Asset_FindReferences.generated.h"
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include "Misc/PackageName.h"
|
||||
#include "FileHelpers.h"
|
||||
#include "HAL/FileManager.h"
|
||||
#include "UObject/LinkerLoad.h"
|
||||
#include "Asset_Restore.generated.h"
|
||||
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "MCPHandler.h"
|
||||
#include "MCPAssetFinder.h"
|
||||
#include "MCPUtils.h"
|
||||
#include "MCPPackageMaker.h"
|
||||
#include "Engine/Blueprint.h"
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "MCPHandler.h"
|
||||
#include "Editor.h"
|
||||
#include "Subsystems/AssetEditorSubsystem.h"
|
||||
#include "Editor_ListOpenAssets.generated.h"
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include "CoreMinimal.h"
|
||||
#include "MCPHandler.h"
|
||||
#include "MCPFetcher.h"
|
||||
#include "Editor.h"
|
||||
#include "Subsystems/AssetEditorSubsystem.h"
|
||||
#include "Editor_OpenAsset.generated.h"
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include "MCPHandler.h"
|
||||
#include "MCPFetcher.h"
|
||||
#include "MCPUtils.h"
|
||||
#include "EdGraph/EdGraph.h"
|
||||
#include "EdGraph/EdGraphNode.h"
|
||||
#include "GraphNode_Delete.generated.h"
|
||||
|
||||
|
||||
@@ -4,7 +4,10 @@
|
||||
#include "MCPHandler.h"
|
||||
#include "MCPFetcher.h"
|
||||
#include "MCPUtils.h"
|
||||
#include "Engine/Blueprint.h"
|
||||
#include "EdGraph/EdGraph.h"
|
||||
#include "EdGraph/EdGraphPin.h"
|
||||
#include "EdGraphSchema_K2.h"
|
||||
#include "GraphPin_Connect.generated.h"
|
||||
|
||||
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
#include "MCPHandler.h"
|
||||
#include "MCPFetcher.h"
|
||||
#include "MCPUtils.h"
|
||||
#include "Engine/Blueprint.h"
|
||||
#include "EdGraph/EdGraph.h"
|
||||
#include "EdGraph/EdGraphPin.h"
|
||||
#include "GraphPin_Disconnect.generated.h"
|
||||
|
||||
|
||||
@@ -2,9 +2,11 @@
|
||||
#include "BlueprintExporter.h"
|
||||
#include "Engine/Blueprint.h"
|
||||
#include "EdGraph/EdGraph.h"
|
||||
#include "UObject/Package.h"
|
||||
#include "Exporters/Exporter.h"
|
||||
#include "UnrealExporter.h"
|
||||
#include "Misc/FileHelper.h"
|
||||
#include "Misc/Paths.h"
|
||||
|
||||
void UBlueprintExportSubsystem::Initialize(FSubsystemCollectionBase& Collection)
|
||||
{
|
||||
|
||||
@@ -2,12 +2,12 @@
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "Dom/JsonObject.h"
|
||||
#include "EdGraph/EdGraph.h"
|
||||
#include "EdGraph/EdGraphPin.h"
|
||||
#include "Materials/MaterialInstanceConstant.h"
|
||||
#include "MaterialTypes.h"
|
||||
|
||||
class UBlueprint;
|
||||
class UEdGraph;
|
||||
class UEdGraphNode;
|
||||
class UEdGraphPin;
|
||||
class UMaterial;
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
#include "UObject/ObjectMacros.h"
|
||||
#include "UObject/UObjectGlobals.h"
|
||||
#include "EditorSubsystem.h"
|
||||
#include "EdGraphSchema_K2.h"
|
||||
|
||||
#include "FormatDataLibrary.generated.h"
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ void AlxPlayerControllerBase::UpdateLookAt()
|
||||
if (Possessed == nullptr) return;
|
||||
APawn *Pawn = GetPawn();
|
||||
if (Pawn == nullptr) return;
|
||||
if (Possessed->GetActor() != Pawn) return;
|
||||
if (Possessed->GetActor() != Cast<AActor>(Pawn)) return;
|
||||
if (PlayerCameraManager == nullptr) return;
|
||||
|
||||
CalculateLookAt();
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "ScriptedAnimation.h"
|
||||
#include "Engine/Engine.h"
|
||||
#include "Animation/AnimSequenceBase.h"
|
||||
|
||||
void FlxScriptedAnimation::InitiateFadeOut(double CurrentTime, double AllowedFade)
|
||||
{
|
||||
|
||||
@@ -103,7 +103,7 @@ void LuaSnap::deserialize(StreamBuffer *sb) {
|
||||
// Set up a stack frame manually. Eris deserialization
|
||||
// should have left permstable and regcopy on the stack.
|
||||
assert(lua_gettop(state_) == 2);
|
||||
LuaSpecial permstable(1);
|
||||
[[maybe_unused]] LuaSpecial permstable(1);
|
||||
LuaSpecial regcopy(2);
|
||||
lua_pushnil(state_);
|
||||
lua_pushnil(state_);
|
||||
|
||||
@@ -503,7 +503,7 @@ constexpr auto dec = FormattedNumber<int>(0, false, 0, ' ', 6);
|
||||
// Returns zero if the string is empty, too long, or contains
|
||||
// invalid characters.
|
||||
//
|
||||
static constexpr uint64_t encode_token(std::string_view str) {
|
||||
[[maybe_unused]] static constexpr uint64_t encode_token(std::string_view str) {
|
||||
if (str.size() > 12) return 0;
|
||||
if (str.empty()) return 0;
|
||||
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
#include <string>
|
||||
#include <cstring>
|
||||
#include <cassert>
|
||||
#include <cstdio>
|
||||
#include <pthread.h>
|
||||
#include "drvutil.hpp"
|
||||
|
||||
namespace drvutil {
|
||||
|
||||
|
||||
103
tools/clangd-diag-all-source.py
Executable file
103
tools/clangd-diag-all-source.py
Executable file
@@ -0,0 +1,103 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Run clangd diagnostics on every C++ source file in the project.
|
||||
|
||||
Scans known source directories for .cpp and .h files, then runs
|
||||
clangd-query.py diagnostics on each one, reporting any errors or warnings.
|
||||
"""
|
||||
|
||||
import subprocess
|
||||
import sys
|
||||
import os
|
||||
from pathlib import Path
|
||||
|
||||
# Directories to scan (relative to project root).
|
||||
SOURCE_DIRS = [
|
||||
"Source/Integration",
|
||||
"luprex/cpp/core",
|
||||
"luprex/cpp/drv",
|
||||
"luprex/cpp/wrap",
|
||||
"Plugins/BlueprintMCP/Source/BlueprintMCP/Public",
|
||||
"Plugins/BlueprintMCP/Source/BlueprintMCP/Private",
|
||||
"Plugins/BlueprintMCP/Source/BlueprintMCP/Handlers",
|
||||
]
|
||||
|
||||
# Files to skip (relative to project root).
|
||||
SKIP_FILES = set()
|
||||
|
||||
EXTENSIONS = {".cpp", ".hpp", ".h", ".c"}
|
||||
|
||||
|
||||
def find_project_root():
|
||||
"""Walk up from this script's directory to find the project root."""
|
||||
d = Path(__file__).resolve().parent.parent
|
||||
if (d / "build.py").exists():
|
||||
return d
|
||||
# Fallback: assume cwd.
|
||||
return Path.cwd()
|
||||
|
||||
|
||||
def find_source_files(root):
|
||||
"""Collect all source files from the known directories."""
|
||||
files = []
|
||||
for rel_dir in SOURCE_DIRS:
|
||||
d = root / rel_dir
|
||||
if not d.is_dir():
|
||||
print(f"WARNING: directory not found: {rel_dir}", file=sys.stderr)
|
||||
continue
|
||||
for f in sorted(d.iterdir()):
|
||||
if f.is_file() and f.suffix in EXTENSIONS:
|
||||
rel = f.relative_to(root)
|
||||
if str(rel) not in SKIP_FILES:
|
||||
files.append(rel)
|
||||
return files
|
||||
|
||||
|
||||
def run_diagnostics(root, rel_path):
|
||||
"""Run clangd-query.py diagnostics on a single file. Returns output lines."""
|
||||
result = subprocess.run(
|
||||
[sys.executable, "tools/clangd-query.py", "diagnostics", str(rel_path)],
|
||||
cwd=root,
|
||||
capture_output=True,
|
||||
text=True,
|
||||
timeout=120,
|
||||
)
|
||||
output = result.stdout.strip()
|
||||
if result.returncode != 0 and result.stderr.strip():
|
||||
output += "\n" + result.stderr.strip()
|
||||
return output
|
||||
|
||||
|
||||
def main():
|
||||
root = find_project_root()
|
||||
files = find_source_files(root)
|
||||
print(f"Found {len(files)} source files across {len(SOURCE_DIRS)} directories.\n")
|
||||
|
||||
total_issues = 0
|
||||
files_with_issues = 0
|
||||
|
||||
for i, rel_path in enumerate(files):
|
||||
label = f"[{i+1}/{len(files)}] {rel_path}"
|
||||
print(f"{label} ... ", end="", flush=True)
|
||||
|
||||
try:
|
||||
output = run_diagnostics(root, rel_path)
|
||||
except subprocess.TimeoutExpired:
|
||||
print("TIMEOUT")
|
||||
continue
|
||||
|
||||
if not output or "No problems found" in output or output.strip() == "No diagnostics.":
|
||||
print("ok")
|
||||
else:
|
||||
lines = [l for l in output.splitlines() if l.strip()]
|
||||
count = len(lines)
|
||||
total_issues += count
|
||||
files_with_issues += 1
|
||||
print(f"{count} issue(s)")
|
||||
for line in lines:
|
||||
print(f" {line}")
|
||||
|
||||
print(f"\nDone. {total_issues} issue(s) in {files_with_issues} file(s) out of {len(files)} checked.")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user