Commit graph

563 commits

Author SHA1 Message Date
Ignacio R. Morelle
92760fe1e5 wmllint: Ignore id in [trait] for unit id checks 2015-11-06 00:08:49 -03:00
Ignacio R. Morelle
436e808528 wmllint: Recognize [background_layer] in [part] 2015-06-27 18:25:45 -03:00
Ignacio R. Morelle
a1e2903c59 wmllint: Quick and dirty hack to recognize [+tags] in [part] 2015-06-27 18:25:24 -03:00
Elvish_Hunter
a886387ad1 wmllint: backported better fix for bug #23217 2015-04-08 22:47:10 +02:00
Ignacio R. Morelle
7dc4f627ce wmllint: Print expected side num when reporting out-of-sequence sides 2015-04-07 22:14:14 -03:00
Elvish_Hunter
0964d448b0 wmllint: handle variation_name translatable attribute. Fixes bug #23217 2015-04-08 00:05:40 +02:00
Charles Dang
3383d6462a Don't show ellipsecheck warning if ellipse=none 2014-12-31 15:01:26 +11:00
Groggy Dice
1ebadbf7c4 wmllint: split introduction into labeled sections for clarity
Also, the top paragraphs, aimed at the core developers, have been moved to
the bottom, to get to the information key to general users.
2014-08-01 03:49:33 -04:00
Groggy Dice
9ce28102bf wmllint: remove -p --progress option
This option is pretty similar in effect to -v -v. Particularly now that
some new switches have been added recently, the clutter makes it no
longer worth keeping around.

A comment notes the option's disappearance, in case anyone wonders what
happened to it or how to get the same functionality.
2014-07-29 06:09:14 -04:00
Groggy Dice
378da4cd0c wmllint: remove -f --future option
Going back through wmllint's history, it turns out that there apparently
haven't been any "experimental conversions" since 1.4. Especially since
some new switches have been added recently, the clutter makes it no longer
worth keeping around.

A comment notes the option's disappearance, in case anyone is interested
in recreating experimental conversions again.
2014-07-29 06:09:04 -04:00
Groggy Dice
e47ebac43a wmllint: reorganize help into mode options and other options
The organization of Elvish Hunter's wmllint GUI tab suggested this change.
2014-06-10 05:59:09 -04:00
Groggy Dice
5fb9500400 wmllint: fix substitution that was missing a slash 2014-06-10 05:41:06 -04:00
Alexander van Gessel
21f3a01f95 Fix a wmllint crash 2014-05-28 17:55:07 +02:00
Groggy Dice
625f22e595 wmllint: add option to turn off missing side= key warning 2014-05-16 01:46:33 -04:00
Groggy Dice
be1fc5a6de wmllint: put off dryrun's verbosity check until after options are processed
Per discussion with Elvish Hunter on the forum. Having dryrun check for a
minimum verbosity level during the options for loop meant that -vd would
set the verbosity level to 1, while -dv would set it to 2.
2014-05-16 01:46:16 -04:00
Groggy Dice
02aff87a26 wmllint: warn about no side key in [*_shroud],[gold],[modify_side/ai]
Those who are updating from old UMC may otherwise be caught unawares by the
change from defaulting to side 1 when the side key is missing, to all
sides. Later we will have an option to turn off this warning.

Since the insertion of an attribute line is now commented out, it may be
questioned whether this still belongs in hack_syntax. However, at some
point the plan is to give users an option to insert the side= key.
2014-05-16 01:45:13 -04:00
Groggy Dice
58c8e35b5e wmllint: warn about no side key in [set/(dis)allow_recruit],[store_gold]
Those who are updating from old UMC may otherwise be caught unawares by the
change from defaulting to side 1 when the side key is missing, to all
sides. Later we will have an option to turn off this warning.
2014-05-16 01:45:10 -04:00
Groggy Dice
2740384796 wmllint: change "usage of" magic comment to re.search
There seems no particular reason to require that this magic comment be at
the very beginning of the line, so why not switch from re.match to
re.search.

Also, update comments to reflect the fact that UtBS no longer uses this
magic comment.

