2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-15 19:45:46 +00:00

added autofixes

This commit is contained in:
Matthias Mair
2024-01-07 20:58:23 +01:00
parent cc66c93136
commit a92442e60e
238 changed files with 11858 additions and 10630 deletions

View File

@ -17,12 +17,7 @@ print("- Response 200 OK")
data = json.loads(response.text)
required_keys = [
'server',
'version',
'apiVersion',
'worker_running',
]
required_keys = ['server', 'version', 'apiVersion', 'worker_running']
for key in required_keys:
assert key in data

View File

@ -30,7 +30,6 @@ def check_invalid_tag(data):
err_count = 0
for idx, line in enumerate(data):
results = re.findall(pattern, line)
for result in results:
@ -61,9 +60,7 @@ def check_prohibited_tags(data):
err_count = 0
for idx, line in enumerate(data):
for tag in re.findall(pattern, line):
if tag not in allowed_tags:
print(f" > Line {idx+1} contains prohibited template tag '{tag}'")
err_count += 1
@ -72,7 +69,6 @@ def check_prohibited_tags(data):
for filename in pathlib.Path(js_i18n_dir).rglob('*.js'):
print(f"Checking file 'translated/{os.path.basename(filename)}':")
with open(filename, 'r') as js_file:
@ -82,7 +78,6 @@ for filename in pathlib.Path(js_i18n_dir).rglob('*.js'):
errors += check_prohibited_tags(data)
for filename in pathlib.Path(js_dynamic_dir).rglob('*.js'):
print(f"Checking file 'dynamic/{os.path.basename(filename)}':")
# Check that the 'dynamic' files do not contains any translated strings
@ -94,7 +89,6 @@ for filename in pathlib.Path(js_dynamic_dir).rglob('*.js'):
err_count = 0
for idx, line in enumerate(data):
results = re.findall(pattern, line)
if len(results) > 0:

View File

@ -26,14 +26,16 @@ def get_existing_release_tags():
headers = None
if token:
headers = {
"Authorization": f"Bearer {token}"
}
headers = {"Authorization": f"Bearer {token}"}
response = requests.get('https://api.github.com/repos/inventree/inventree/releases', headers=headers)
response = requests.get(
'https://api.github.com/repos/inventree/inventree/releases', headers=headers
)
if response.status_code != 200:
raise ValueError(f'Unexpected status code from GitHub API: {response.status_code}')
raise ValueError(
f'Unexpected status code from GitHub API: {response.status_code}'
)
data = json.loads(response.text)
@ -65,7 +67,9 @@ def check_version_number(version_string, allow_duplicate=False):
match = re.match(r"^(\d+)\.(\d+)\.(\d+)(?: dev)?$", version_string)
if not match or len(match.groups()) != 3:
raise ValueError(f"Version string '{version_string}' did not match required pattern")
raise ValueError(
f"Version string '{version_string}' did not match required pattern"
)
version_tuple = [int(x) for x in match.groups()]
@ -87,7 +91,6 @@ def check_version_number(version_string, allow_duplicate=False):
if __name__ == '__main__':
here = os.path.abspath(os.path.dirname(__file__))
# GITHUB_REF_TYPE may be either 'branch' or 'tag'
@ -111,7 +114,6 @@ if __name__ == '__main__':
version = None
with open(version_file, 'r') as f:
text = f.read()
# Extract the InvenTree software version
@ -178,7 +180,6 @@ if __name__ == '__main__':
# Ref: https://getridbug.com/python/how-to-set-environment-variables-in-github-actions-using-python/
with open(os.getenv('GITHUB_ENV'), 'a') as env_file:
# Construct tag string
tags = ",".join([f"inventree/inventree:{tag}" for tag in docker_tags])