545 Commits

Author SHA1 Message Date
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 e1852e6854875f9d920f7f1862350f87afa854ab.
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:

 * 10854d4802c4953cf05a8e28cb81ba5ab8d52b29 and related commits
 * c25849b7ea0a18e32d9065cfca91e703e179cf04 (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
Groggy Dice
096417df47 create a magic comment for appending custom usage classes
This will keep non-core usage types from being described as a "non-standard usage class" in recruitment error messages. These error messages will only be triggered if there is a mismatch between recruits and recruitment patterns, so this magic comment is low-priority.

It was suggested that wmllint could auto-detect new usage values in unit files, and automatically append them to the list of recognized usage types. This was rejected because of the possibility of adding misspelled or mistaken usage types.
2013-12-17 04:48:37 -05:00
Groggy Dice
990ac9a901 note when recruitment mismatches involve non-standard usage classes
When recruitment patterns include bogus usage classes, it will trigger a message during the consistency check. However, this check won't tell you whether your problem is with the usage classes or the recruits. For example, if you get a message that "no light fighter units are recruitable", your first thought might be that you didn't include a light fighter unit in the recruit list. The message doesn't clue you in directly that the light fighter simply doesn't exist in mainline.

Now a clause will be added to the message when non-mainline recruitment classes are involved, alerting designers when bogus usage classes are involved, but mild enough that it hopefully won't scare away authors legitimately seeking to use custom classes.

This replaces the old usage check. The next commit will add a magic comment for appending custom usage types.
2013-12-17 04:48:34 -05:00
Ignacio R. Morelle
b0373525b3 wmllint: Recognize help_topic_text as a translatable attribute
The attribute is used in [terrain_type] and it was first implemented in
a28cfc3fd96264c411453307d536b48435e5bdeb.
2013-12-04 17:01:56 -03:00
Bär Halberkamp
ffe06509c9 Fixed wmllint with my latest commits 2013-12-04 20:29:28 +01:00
Elvish_Hunter
257c8aec88 wmllint: implemented new sanity check for leader and nozoc ellipses 2013-09-26 21:07:08 +02:00
Elvish_Hunter
94c33bf9af wmllint: stop complaining about unknown IDs inside [clear_menu_item] 2013-09-21 10:10:50 +02:00
Andrius Silinskas
8fa57b4150 Mark "new_game_title" as translatable in wmllint.
Relevant strings were adjusted in LoW.
2013-09-20 19:14:33 +01:00
Groggy Dice
d3bb951548 check for textdomain paths without '/translations', and binary paths referring to 'external' data
The convention that [textdomain] uses "/translations" is strongly established, and I can't think of a legitimate reason for an add-on not to be following it.

The binary path check is a crude test. The names that took hold for menu image directories are "/public" and variations of "/external*", so we look for those strings. It does not catch the worst case of all - when all binaries are outside the campaign define, not just a set-aside directory.

I first thought of these checks while brainstorming ways to use the in_textdomain and in_binary_path code in hack_syntax(). However, realizing that these checks did not really hack any syntax, I wanted to find someplace in the sanity checks where the code would fit. I finally found it.
2013-08-21 04:39:44 -04:00
Groggy Dice
8b3aba7ccb wmllint: extend scenario check to include first scenario
Some newbie authors run into trouble at this point!
2013-08-17 19:27:00 -04:00
Groggy Dice
93af90d2db additions to wmllint help
Here's the rationale for these additions:

* There is so much focus on wmllint's role in conversion, that many people may not think of it as a validator also (I didn't). So often, stumped authors ask in the forums about problems that would have been fixed or pointed out if they'd run wmllint. I want to encourage awareness of wmllint as a validator.

* Folded a line to fit normal 80-width CLI.

* Help contained no mention of this rather redundant option.

* How many people don't realize that ESR's long introduction is there?

* Some users may not understand why they're being dumped back to wmllint's help.
2013-08-17 19:26:52 -04:00
Groggy Dice
db560619e8 wmllint: add switch -K --known for suppresing consistency_check()
I used "inconsistency" for the actual variable name, because "known" seems more likely to be accidentally reused.

I pondered whether to allow the scenario check to go forward, but decided to just make a clean break.

Note that this does not prevent any of the information-gathering for the consistency check, just the check itself.

Why would you want to use this option? Of course, you should run the consistency check at some point. But if you simply want to recheck if you've fixed all the bugs in your campaign, you might not want to have wmllint slog through data/core again.
2013-08-17 19:26:44 -04:00
Groggy Dice
46e9d8dc1d wmllint: bugfix missing "stringfreeze" long argument in getopt, and correct help description
According to the introduction, stringfreeze does *not* suppress the warning, and the code bears this out.

I wonder how often this option is actually used.
2013-08-17 19:26:36 -04:00
Groggy Dice
45fa75c082 change introduction's reference to checking out wmllint from 1.4 branch, to wmllint-1.4 2013-08-17 19:26:29 -04:00
Groggy Dice
a315603d2c wmllint: bugfix "unresolved scenario" check 2013-08-15 19:20:50 -04:00
Groggy Dice
c3863ac222 implement keyword 'unwho ALL' for clearing all "wmllint: who" entries at end of campaign
I realized that as it stood, my dictionary would linger, bad if wmllint were being run on multiple campaigns. A special unwho keyword, 'all', clears the dictionary.
2013-08-15 19:13:22 -04:00
Groggy Dice
a8a65c25b2 add explanation about how to use "wmllint: who" magic comments to introduction 2013-08-15 01:22:05 -04:00
Groggy Dice
ab18d94117 magic comment to remove items from whopairs dictionary
If no more scenarios will be using a macro, you can remove it from the dictionary with "unwho".
2013-08-15 01:21:46 -04:00
Groggy Dice
56be5f2f6b recognize characters from "wmllint: who" macros and append to present
Now that we see how the whopairs are recognized, we can see that the magic comment accepts a comma-separated list, for macros that deal with more than one character.

We also see that if it is necessary to remove a character who leaves the party, this can be done with another entry prefixed by double minuses.
2013-08-15 01:21:28 -04:00