A suggestion has been made to get rid of this magic comment now that UtBS
is no longer using it, but it may still be in use in some UMC somewhere.
2014-04-25 01:28:56 -04:00
Ignacio R. Morelle
181c64d70d wmllint: Extend [terrain_type] aliasof conversion to def_alias 2014-02-20 04:46:33 -03:00
Ignacio R. Morelle
8e7242927d wmllint: Extend [terrain_type] aliasof conversion to mvt_alias 2014-02-20 04:43:56 -03:00
Ignacio R. Morelle
184af275eb wmllint: Ignore Mercurial .hg directories 2014-02-20 04:40:36 -03:00
Ignacio R. Morelle
dd4dc91a9e wmllint: Add a small comment block
This is documentation for e1852e6854.
2014-02-20 04:33:55 -03:00
Ignacio R. Morelle
e1852e6854 wmllint: Implement [terrain_type] aliasof conversion for changes in 1.11.[89]
Adds a text transform step for the aliasof attribute under
[terrain_type] accounting for several changes to base terrain aliasing
in Wesnoth 1.11.8 and 1.11.9, including:

 * 10854d4802 and related commits
 * c25849b7ea (Vit -> Vt in 1.11.9)

Just like usual terrain string conversions, this step can be disabled
for a specific line using # wmllint: noconvert.
2014-02-20 04:24:23 -03:00
Ignacio R. Morelle
93e6930593 wmllint: Spellcheck [terrain_type] editor_name= and help_topic_text= 2014-02-20 03:41:35 -03:00
Ignacio R. Morelle
16677d019e wmllint: Add check for [theme]s without an id 2014-02-20 02:05:43 -03:00
Ignacio R. Morelle
e2bc4a9de7 wmllint: Add check for user-visible [theme]s without a name or description 2014-02-20 02:03:28 -03:00
Ignacio R. Morelle
d16ec0cf9e wmllint: Add check for deprecated [theme] name= usage 2014-02-20 01:53:11 -03:00
Ignacio R. Morelle
a15f89e873 wmllint: Fix incorrect ToD schedule image substitution 2014-02-20 01:47:29 -03:00
Elvish_Hunter
e4c87305dc wmllint: moved in_clear_menu_item check in a better position 2014-02-07 15:05:48 +01:00
Groggy Dice
3f79e418a5 wmllint: report stored units never unstored or cleared
Keys from the dictionary of stored units are removed as the unit is
unstored or its variable cleared. However, I found that one character in
Legend of Wesmere, Urudin, is stored but apparently never unstored/cleared.
I figure it's best to report such cases.

This message does not include helpful information like the filename,
because that data was never stored in the dictionary. The dictionary was
designed on the presumption that all entries would have a matching unstore/
clear event, and I didn't think of this warning until I saw there was an
anomalous case. Those who get this error will just have to use grep!
2014-01-20 04:19:52 -05:00
Groggy Dice
e059677112 wmllint: take out testing lines 2014-01-17 06:02:33 -05:00
Groggy Dice
6aa8d86b3e wmllint: recognize unstored units
This required care to:

* not add ids inside [not] tags
* remove items from dictionary not just when unstored, but when
  clear_variable is used
* handle comma-separated values
2014-01-17 05:38:44 -05:00
Groggy Dice
c7de5ce968 wmllint: lay groundwork for recognizing unstored units
The next commit will actually populate the dictionary and append
the id to recognized characters.
2014-01-17 05:38:40 -05:00
fendrin
a66a80efab Don't make assumptions on WML string value quote format. 2014-01-09 07:50:32 +01:00
Ignacio R. Morelle
715618b385 wmllint: Clarify error message about existing spelling exceptions 2014-01-06 22:59:44 -03:00
Ignacio R. Morelle
d6cfc9bb6b wmllint: Document markcheck off/on directives 2014-01-04 12:54:24 -03:00
Groggy Dice
9894a36cb6 wmllint: minor wording tweak for "unknown speaker" message 2014-01-04 09:43:54 -05:00
Groggy Dice
128958511a wmllint: prevent zero-length unit ids from crashing python-enchant spellcheck 2014-01-03 11:09:21 -05:00
Groggy Dice
9689cd0d0b wmllint: add "unknown speaker" warning
I actually thought this was already checked by the "unknown 'xx' referred to
by id" warning. Probably because many more [message]s used to use id= and
role= rather than speaker=.

