forked from lix-project/lix
release-notes: check with pre-commit
This required making the build-release-notes script understand how to
check multiple directories.
Change-Id: I057f5f636155ab6c6fb5755da5217b7e72249ece
This commit is contained in:
parent
3a103f539d
commit
7fde71a760
|
@ -344,6 +344,15 @@
|
||||||
enable = true;
|
enable = true;
|
||||||
excludes = [ "^tests/functional/lang/" ];
|
excludes = [ "^tests/functional/lang/" ];
|
||||||
};
|
};
|
||||||
|
release-notes = {
|
||||||
|
enable = true;
|
||||||
|
package = pkgs.build-release-notes;
|
||||||
|
files = "^doc/manual/rl-next(-dev)?";
|
||||||
|
pass_filenames = false;
|
||||||
|
entry = ''
|
||||||
|
${lib.getExe pkgs.build-release-notes} doc/manual/rl-next doc/manual/rl-next-dev
|
||||||
|
'';
|
||||||
|
};
|
||||||
# TODO: Once the test suite is nicer, clean up and start
|
# TODO: Once the test suite is nicer, clean up and start
|
||||||
# enforcing trailing whitespace on tests that don't explicitly
|
# enforcing trailing whitespace on tests that don't explicitly
|
||||||
# check for it.
|
# check for it.
|
||||||
|
|
|
@ -31,9 +31,10 @@ def format_pr(pr: str) -> str:
|
||||||
def format_cl(clid: int) -> str:
|
def format_cl(clid: int) -> str:
|
||||||
return f"[cl/{clid}]({GERRIT_BASE}/{clid})"
|
return f"[cl/{clid}]({GERRIT_BASE}/{clid})"
|
||||||
|
|
||||||
paths = pathlib.Path(sys.argv[1]).glob('*.md')
|
def run_on_dir(d):
|
||||||
entries = []
|
paths = pathlib.Path(d).glob('*.md')
|
||||||
for p in paths:
|
entries = []
|
||||||
|
for p in paths:
|
||||||
try:
|
try:
|
||||||
e = frontmatter.load(p)
|
e = frontmatter.load(p)
|
||||||
if 'synopsis' not in e.metadata:
|
if 'synopsis' not in e.metadata:
|
||||||
|
@ -46,13 +47,13 @@ for p in paths:
|
||||||
e.add_note(f"in {p}")
|
e.add_note(f"in {p}")
|
||||||
raise
|
raise
|
||||||
|
|
||||||
def listify(l: list | int) -> list:
|
def listify(l: list | int) -> list:
|
||||||
if not isinstance(l, list):
|
if not isinstance(l, list):
|
||||||
return [l]
|
return [l]
|
||||||
else:
|
else:
|
||||||
return l
|
return l
|
||||||
|
|
||||||
for p, entry in sorted(entries, key=lambda e: (-SIGNIFICANCECES[e[1].metadata.get('significance')], e[0])):
|
for p, entry in sorted(entries, key=lambda e: (-SIGNIFICANCECES[e[1].metadata.get('significance')], e[0])):
|
||||||
try:
|
try:
|
||||||
header = entry.metadata['synopsis']
|
header = entry.metadata['synopsis']
|
||||||
links = []
|
links = []
|
||||||
|
@ -69,3 +70,7 @@ for p, entry in sorted(entries, key=lambda e: (-SIGNIFICANCECES[e[1].metadata.ge
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
e.add_note(f"in {p}")
|
e.add_note(f"in {p}")
|
||||||
raise
|
raise
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
for d in sys.argv[1:]:
|
||||||
|
run_on_dir(d)
|
||||||
|
|
Loading…
Reference in a new issue