0ad/source/tools/entity
Dunedan bcf97b608b
Enable ruff rules for docstrings and comments
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-)
2024-08-31 21:09:20 +02:00
..
scriptlib Enable ruff rules for docstrings and comments 2024-08-31 21:09:20 +02:00
checkrefs.py Enable ruff rules for code simplification 2024-08-29 07:00:43 +02:00
creationgraph.pl Improve and fix checkrefs.pl, add a readme for usage, add mod support, add command line arguments. 2019-02-24 21:19:20 +00:00
creationgraph.py Use UTF-8 as encoding when working with files 2024-08-29 07:22:46 +02:00
entvalidate.pl Improve and fix checkrefs.pl, add a readme for usage, add mod support, add command line arguments. 2019-02-24 21:19:20 +00:00
entvalidate.py Enable ruff rules to check for ambiguous code 2024-08-27 19:28:11 +02:00
readme.md Add a markdownlint pre-commit hook 2024-08-27 10:06:31 +02:00

Checkrefs.py

Description

This script checks the game files for missing dependencies, unused files, and for file integrity. If mods are specified, all their dependencies are also checked recursively. This script is particularly useful to detect broken actors or templates.

Requirements

  • Python 3.6+ interpreter installed
  • lxml for the -a option.

Usage

  • cd in source/tools/entity and run the script.
usage: checkrefs.py [-h] [-u] [-x] [-a] [-t] [-m MOD [MOD ...]]

Checks the game files for missing dependencies, unused files, and for file integrity.

options:
  -h, --help            show this help message and exit
  -u, --check-unused    check for all the unused files in the given mods and their dependencies.
                        Implies --check-map-xml. Currently yields a lot of false positives.
  -x, --check-map-xml   check maps for missing actor and templates.
  -a, --validate-actors
                        run the validator.py script to check if the actors files have extra or
                        missing textures.
  -t, --validate-templates
                        run the validator.py script to check if the xml files match their (.rng)
                        grammar file.
  -m MOD [MOD ...], --mods MOD [MOD ...]
                        specify which mods to check. Default to public.