As a side effect, this new error will force designers to use my 'who' and
'whofield' magic comments!
2014-01-03 10:35:31 -05:00
Groggy Dice
20bc51302e wmllint: rewrite test of permitted tags in [part]
The tags are now tested directly, rather than as a parent of a key. The old
test was probably not missing tags like the test for illegal child of [if]
did, because [part] could be anywhere in ancestors. Anyway, [part] rarely
contains other tags.
2014-01-03 10:35:25 -05:00
Groggy Dice
b68feb74f4 wmllint: clean up detection of "illegal children of [if]"
Previously, only lines that parse_attribute could process got passed to
local_sanity_check. So tags survived as ancestors of attribute lines, but
the lines with the tags themselves got discarded. Hence, the "illegal child
of [if]" error was actually triggered by attributes, and the line number
referred to that line rather than the child tag.

While working on [aspect] and [facet] (which originally preceded this commit),
I changed the TypeError exception to pass all lines to local_sanity_check. This
allows for a direct test of the child tags. It turns out many child tags were
not tested because all the attributes were nested deeper inside other tags,
so that the child tag was not the parent of any attribute.

Two core macros failed the new test with the tags [filter_second] and
[filter_second_attack]. This pointed up the fact that these were not in the
list of valid child tags.

It also turns out that tags inside #ifdefs didn't fit the original test,
because "#ifdef" was considered an ancestor, interrupting the link between
"[if]" and the child tag.
2014-01-03 10:35:23 -05:00
Groggy Dice
98abe1ea42 wmllint: rewrite "who" magic comment to match exact macro name
Previously, the string only needed to match part of the macro. However, this
left too much room for unintended matches. This change is also quicker for
wmllint to process.
2014-01-03 10:35:22 -05:00
fendrin
2709197594 Refactored the time of day schedule related images and macros.
This moves the after the fall schedule into core to grant that the
debian package wesnoth-editor does not depend on wesnoth-utbs.

Also, the images now life in their own subdirectories.

Wmllint has been updated to take care about the changed paths.
2013-12-22 07:32:12 +01:00
Groggy Dice
e22e204d67 wmllint: recognize characters in RECALL_XY 2013-12-20 04:52:05 -05:00
Groggy Dice
9b03262d04 parse whofield macros to recognize unit id fields
Also, explain usage of the "whofield" magic comment in the introduction
2013-12-20 04:51:52 -05:00
Groggy Dice
5c85e80487 create magic comment "whofield" for id fields of non-core macros
Although we can now auto-recognize characters in the core NAMED_*UNIT macros,
campaigns may have their own recruit/recall macros. This comment will tell
wmllint which field contains the macro's id.

The basic format is 'wmllint: whofield <macro> <num>'. This commit sets up the
dictionary, the next commit will actually parse the macros. It will explain
more details about how to use this magic comment in wmllint's introduction.
2013-12-20 04:51:48 -05:00
Groggy Dice
39557e8807 auto-recognize RECALL characters
Although this is not a core macro (yet - I've been meaning to ask why Wesnoth doesn't have core recall macros), it is used in many UMC projects in a consistent format, making it a de-facto standard.  Test that the macro has only one field, to make sure it isn't deviating from the format.
2013-12-17 04:48:57 -05:00
Groggy Dice
6dde83c3ac auto-recognize the people in the NAMED_*UNIT macros
If we have a regex match for the macro, we parse it and see if it meets key tests:

* There are at least 7 arguments parsed (NAMED_UNIT can have extra WML).
* The original regex could also match UMC macros, like "Attack of the Western Cavalry"'s NAMED_SHIP_UNIT. To make sure that such macros are following the format of the core macros, we check that the side, x, and y fields are numbers, or variables/macros consistent with those fields.
* Also make sure that the id field isn't blank. Not only would adding an empty id to the list of present characters be pointless, that list is added to spellings, and zero-length entries crash the spell-check.

If all those tests are passed, we append the id argument to the list of the present.

I also tweak the wording in the intro about the "wmllint: recognize" magic comment to reflect that wmllint is now recognizing ids in some macros.
2013-12-17 04:48:54 -05:00
Groggy Dice
c33b4c47ad update 1.4's LOYAL_UNIT macro to NAMED_LOYAL_UNIT
If an instance of LOYAL_UNIT is encountered, parse it for the number of fields.  If the number matches the old 1.4 macro, replace the string.
2013-12-17 04:48:51 -05:00
Groggy Dice
195399bcb2 replace startswith with re.match in finding lines that begin with macros
This will help later in searching the string created by re.match.
2013-12-17 04:48:45 -05:00