1
0
forked from 0ad/0ad

Add a markdownlint pre-commit hook

This adds a pre-commit hook to link Markdown files and fixes all
reported findings.
This commit is contained in:
Dunedan 2024-08-27 10:06:31 +02:00
parent af6cda9073
commit ae3fad73ce
Signed by untrusted user: Dunedan
GPG Key ID: 885B16854284E0B2
10 changed files with 71 additions and 31 deletions

View File

@ -26,6 +26,7 @@ All details about each step are documented in [ReleaseProcess](wiki/ReleaseProce
**All the following issues must be fixed in `main` (which closes the issue) and then cherry-picked to the release branch (after that, you can tick the checkbox below).**
Here are the Release Blocking issues currently delaying the release:
- [x] None currently
## Progress Tracking
@ -56,6 +57,7 @@ Here are the Release Blocking issues currently delaying the release:
---
Before moving on with Full Freeze, make sure that:
- [ ] At least 10 days have passed since the string freeze announcement
- [ ] Only this ticket remains in the Milestone
- [ ] All previous checkboxes are ticked

8
.markdownlint.yaml Normal file
View File

@ -0,0 +1,8 @@
---
commands-show-output: false
default: true
no-bare-urls: false
line-length:
line_length: 100
fenced-code-language: false
no-space-in-emphasis: false

View File

@ -54,3 +54,13 @@ repos:
- --simplify
stages: [pre-commit]
exclude: ^build/premake/premake5/
- repo: https://github.com/igorshubovych/markdownlint-cli
rev: v0.41.0
hooks:
- id: markdownlint
exclude: |
(?x)(
^.gitea/ISSUE_TEMPLATE/|
^build/premake/|
^source/third_party/
)

View File

@ -15,7 +15,6 @@ There are several ways to contact us and find more information:
- Gitea (development info, bug tracker): https://gitea.wildfiregames.com/
- IRC: #0ad on irc.quakenet.org
## Running precompiled binaries on Windows
A precompiled, ready-to-play development version of the game is available from
@ -27,33 +26,28 @@ In a checkout of the `nightly-build` SVN repository, open the "binaries\system"
- To launch the game: Run pyrogenesis.exe
- To launch the map editor: Run Atlas.bat or "pyrogenesis.exe -editor"
## Compiling the game from source code
The instructions for compiling the game on Windows, Linux and OS X are at
[BuildInstructions](https://gitea.wildfiregames.com/0ad/0ad/wiki/BuildInstructions).
## Reporting problems
Bugs should be reported on Gitea. For information on reporting problems
and finding logs, see [ReportingErrors](https://gitea.wildfiregames.com/0ad/0ad/wiki/ReportingErrors).
## Contributing Code
If you want to help out programming for the game, have a look at
[GettingStartedProgrammers](https://gitea.wildfiregames.com/0ad/0ad/wiki/GettingStartedProgrammers)
or contact us on #0ad-dev on irc.quakenet.org
## Contributing Artwork
If you want to make artwork for the game, have a look at
[For Artists](https://gitea.wildfiregames.com/0ad/0ad/wiki#for-artists)
or visit [the forums](https://www.wildfiregames.com/forum).
## Translating
You can help translating the game at https://www.transifex.com/projects/p/0ad

View File

@ -1,21 +1,21 @@
# Linting
This folder contains tools for linting 0 A.D. code
Linting is done via Arcanist: https://secure.phabricator.com/book/phabricator/article/arcanist_lint/
Linting is done via Arcanist:
https://secure.phabricator.com/book/phabricator/article/arcanist_lint/
## Linters
- `text` is configured to detect whitespace issues.
- `json` detects JSON syntax errors.
- `project-name` detects misspellings of the project name "0 A.D.". In particular the non-breaking space.
- `licence-year` detects Copyright header years and compares against modification time.
- `eslint`, if installed, will run on javascript files.
- `cppcheck`, if installed, will run on C++ files.
## Installation
This assumes you have arcanist already installed. If not, consult https://trac.wildfiregames.com/wiki/Phabricator#UsingArcanist .
This assumes you have arcanist already installed. If not, consult
https://trac.wildfiregames.com/wiki/Phabricator#UsingArcanist .
The linting is done via custom PHP scripts, residing in `pyrolint/`.
Configuration is at the root of the project, under `.arclint`.
@ -26,8 +26,12 @@ We provide dummy replacement for external linters, so that they are not required
#### eslint
Installation via npm is recommended. The linter assumes a global installation of both eslint and the "brace-rules" plugin.
`npm install -g eslint@latest eslint-plugin-brace-rules`
Installation via npm is recommended. The linter assumes a global installation
of both eslint and the "brace-rules" plugin.
```
npm install -g eslint@latest eslint-plugin-brace-rules`
```
See also https://eslint.org/docs/user-guide/getting-started

View File

@ -2,7 +2,9 @@
## 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.
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
@ -20,13 +22,15 @@ Checks the game files for missing dependencies, unused files, and for file integ
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.
-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.
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.
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.
```

View File

@ -4,7 +4,8 @@ This is a collection of scripts to automate 0 A.D.'s i18n process.
See `maintenanceTasks.sh` for the full process.
### Run tests
## Run tests
```sh
pip3 install pytest
python3 -m pytest

View File

@ -1,21 +1,29 @@
# 0 AD Python Client
This directory contains `zero_ad`, a python client for 0 AD which enables users to control the environment headlessly.
This directory contains `zero_ad`, a python client for 0 AD which enables users to control the
environment headlessly.
## Installation
`zero_ad` can be installed with `pip` by running the following from the current directory:
```
pip install .
```
Development dependencies can be installed with `pip install -r requirements-dev.txt`. Tests are using pytest and can be run with `python -m pytest`.
Development dependencies can be installed with `pip install -r requirements-dev.txt`. Tests are
using pytest and can be run with `python -m pytest`.
## Basic Usage
If there is not a running instance of 0 AD, first start 0 AD with the RL interface enabled:
```
pyrogenesis --rl-interface=127.0.0.1:6000
```
Next, the python client can be connected with:
```
import zero_ad
from zero_ad import ZeroAD
@ -32,7 +40,10 @@ with open('./samples/arcadia.json', 'r') as f:
state = game.reset(arcadia_config)
```
where `./samples/arcadia.json` is the path to a game configuration JSON (included in the first line of the commands.txt file in a game replay directory) and `state` contains the initial game state for the given map. The game engine can be stepped (optionally applying actions at each step) with:
where `./samples/arcadia.json` is the path to a game configuration JSON (included in the first
line of the commands.txt file in a game replay directory) and `state` contains the initial game
state for the given map. The game engine can be stepped (optionally applying actions at each step)
with:
```
state = game.step()

View File

@ -1,6 +1,7 @@
## Instructions
# Instructions
Install python 3 and the python dependencies
```sh
pip install -r requirements.txt
```
@ -8,7 +9,7 @@ pip install -r requirements.txt
Install glslc and spirv-tools 2023+ (the easiest way is to install Vulkan SDK)
Run the compile.py script
```sh
python compile.py path-to-folder-with-input-mods mod-output-path rules-path
```

View File

@ -1,4 +1,4 @@
## Template Analyzer
# Template Analyzer
This python tool has been written by wraitii and updated to 0ad A25 by hyiltiz.
Its purpose is to help with unit and civ balancing by allowing quick comparison
@ -9,6 +9,7 @@ installed). The output will be located in an HTML file called
`unit_summary_table.html` in this folder.
The script generates 3 informative tables:
- A comparison table of generic templates;
- A comparison table of civilization units (it shows the differences with the
generic templates);
@ -30,7 +31,6 @@ used can be found at https://github.com/koalyptus/TableFilter/
All contents of this folder are under the MIT License.
## Contributing
The script intentionally only relies on Python 3 Standard Library to avoid
@ -38,32 +38,37 @@ installing 3rd party libraries as dependencies. However, you might want to
install a few packages to make hacking around easier.
### Debugging
IPython can be used as a good REPL and to easily insert a debug break point.
Install it with:
pip3 install ipython
then to insert a break point, simply insert the following line to the script where
you want execution to pause:
import IPython; IPython.embed()
Then, run the script as normal. Once you hit the breakpoint, you can use IPython
as a normal REPL. A useful IPython magic is `whos`, which shows all local
variables.
### Exploration
To understand the internal logic, generating a function call dependency graph
can be helpful by providing a quick visual overview. Use the following code to
create the function call dependency graph. It is dynamic, and allows quickly
getting familiarized with the analyzer. Note that you'll need `dot` engine provided
getting familiarized with the analyzer. Note that you'll need `dot` engine provided
by the `graphviz` package. You can install `graphviz` using your system's package manager.
pip3 install pyan3==1.1.1
python3 -m pyan unitTables.py --uses --no-defines --colored --grouped --annotated --html > fundeps.html
python3 -m pyan unitTables.py --uses --no-defines --colored \
--grouped --annotated --html > fundeps.html
Alternatively, only create the `.dot` file using the following line, and render it with an online renderer like http://viz-js.com/
Alternatively, only create the `.dot` file using the following line, and render
it with an online renderer like http://viz-js.com/
python3 -m pyan unitTables.py --uses --no-defines --colored --grouped --annotated --dot > fundeps.dot
python3 -m pyan unitTables.py --uses --no-defines --colored \
--grouped --annotated --dot > fundeps.dot
Enjoy!