Merge branch 'master' into jgrpp
# Conflicts: # src/articulated_vehicles.cpp # src/articulated_vehicles.h # src/base_media_base.h # src/base_media_func.h # src/build_vehicle_gui.cpp # src/dock_gui.cpp # src/main_gui.cpp # src/music_gui.cpp # src/network/network_chat_gui.cpp # src/network/network_content.cpp # src/newgrf.cpp # src/newgrf_roadstop.cpp # src/os/windows/string_uniscribe.h # src/os/windows/win32.cpp # src/rail_gui.cpp # src/road.cpp # src/road_gui.cpp # src/settings.cpp # src/settings_gui.cpp # src/smallmap_gui.cpp # src/strings.cpp # src/terraform_gui.cpp # src/tests/test_script_admin.cpp # src/tests/test_window_desc.cpp # src/timer/timer_game_calendar.h # src/vehicle.cpp # src/vehicle_base.h # src/viewport.cpp # src/widget_type.h # src/window.cpp # src/window_gui.h
This commit is contained in:
50
.github/windowdesc-ini-key.py
vendored
50
.github/windowdesc-ini-key.py
vendored
@@ -1,50 +0,0 @@
|
||||
"""
|
||||
Script to scan the OpenTTD source-tree for ini_key issues in WindowDesc entries.
|
||||
"""
|
||||
|
||||
import glob
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
|
||||
|
||||
def scan_source_files(path, ini_keys=None):
|
||||
if ini_keys is None:
|
||||
ini_keys = set()
|
||||
|
||||
errors = []
|
||||
|
||||
for new_path in glob.glob(f"{path}/*.cpp"):
|
||||
if os.path.isdir(new_path):
|
||||
errors.append(scan_source_files(new_path, ini_keys))
|
||||
continue
|
||||
|
||||
with open(new_path) as fp:
|
||||
output = fp.read()
|
||||
|
||||
for (name, ini_key, widgets) in re.findall(r"^static WindowDesc ([a-zA-Z0-9_]*).*?, (?:\"(.*?)\")?.*?,(?:\s+.*?,){6}\s+[^\s]+\((.*?)\)", output, re.S|re.M):
|
||||
if ini_key:
|
||||
if ini_key in ini_keys:
|
||||
errors.append(f"{new_path}: {name} ini_key is a duplicate")
|
||||
ini_keys.add(ini_key)
|
||||
widget = re.findall("static const (?:struct )?NWidgetPart " + widgets + ".*?(?:WWT_(DEFSIZE|STICKY)BOX.*?)?;", output, re.S)[0]
|
||||
if widget and not ini_key:
|
||||
errors.append(f"{new_path}: {name} has WWT_DEFSIZEBOX/WWT_STICKYBOX without ini_key")
|
||||
if ini_key and not widget:
|
||||
errors.append(f"{new_path}: {name} has ini_key without WWT_DEFSIZEBOX/WWT_STICKYBOX")
|
||||
|
||||
return errors
|
||||
|
||||
|
||||
def main():
|
||||
errors = scan_source_files("src")
|
||||
|
||||
if errors:
|
||||
print("\n".join(errors))
|
||||
sys.exit(1)
|
||||
|
||||
print("OK")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
24
.github/workflows/windowdesc-ini-key.yml
vendored
24
.github/workflows/windowdesc-ini-key.yml
vendored
@@ -1,24 +0,0 @@
|
||||
name: WindowDesc ini_key
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}
|
||||
|
||||
jobs:
|
||||
windowdesc-ini-key:
|
||||
name: WindowDesc ini_key issues
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Check for ini_key issues in WindowDesc entries
|
||||
shell: bash
|
||||
run: |
|
||||
python3 .github/windowdesc-ini-key.py
|
||||
Reference in New Issue
Block a user