Refine .asm component extraction: batch DB queries, wider suffix regex, placement check
- Batch the DB lookup per file instead of per code in scripts/ExtractCreoStrings.cs: files_ultima_versione is an unmaterialized view, so each query rescanned the whole files table (~230ms) - batching cuts a multi-minute BFS to seconds. - Widen the code regex to accept a revision letter and a "_..." suffix together (e.g. "9284200366A_C01"), and purely numeric "_NNNN" suffixes (e.g. dimensional variants like "2702220182_8188"), not just letter+digits. - Require bare digit-only candidates to also appear inside a real "Componente ID N (...)"/"Component id N (...)" placement, filtering out incidental references to a containing assembly's own code. - scripts/ExtractCreoStrings.cs now reports only the direct references of the given .asm (one level, matching Creo's own tree for that file) instead of recursing into sub-assemblies. - Port the regex and placement-check refinements to the production AssemblyComponentScanner.cs used by the app's "Trova componenti referenziati" and "Verifica completezza" phases. - Document the new false-positive categories (parent/container self-reference, suppressed/removed components with residual placement, placement missing suffix/bracket detail) in docs/formato-asm.md, generalized beyond the specific assemblies used to find them. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
e6de563f60
commit
9660c4883d
4 files changed
+185
-50
No files matched your search
@@ -14,8 +14,10 @@ public class AssemblyComponentScannerTests
|
||||
[Fact]
|
||||
public void Scarta_codici_con_una_sola_occorrenza()
|
||||
{
|
||||
// "11112222" compare 2 volte (riferimento vero), "99998888" una sola (rumore).
|
||||
string percorso = ScriviAsmFinto("blah 11112222 blah 99998888 blah 11112222 fine");
|
||||
// "11112222" compare 2 volte con un vero placement (riferimento vero), "99998888"
|
||||
// una sola volta senza placement (rumore).
|
||||
string percorso = ScriviAsmFinto(
|
||||
"blah Componente ID 1 (11112222.PRT) blah 99998888 blah 11112222 fine");
|
||||
try
|
||||
{
|
||||
var codici = AssemblyComponentScanner.EstraiCodiciReferenziati(percorso);
|
||||
@@ -25,6 +27,20 @@ public class AssemblyComponentScannerTests
|
||||
finally { File.Delete(percorso); }
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Scarta_codice_ripetuto_senza_un_vero_placement()
|
||||
{
|
||||
// Riferimento al nome di un altro assieme (es. il padre che lo contiene): ripetuto
|
||||
// più volte ma mai dentro un placement "Componente ID N (...)" - va scartato.
|
||||
string percorso = ScriviAsmFinto("padre 33334444 assieme 33334444_D200 33334444");
|
||||
try
|
||||
{
|
||||
var codici = AssemblyComponentScanner.EstraiCodiciReferenziati(percorso);
|
||||
Assert.DoesNotContain("33334444", codici);
|
||||
}
|
||||
finally { File.Delete(percorso); }
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Riconosce_sotto_assiemi_con_suffisso_stile_D100()
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user