Skip to content

Fix built-in functions being double-counted as regular tags - #8

Draft
fafouine wants to merge 1 commit into
mainfrom
claude/fix-builtin-double-count-3b4072e6ebfe816c829700a9323d097c
Draft

Fix built-in functions being double-counted as regular tags#8
fafouine wants to merge 1 commit into
mainfrom
claude/fix-builtin-double-count-3b4072e6ebfe816c829700a9323d097c

Conversation

@fafouine

@fafouine fafouine commented Aug 6, 2026

Copy link
Copy Markdown
Owner

Summary

In scripts/generate_tag_index.py, the regular-tag pattern #(\w+) also matches the name inside a built-in such as #print(). Because #(\w+)\(\) (built-ins) and #(\w+) (regular tags) both scan the same text, #print() was captured by both — so print showed up in the built-ins index and as a regular #print tag, producing duplicate/misleading entries (and its generated print.md page was overwritten).

Fix

After extracting methods and built-ins, drop any regular tag whose name was already captured as a method or built-in:

# The regular-tag pattern (#word) also matches the name inside a
# built-in like #print(), so #print() lands in both built_ins and
# regular_tags. Drop any regular tag whose name was already captured
# as a method or built-in to avoid double-counting.
reserved = set(methods) | set(built_ins)
regular_tags = [tag for tag in regular_tags if tag not in reserved]

Verification

  • Reproduced the bug: for a sample containing #print() #len() #.append() #python #Web_Security, the original code returns regular_tags = ['print', 'len', 'python', 'Web_Security'].
  • After the fix, regular_tags = ['python', 'Web_Security']; built_ins = ['print', 'len']; methods = ['append', 'split'].
  • Ran the full script end-to-end against a sample log file: #print()/#len() now appear only under Built-in Functions and no longer under Tags in tags/index.md. Temporary sample/generated files were removed so this PR contains only the one-file change.

Task & docs

The regular-tag pattern #(\w+) also matches the name inside a built-in
such as #print(), so #print() was counted both in the built-ins index
and as a regular #print tag. After extracting methods and built-ins,
drop any regular tag whose name was already captured as a method or
built-in.
@fafouine fafouine self-assigned this Aug 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants