From 3d5a124321763c3b89323f3e02fcc3584245392a Mon Sep 17 00:00:00 2001 From: Jan Eitzinger Date: Mon, 2 Mar 2026 15:01:44 +0100 Subject: [PATCH] Refine patterns. Do not match commented lines. --- configs/tagger/apps/caracal.txt | 1 - configs/tagger/apps/lammps.txt | 2 +- internal/tagger/detectApp.go | 6 ++++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/configs/tagger/apps/caracal.txt b/configs/tagger/apps/caracal.txt index ed615121..5c5311f7 100644 --- a/configs/tagger/apps/caracal.txt +++ b/configs/tagger/apps/caracal.txt @@ -2,6 +2,5 @@ calc_rate qmdffgen dynamic evbopt -explore black_box poly_qmdff diff --git a/configs/tagger/apps/lammps.txt b/configs/tagger/apps/lammps.txt index d254f82f..38d3aa5d 100644 --- a/configs/tagger/apps/lammps.txt +++ b/configs/tagger/apps/lammps.txt @@ -1 +1 @@ -lmp +\blmp\s+ diff --git a/internal/tagger/detectApp.go b/internal/tagger/detectApp.go index f86dcb6c..54626eff 100644 --- a/internal/tagger/detectApp.go +++ b/internal/tagger/detectApp.go @@ -64,9 +64,11 @@ func (t *AppTagger) scanApp(f *os.File, fns string) { if line == "" { continue } - re, err := regexp.Compile(line) + // Wrap pattern to skip comment lines: match only if not preceded by # on the same line + wrapped := `(?m)^[^#]*` + line + re, err := regexp.Compile(wrapped) if err != nil { - cclog.Errorf("invalid regex pattern '%s' in %s: %v", line, fns, err) + cclog.Errorf("invalid regex pattern '%s' (wrapped: '%s') in %s: %v", line, wrapped, fns, err) continue } ai.patterns = append(ai.patterns, re)