With v3.12.0 shfmt changed the behavior of the `--simplify` option to
ignore any EditorConfig when it's provided. Therefore, this option is
now moved to the EditorConfig as suggested by the shfmt author. See
https://github.com/mvdan/sh/issues/1173 for details.
This refactors validate_dae.py to utilize multiple CPU cores. This makes
it significantly faster. It also improves code quality and adds commands
line options.
Instead of listing files recursively for each directory manually, this
uses the built-in glob functionality of Python's pathlib.Path. As
part of this the found paths are returned as generator instead of a
list. Together this results in easier to read code and better
performance.
A typo in the assignment of the error state lead to checkrefs.py
existing with return code 0, while it should've returned 1 in some
cases. This commit fixes that.
As the fonts specified in the GUI templates don't exist as files on disk
anymore after 734386ce9f we can't check if they're specified correctly
the same way as before anymore. Instead, this commit adds validation
of font names to the GUI Relax NG schema and adds a check whether all
fonts referenced in default.cfg exist in the proper location.
A multi player loading screen will have possibility of showing single
and multi player tips while multi player tips are in favor.
Tips are now separated by categories. During loading those category
have an occurrence probability, where we are choosing a random category
based on chance and not by complete randomness. From there we just
picking a random tip from that category.
The most notable changes are:
- improved performance thanks to using `lxml` instead of `xmllint` for
validating the templates
- improved performance by parallelizing the validation across multiple
threads
- more meaningful output for detected validation errors
- easier to call from other scripts (like checkrefs.py)
The xmlvalidator logic is only used by the checkrefs.py script, so this
moves it to the same directory to have it co-located and avoid having to
modify sys.path to import it.
Add checks for sprites, styles, scrollbars, tooltips, and colors.
And too for entire objects referenced by the "use_object" attribute.
(even though that is currently unused)
Enable the Tips and Tricks page to show multiple images for each tip.
Add a small GUI panel below the image for switching between them.
Only show it when the current tip has more than one images.
Introduce tipfiles.json to assign images to the text files.
(And stop of relying on file naming)
Add a tip about wonders, and make some slight changes to other texts.
Improve existing tip images and add a bunch of new ones.
- Small popup page accessible from the main menu via Learn to Play.
- Lets the player read through the tips with 'Previous' and 'Next' buttons.
- Tips continue to be shown on the loading screen.
-> but there without the scrolling ability.
- Added two new hotkeys for quicker tip changing (item.prev and item.next)
-> set to the left and right arrows respectively by default.
- Responsible scripts are placed in gui/reference/tips/.
- The tip text files have been moved to gui/reference/tips/texts/.
- Tip image files have been moved to art/textures/ui/tips/.
- Added a series of new sprites (textures in art/textures/ui/tipdisplay/)
-> comprises a title decoration, a bullet point sprite, and a new button
style.
This ensures the same Python target version used for `ruff format`
is used for `ruff check` as well. It also allows ruff, even if it's not
run through pre-commit, to use the correct target Python version.
This enables some ruff rules for docstrings and comments. The idea is to
not enforce the presence of docstrings, but to ensure they are properly
formatted if they're present.
For comments this adds checks that they don't contain code and verify
the formatting of comments with "TODO" tags.
As part of this, some commented out code which hasn't been touch in the
past 10 years gets removed as well.
The rules enabled enabled by this are:
- check formatting of existing docstrings (D200-)
- check comments for code (ERA)
- check formatting of TODO tags (TD001, TD004-)
This explicitly uses UTF-8 encoding when reading or writing files with
Python. This is necessary as the default locale varies between
operating systems.
This enables ruff rules which check for code which can be simplified to
improve readability.
The additionally rules getting enabled by this are:
- remove unnecessary nesting of if-statements (SIM102)
- use contextlib.suppress() for no-op exception handling (SIM105)
- use enumerate() for counting in loops (SIM113)
- use context managers for opening files (SIM115)
This enables some ruff rules to check for ambiguous and dead Python
code, which might cause unintended side-effects.
The enabled rules are:
- a bunch of rules related to shadowing of builtin structures (A)
- a bunch of rules checking for unused arguments (ARG)
- a rule checking for useless expressions (B018)
- a rule checking for unbound loop variables (B023)
- a rule checking redefined function parameters (PLR1704)
In the ruff config file added in #6954 explicitly selecting the ruff
rules to check was missed, resulting in ruff only checking a very small
subset of its available rules. That hasn't been desired, so this is the
first of a series of commits enabling more rules. In this PR all rules
whose violations can be either automatically fixed by ruff or are
trivial to fix manually get enabled. For the follow up PRs it's intended
to focus on one area of rules per PR to gradually improve the Python
code quality.
Use tokens for required technologies, allowing `-tech` and easier
replacements.
Fixes requiring `replace=""` when replacing techs.
Also a minor fix in the TemplateParser.js for upgrade requirements.
Refs. 9bb9ff8b16.
Differential revision: https://code.wildfiregames.com/D4912
Comments by: @Stan
This was SVN commit r27505.
It doesn't properly handle mixins / special templates
On python 3.8+, XML elements are no longer sorted and this fails
validation against entity.rng
mixins are not properly applied because the | split is incorrect (3
max items instead of 2)
merge="" is not supported
Parents aren't always passed when they should be.
on windows it is incorrectly assumed that the encoding is 1252
Patch by: @baco
Tweaks by: @Stan
Based on a patch by: @wraitii
Differential Revision: https://code.wildfiregames.com/D4698
This was SVN commit r27161.
Reduces duplication across components.
Allows to provide specific names and history for formations.
Differential revision: https://code.wildfiregames.com/D4476
Comments by: @bb, @Stan
Fixes#6400
This was SVN commit r26476.
- Add support for tips
- Fix other scripts not writing to the correct output (they were writing
info messages to stderr)
Based on a patch by: @mammadori and @cyrille
Differential Revision: https://code.wildfiregames.com/D3213
This was SVN commit r26350.
Since the players/civs already have cmpIdentity, use it.
This forces civs to have corresponding XML in the `special/players/`
folder.
Also moves the files from `special/player/` to `special/players/`
consistent with other folders. And moves the generic `player.xml` one
level up.
Differential revision: https://code.wildfiregames.com/D4473
Help and comments by: @Stan, @wraitii
This was SVN commit r26298.