Подтвердить запуск чистого экспорта и завершить аудит решения
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
"""Read-only audit: original materials, authorship, secrets and previous project."""
|
||||
from pathlib import Path
|
||||
import json
|
||||
import subprocess
|
||||
ROOT=Path(__file__).resolve().parents[1]
|
||||
def git(*args): return subprocess.check_output(['git',*args],cwd=ROOT)
|
||||
base='ec540a1'
|
||||
protected=['README.md','COURSE.md','CONTRIBUTING.md','MAINTAINERS.md','contracts','tests']
|
||||
assert not git('diff',base,'--',*protected).strip(), 'mandatory materials changed'
|
||||
identity='Sergey Lyakhonov <lyserg119@gmail.com>'
|
||||
for line in git('log',base+'..HEAD','--format=%an <%ae>|%cn <%ce>').decode().splitlines():
|
||||
assert line==identity+'|'+identity, 'unexpected commit identity'
|
||||
paths=git('ls-files','--cached','--others','--exclude-standard','-z').split(b'\0')
|
||||
secret_dir=ROOT/'secrets'
|
||||
values=[f.read_bytes().strip() for f in secret_dir.iterdir() if f.is_file()] if secret_dir.exists() else []
|
||||
for raw in paths:
|
||||
if not raw: continue
|
||||
name=raw.decode('utf-8');file=ROOT/name
|
||||
assert not name.startswith('secrets/') and name!='.env','private file tracked'
|
||||
if file.is_file():
|
||||
assert not any(value and value in file.read_bytes() for value in values), 'secret value in '+name
|
||||
previous=ROOT.parent/'vysoko-nagr 3'
|
||||
if previous.exists():
|
||||
args=['git','-c','safe.directory='+str(previous),'-C',str(previous)]
|
||||
assert not subprocess.check_output(args+['status','--porcelain']).strip(),'previous project changed'
|
||||
assert subprocess.check_output(args+['rev-parse','HEAD']).decode().strip().startswith('374c43e'),'previous HEAD changed'
|
||||
print('PASS: original materials unchanged; specified author/committer; no generated secrets in tracked/nonignored files; lab3 unchanged')
|
||||
Reference in New Issue
Block a user