--- /dev/null
+from beancount.core.data import (
+ Entries,
+ Balance,
+ Transaction,
+)
+from .utils import flag, make_error
+
+__plugins__ = ('require_documents',)
+
+
+def require_documents(entries: Entries, options_map, config_string=""):
+ print(options_map)
+ errors = []
+
+ for i, entry in enumerate(entries):
+ if type(entry) is Transaction or type(entry) is Balance:
+ if not 'document' in entry.meta and not 'no-document' in entry.meta:
+ if type(entry) is Transaction:
+ entries[i] = flag(entry)
+ errors.append(make_error(entry, "Missing document."))
+
+ return entries, errors
+