mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-05-17 11:38:32 +02:00
run linting on new tasks.py file
This commit is contained in:
parent
21edd49905
commit
7f00d33e02
2 changed files with 12 additions and 14 deletions
|
@ -71,7 +71,7 @@ format-check = [
|
||||||
]
|
]
|
||||||
style-check = [
|
style-check = [
|
||||||
{cmd = "pflake8 --version"},
|
{cmd = "pflake8 --version"},
|
||||||
{cmd = "pflake8 jrnl tests"},
|
{cmd = "pflake8 jrnl tests tasks.py"},
|
||||||
]
|
]
|
||||||
sort-run = [
|
sort-run = [
|
||||||
{cmd = "isort ."},
|
{cmd = "isort ."},
|
||||||
|
|
24
tasks.py
24
tasks.py
|
@ -1,29 +1,30 @@
|
||||||
# Copyright © 2012-2022 jrnl contributors
|
# Copyright © 2012-2022 jrnl contributors
|
||||||
# License: https://www.gnu.org/licenses/gpl-3.0.html
|
# License: https://www.gnu.org/licenses/gpl-3.0.html
|
||||||
|
|
||||||
|
import json
|
||||||
|
import os
|
||||||
|
import pathlib
|
||||||
|
|
||||||
|
import requests
|
||||||
|
import xmltodict
|
||||||
|
|
||||||
DOCS_URL = "http://127.0.0.1:8000"
|
DOCS_URL = "http://127.0.0.1:8000"
|
||||||
SITEMAP_FILENAME = "sitemap.xml"
|
SITEMAP_FILENAME = "sitemap.xml"
|
||||||
CONFIG_FILENAME = "config.json"
|
CONFIG_FILENAME = "config.json"
|
||||||
|
|
||||||
def delete_files(files):
|
|
||||||
import pathlib
|
|
||||||
|
|
||||||
|
def delete_files(files):
|
||||||
for file in files:
|
for file in files:
|
||||||
pathlib.Path(file).unlink(missing_ok=True)
|
pathlib.Path(file).unlink(missing_ok=True)
|
||||||
|
|
||||||
|
|
||||||
def generate_sitemap():
|
def generate_sitemap():
|
||||||
import requests
|
|
||||||
|
|
||||||
sitemap = requests.get(f"{DOCS_URL}/{SITEMAP_FILENAME}")
|
sitemap = requests.get(f"{DOCS_URL}/{SITEMAP_FILENAME}")
|
||||||
with open(SITEMAP_FILENAME, 'wb') as f:
|
with open(SITEMAP_FILENAME, "wb") as f:
|
||||||
f.write(sitemap.content)
|
f.write(sitemap.content)
|
||||||
|
|
||||||
|
|
||||||
def generate_pa11y_config_from_sitemap():
|
def generate_pa11y_config_from_sitemap():
|
||||||
import xmltodict
|
|
||||||
import json
|
|
||||||
|
|
||||||
with open(SITEMAP_FILENAME) as f:
|
with open(SITEMAP_FILENAME) as f:
|
||||||
xml_sitemap = xmltodict.parse(f.read())
|
xml_sitemap = xmltodict.parse(f.read())
|
||||||
|
|
||||||
|
@ -33,13 +34,11 @@ def generate_pa11y_config_from_sitemap():
|
||||||
]
|
]
|
||||||
urls += [url["loc"] for url in xml_sitemap["urlset"]["url"]]
|
urls += [url["loc"] for url in xml_sitemap["urlset"]["url"]]
|
||||||
|
|
||||||
with open(CONFIG_FILENAME, 'w') as f:
|
with open(CONFIG_FILENAME, "w") as f:
|
||||||
f.write(json.dumps({"urls": urls}))
|
f.write(json.dumps({"urls": urls}))
|
||||||
|
|
||||||
|
|
||||||
def output_file(file):
|
def output_file(file):
|
||||||
import os
|
|
||||||
|
|
||||||
if not os.getenv("CI", False):
|
if not os.getenv("CI", False):
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -48,5 +47,4 @@ def output_file(file):
|
||||||
with open(file) as f:
|
with open(file) as f:
|
||||||
print(f.read())
|
print(f.read())
|
||||||
|
|
||||||
print('::endgroup::')
|
print("::endgroup::")
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue