Add linter to check scripts are in readme, pass it

We knew a fair few were missing, but this was more than I expected.
develop
PeridexisErrant 2015-09-23 15:25:41 +10:00
parent 27cee0525c
commit 8661f5dc4f
3 changed files with 156 additions and 50 deletions

@ -13,6 +13,7 @@ before_install:
script: script:
- python travis/pr-check-base.py - python travis/pr-check-base.py
- python travis/lint.py - python travis/lint.py
- python travis/script-in-readme.py
- python travis/script-syntax.py --ext=lua --cmd="luac$LUA_VERSION -p" - python travis/script-syntax.py --ext=lua --cmd="luac$LUA_VERSION -p"
- python travis/script-syntax.py --ext=rb --cmd="ruby -c" - python travis/script-syntax.py --ext=rb --cmd="ruby -c"
- make html - make html

@ -122,6 +122,10 @@ An example of player digging in adventure mode:
advfort changes only persist in non procedural sites. Namely: player forts, caves, camps. advfort changes only persist in non procedural sites. Namely: player forts, caves, camps.
gui/advfort_items
=================
Does something with items in advnedute mode jobs.
gui/assign-rack gui/assign-rack
=============== ===============
Bind to a key (the example config uses P), and activate when viewing a weapon Bind to a key (the example config uses P), and activate when viewing a weapon
@ -150,6 +154,10 @@ are assigned to the barracks/armory containing the selected stand as
the intended user. In order to aid in the choice, it shows the number the intended user. In order to aid in the choice, it shows the number
of currently assigned racks for every valid squad. of currently assigned racks for every valid squad.
gui/autobutcher
===============
An in-game interface for the ``autobutcher`` plugin.
gui/choose-weapons gui/choose-weapons
================== ==================
Bind to a key (the example config uses Ctrl-W), and activate in the Equip->View/Customize Bind to a key (the example config uses Ctrl-W), and activate in the Equip->View/Customize
@ -214,6 +222,10 @@ There are three ways to open this editor:
This editor allows to change and modify almost anything in df. Press '?' for an This editor allows to change and modify almost anything in df. Press '?' for an
in-game help. in-game help.
gui/gm-unit
===========
An editor for various unit attributes.
gui/guide-path gui/guide-path
============== ==============
Bind to a key (the example config uses Alt-P), and activate in the Hauling menu with Bind to a key (the example config uses Alt-P), and activate in the Hauling menu with
@ -224,6 +236,14 @@ the cursor over a Guide order.
The script displays the cached path that will be used by the order; the game The script displays the cached path that will be used by the order; the game
computes it when the order is executed for the first time. computes it when the order is executed for the first time.
gui/hack-wish
=============
An alias for ``gui/create-item``. Deprecated.
gui/hello-world
===============
A basic example for testing, or to start your own script from.
gui/liquids gui/liquids
=========== ===========
To use, bind to a key (the example config uses Alt-L) and activate in the 'k' mode. To use, bind to a key (the example config uses Alt-L) and activate in the 'k' mode.
@ -274,6 +294,14 @@ included, but some examples are `available here`_.
.. image:: images/mod-manager.png .. image:: images/mod-manager.png
gui/no-dfhack-init
==================
Shows a warning at startup if no valid ``dfhack.init`` file is found.
gui/power-meter
===============
An in-game interface for the ``power-meter`` plugin.
gui/rename gui/rename
========== ==========
Backed by the rename plugin, this script allows entering the desired name Backed by the rename plugin, this script allows entering the desired name
@ -312,6 +340,10 @@ either immediately or after opening the assign owner page.
The script lists other rooms owned by the same owner, or by the unit selected in the assign The script lists other rooms owned by the same owner, or by the unit selected in the assign
list, and allows unassigning them. list, and allows unassigning them.
gui/siege-engine
================
An in-game interface for the ``siege-engine`` plugin.
gui/stockpiles gui/stockpiles
============== ==============
Load and save stockpile settings from the 'q' menu. Load and save stockpile settings from the 'q' menu.
@ -325,6 +357,11 @@ Usage::
Don't forget to `enable stockpiles` and create the `stocksettings` directory in Don't forget to `enable stockpiles` and create the `stocksettings` directory in
the DF folder before trying to use this plugin. the DF folder before trying to use this plugin.
gui/unit-info-viewer
====================
Displays age, birth, maxage, shearing, milking, grazing, egg laying, body size,
and death info about a unit. Recommended keybinding Alt-I.
gui/workflow gui/workflow
============ ============
Bind to a key (the example config uses Alt-W), and activate with a job selected Bind to a key (the example config uses Alt-W), and activate with a job selected
@ -451,76 +488,101 @@ part of the argument, backslashes are used: ``tool -argName4 [ \] asdf \foo ]``
sets ``argName4`` to ``\] asdf foo``. The ``*-trigger`` scripts have a similar sets ``argName4`` to ``\] asdf foo``. The ``*-trigger`` scripts have a similar
policy with backslashes. policy with backslashes.
add-syndrome modtools/add-syndrome
============ =====================
This allows adding and removing syndromes from units. This allows adding and removing syndromes from units.
anonymous-script modtools/anonymous-script
================ =========================
This allows running a short simple Lua script passed as an argument instead of running a script from a file. This is useful when you want to do something too complicated to make with the existing modtools, but too simple to be worth its own script file. This allows running a short simple Lua script passed as an argument instead of
running a script from a file. This is useful when you want to do something too
complicated to make with the existing modtools, but too simple to be worth its
own script file.
create-item modtools/create-item
=========== ====================
This is mostly the same as the other create item tools, but it uses standard arguments. The other versions will be phased out in a later version. This is mostly the same as the other create item tools, but it uses standard
arguments. The other versions will be phased out in a later version.
force modtools/create-unit
===== ====================
This tool triggers events like megabeasts, caravans, invaders, and migrants. Creates a unit.
interaction-trigger modtools/equip-item
=================== ===================
This triggers events when a unit uses an interaction on another. It works by scanning the announcements for the correct attack verb, so the attack verb must be specified in the interaction. It includes an option to suppress this announcement after it finds it. Force a unit to equip an item; useful in conjunction with the ``create``
scripts above.
invader-item-destroyer
======================
This tool configurably destroys invader items to prevent clutter or to prevent the player from getting tools exclusive to certain races.
item-trigger modtools/force
============ ==============
This powerful tool triggers DFHack commands when a unit equips, unequips, or attacks another unit with specified item types, specified item materials, or specified item contaminants. This tool triggers events like megabeasts, caravans, invaders, and migrants.
moddable-gods modtools/interaction-trigger
============= ============================
This is a standardized version of Putnam's moddableGods script. It allows you to create gods on the command-line. This triggers events when a unit uses an interaction on another. It works by
scanning the announcements for the correct attack verb, so the attack verb
must be specified in the interaction. It includes an option to suppress this
announcement after it finds it.
modtools/invader-item-destroyer
===============================
This tool configurably destroys invader items to prevent clutter or to prevent
the player from getting tools exclusive to certain races.
modtools/item-trigger
=====================
This powerful tool triggers DFHack commands when a unit equips, unequips, or
attacks another unit with specified item types, specified item materials, or
specified item contaminants.
modtools/moddable-gods
======================
This is a standardized version of Putnam's moddableGods script. It allows you
to create gods on the command-line.
outside-only modtools/outside-only
============ =====================
This allows you to specify certain custom buildings as outside only, or inside only. If the player attempts to build a building in an inappropriate location, the building will be destroyed. This allows you to specify certain custom buildings as outside only, or inside
only. If the player attempts to build a building in an inappropriate location,
the building will be destroyed.
projectile-trigger modtools/projectile-trigger
================== ===========================
This triggers dfhack commands when projectiles hit their targets. This triggers dfhack commands when projectiles hit their targets.
random-trigger modtools/random-trigger
============== =======================
This triggers random dfhack commands with specified probabilities. This triggers random dfhack commands with specified probabilities.
reaction-product-trigger modtools/reaction-product-trigger
======================== =================================
This triggers dfhack commands when reaction products are produced, once per product. This triggers dfhack commands when reaction products are produced, once per
product.
reaction-trigger modtools/reaction-trigger
================ =========================
Triggers dfhack commands when custom reactions complete, regardless of whether it produced anything, once per completion. Triggers dfhack commands when custom reactions complete, regardless of whether
it produced anything, once per completion.
reaction-trigger-transition modtools/reaction-trigger-transition
=========================== ====================================
Scans raw files and creates a file to help modders transition from autoSyndrome to reaction-trigger. Scans raw files and creates a file to help modders transition from
autoSyndrome to reaction-trigger.
skill-change modtools/skill-change
============ =====================
Sets or modifies a skill of a unit. Sets or modifies a skill of a unit.
spawn-flow modtools/spawn-flow
========== ===================
Creates flows at the specified location. Creates flows at the specified location.
syndrome-trigger modtools/syndrome-trigger
================ =========================
Triggers dfhack commands when syndromes are applied to units. Triggers dfhack commands when syndromes are applied to units.
transform-unit modtools/transform-unit
============== =======================
Transforms a unit into another unit type, possibly permanently. Transforms a unit into another unit type, possibly permanently.
@ -559,6 +621,10 @@ Usage::
autofarm default 30 autofarm default 30
autofarm threshold 150 helmet_plump tail_pig autofarm threshold 150 helmet_plump tail_pig
autolabor-artisans
==================
Runs the ``autolabor`` plugin, with settings tuned for small but highly skilled workforces.
autounsuspend autounsuspend
============= =============
Automatically unsuspend construction jobs, on a recurring basis. Automatically unsuspend construction jobs, on a recurring basis.
@ -632,6 +698,10 @@ Focus a body part ingame, and this script will display the cause of death of
the creature. the creature.
Also works when selecting units from the (``u``) unitlist viewscreen. Also works when selecting units from the (``u``) unitlist viewscreen.
dfusion
=======
Interface to a lecacy script system.
digfort digfort
======= =======
A script to designate an area for digging according to a plan in csv format. A script to designate an area for digging according to a plan in csv format.
@ -684,10 +754,10 @@ Viewer utility and potentially compatible with others.
Options: Options:
:info: Exports the world/gen info, the legends XML, and a custom XML with more information :info: Exports the world/gen info, the legends XML, and a custom XML with more information
:sites: Exports all available site maps :sites: Exports all available site maps
:maps: Exports all seventeen detailed maps :maps: Exports all seventeen detailed maps
:all: Equivalent to calling all of the above, in that order :all: Equivalent to calling all of the above, in that order
exterminate exterminate
=========== ===========
@ -790,6 +860,11 @@ hotkey-notes
============ ============
Lists the key, name, and jump position of your hotkeys in the DFHack console. Lists the key, name, and jump position of your hotkeys in the DFHack console.
item-descriptions
=================
Exports a table with custom description text for every item in the game.
Used by ``view-item-info``.
lever lever
===== =====
Allow manipulation of in-game levers from the dfhack console. Allow manipulation of in-game levers from the dfhack console.

@ -0,0 +1,30 @@
import os, sys
scriptdir = 'scripts'
def is_script(fname):
if not os.path.isfile(fname):
return False
return fname.endswith('.lua') or fname.endswith('.rb')
def main():
files = []
for item in os.listdir(scriptdir):
path = os.path.join(scriptdir, item)
if is_script(path):
files.append(item)
elif os.path.isdir(path) and item not in ('devel', '3rdparty'):
files.extend([item + '/' + f for f in os.listdir(path)
if is_script(os.path.join(path, f))])
with open('docs/Scripts.rst') as f:
text = f.read()
error = 0
for f, _ in [os.path.splitext(p) for p in files]:
heading = '\n' + f + '\n' + '=' * len(f) + '\n'
if heading not in text:
print('WARNING: {:28} not documented in docs/Scripts'.format(f))
error = 1
sys.exit(error)
if __name__ == '__main__':
main()