-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rename all non-snake_case types. #27268
Rename all non-snake_case types. #27268
Conversation
If before merge we halt new merges I can run the script and give you the repo output. Or you can make it like the other SQL update files that end in |
To make CI work, append # And write the files and tell them to be used
for file in orderedSqlFiles:
if file.endswith(".py"):
# Begin snowflakery
if file == "16-17.py":
scriptLines.append("python3 SQL/updates/" + str(file) + " 127.0.0.1 root root paradise_gamedb feedback round\n")
elif file == "17-18.py":
scriptLines.append("python3 SQL/updates/" + str(file) + " 127.0.0.1 root root paradise_gamedb feedback feedback_2\n")
elif file == "31-32.py":
scriptLines.append("python3 SQL/updates/" + str(file) + " 127.0.0.1 root root paradise_gamedb\n")
elif file == "38-39.py":
scriptLines.append("python3 SQL/updates/" + str(file) + " 127.0.0.1 root root paradise_gamedb\n")
else:
print("ERROR: CI failed due to invalid python file in SQL/updates")
exit(1) And dont kill me for my python use, I wrote this script 4 years ago. |
Will take a look at the players and saved_json_datums tables tomorrow. |
Done. |
…-all-the-devils-are-here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another banger.
SQL properly updated to next version.
An additional maintainer should look over this when able.
@AffectedArc07 I added stanzas to the migration to update the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SQL version bump!
Make sure to change the script from 61-62.py
to 62-63.py
…-all-the-devils-are-here
…-all-the-devils-are-here
…-all-the-devils-are-here
…-all-the-devils-are-here
…-all-the-devils-are-here
What Does This PR Do
This PR converts all non-snake_case type names to an appropriate alternative. It provides a commensurate UpdatePaths script and applies it. It provides a SQL script for the production feedback table. It adds a check to check_grep2 to prohibit such naming in the future. It adds a schema migration Python script for updating the feedback table (doing player and json_datum_saves now in a sec)
This refactoring was performed with the following procedure:
Apply and store a renaming heuristic to offending type names
This was done with the script
make_snake_case_json.py
. The result was the JSON filesnake_case_type_remap.json
. Each element in the JSON file was a dictionary with "original" being the original path, and "replace" being the converted path.Clean up sub-optimal renames
Some of these replacements weren't great so I manually added an "override" key to those renames, so they wouldn't get clobbered by running the
make_snake_case.json
script again. For example:Generate the UpdatePaths script from the renames
generate_snake_case_updatepaths.py
is a straightforward script which generated the UpdatePaths script. The results were spot-checked for correctness.Perform a search and replace on code
perform_snake_case_search_replace.py
was used to perform the actual search and replace on the codebase, ensuring that parameter names and the like were all properly affected. The results were spot-checked and it was ensured the code compiled.Use the JSON file as input for a SQL migration.
The new schema migration script 60-61.py runs over all feedback rows and updates them based on the contents of the JSON renaming information. It is pretty fast:
Why It's Good For The Game
ORDNUNG MUSS SEINConsistency in naming schemes is good because 1: it makes the code style more consistent, meaning less cognitive load for contributors, 2: it means not having to worry/think about case-sensitive regexes/searches looking for types, and 3: it means admins don't have to bang their heads against finding the right name for objects in the game menu.Testing
See above. The scripts and JSON file can be checked for correctness, and the results of the entire process recreated if necessary.
Declaration
Changelog
NPFC