wmllint tutorial

The place to post your WML questions and answers.

Moderator: Forum Moderators

Forum rules
  • Please use [code] BBCode tags in your posts for embedding WML snippets.
  • To keep your code readable so that others can easily help you, make sure to indent it following our conventions.
Anonymissimus
Inactive Developer
Posts: 2461
Joined: August 15th, 2008, 8:46 pm
Location: Germany

Re: wmllint tutorial

Post by Anonymissimus »

Even on a slow machine it should end after some minutes.
That's the bug I mentioned previously, it's an infinte loop.
You can use --nospellcheck or deinstall enchant or apply the fix...
projects (BfW 1.12):
A Simple Campaign: campaign draft for wml startersPlan Your Advancements: mp mod
The Earth's Gut: sp campaignSettlers of Wesnoth: mp scenarioWesnoth Lua Pack: lua tags and utils
updated to 1.8 and handed over: A Gryphon's Tale: sp campaign
galicae
Translator
Posts: 59
Joined: August 26th, 2009, 1:54 pm
Location: behind my glasses

Re: wmllint tutorial

Post by galicae »

I manually stopped it during the loop...
the campaign now starts (I can play the first scenario), but my custom units refuse to show up

Code: Select all

unknown unit type: "Dragon Rider"
and so on
Should I just run wmllint again, with --nospellcheck, and hope it is fixed?
I had the same problem while I was writing the campaign, and still don't know how I got over it.
working on the greek translation
Anonymissimus
Inactive Developer
Posts: 2461
Joined: August 15th, 2008, 8:46 pm
Location: Germany

Re: wmllint tutorial

Post by Anonymissimus »

The spellcheck has no effect on syntactic correctness so turn it off. You'll get a message about unknown unit type (from wmllint) then, probably. Just fix everything reported by wmllint. If I have to guess it's the unit->unit_type thing, but wmllint does that conversion automatically iirc.
projects (BfW 1.12):
A Simple Campaign: campaign draft for wml startersPlan Your Advancements: mp mod
The Earth's Gut: sp campaignSettlers of Wesnoth: mp scenarioWesnoth Lua Pack: lua tags and utils
updated to 1.8 and handed over: A Gryphon's Tale: sp campaign
galicae
Translator
Posts: 59
Joined: August 26th, 2009, 1:54 pm
Location: behind my glasses

Re: wmllint tutorial

Post by galicae »

I ran it with --nospellcheck. I really love wmllint now. :oops: It pointed out lots of stuff. After I changed the unit tags to unit_type I could see my custom units. However I still can't convince the Era_of_Magic units to show up. Anyway, thanks for the help. I think that's enough of a tutorial :)
working on the greek translation
User avatar
boru
Posts: 788
Joined: November 19th, 2009, 11:02 pm

Re: wmllint tutorial

Post by boru »

I ran wmllint (successfully) for the first time yesterday. :mrgreen:

It helped me resolve a few minor things, which is nice. Luckily, Elvish_Hunter was kind enough to run an earlier version of my campaign thru wmllint so I knew there shouldn't be anything major in there.

I do get a pile of errors that look like this:

Code: Select all

Support/Wesnoth_1.8/data/add-ons/Swamplings/scenarios/11_Thunderstruck.cfg", line 481: unknown 'Headbag' referred to by id
By the way, these are the kind of 'error's that don't seem to affect anything I can see when I playtest the game, everything looks fine with good old Headbag and he's doing exactly what's expected of him.

I wish wmllint could catch variables that are never cleared or used. I went through all my wml yesterday and found ... well, a lot of those. But it takes forever and I'll probably never do it again, instead I'll do what I should have done in the first place, which is to keep track of these variables and clear them when I'm done with them.

I ran wmlscope today. ... I think. I got a log file back that tells me it took 58 seconds to run. Is it offtopic to ask about wmlscope in the wmllint tutorial thread?

What about these other tools, wmllint_gui? wmlvalidator?
“It is written in my life-blood, such as that is, thick or thin; and I can no other.” - J.R.R. Tolkien

My campaign: Swamplings - Four centuries before the founding of Wesnoth, the first wolf rider emerges from a tribe of lowly swamp goblins.
User avatar
Elvish_Hunter
Posts: 1600
Joined: September 4th, 2009, 2:39 pm
Location: Lintanir Forest...

Re: wmllint tutorial

Post by Elvish_Hunter »

boru wrote:I ran wmllint (successfully) for the first time yesterday.
Compliments!
boru wrote:By the way, these are the kind of 'error's that don't seem to affect anything I can see when I playtest the game, everything looks fine with good old Headbag and he's doing exactly what's expected of him.
If you open the wmllint file with a text editor, or with IDLE, you can see, at the start, how to control its behaviour. Not that I tried yet, and feel free to correct me - but, for example, your above error can be fixed by placing a
#wmllint: recognize Headbag
boru wrote:I ran wmlscope today. ... I think. I got a log file back that tells me it took 58 seconds to run. Is it offtopic to ask about wmlscope in the wmllint tutorial thread?
Not really, since we talked a bit about it already. Did you ran it with any option? To make it looking for cross-references and unresolved references you need to add -u or --unresolved between the wmlscope command and the file paths. And, since you're using 1.8, backport the new wmltools.py file from trunk: it was the only way, for me, to run wmlscope correctly on Windows (always do a backup before).
Current maintainer of these add-ons, all on 1.16:
The Sojournings of Grog, Children of Dragons, A Rough Life, Wesnoth Lua Pack, The White Troll (co-author)
User avatar
boru
Posts: 788
Joined: November 19th, 2009, 11:02 pm

Re: wmllint tutorial

Post by boru »

Elvish_Hunter wrote:If you open the wmllint file with a text editor, or with IDLE, you can see, at the start, how to control its behaviour. Not that I tried yet, and feel free to correct me - but, for example, your above error can be fixed by placing a
#wmllint: recognize Headbag
So "unknown 'Headbag' referred to by id" means a misspelling?
Elvish_Hunter wrote:Did you ran it with any option? To make it looking for cross-references and unresolved references you need to add -u or --unresolved between the wmlscope command and the file paths. And, since you're using 1.8, backport the new wmltools.py file from trunk: it was the only way, for me, to run wmlscope correctly on Windows (always do a backup before).
I added -w 1. I just tried it with -u instead. It gave me feedback on every .cfg file on my hard drive. And didn't put it in a log, but that's okay. But I'm not using wmltools from trunk as you recommended, so I'll go do that when I have a chance. I'm just getting a sense of what these tools can do, for the moment.
“It is written in my life-blood, such as that is, thick or thin; and I can no other.” - J.R.R. Tolkien

My campaign: Swamplings - Four centuries before the founding of Wesnoth, the first wolf rider emerges from a tribe of lowly swamp goblins.
Anonymissimus
Inactive Developer
Posts: 2461
Joined: August 15th, 2008, 8:46 pm
Location: Germany

Re: wmllint tutorial

Post by Anonymissimus »

boru wrote:So "unknown 'Headbag' referred to by id" means a misspelling?
Afaik wmllint checks whether all units referred to by id somewhere in the scenario are actually there. In case that the unit was created in that scenario it knows it automatically, if it was recalled or unstored instead, it does not and needs to be told about it using # wmllint: recognize ...

As for wmlscope, I suspect that only --unresolved works correctly, on win at least, or I don't understand the crossreference thing, but I suspect the former since even on Linux it didn't work completely correctly. The less frequently used the tools are the more buggy they are I'm afraid, especially on win. Tried wml validator yesterday and I called it correctly I think but it crashed...
projects (BfW 1.12):
A Simple Campaign: campaign draft for wml startersPlan Your Advancements: mp mod
The Earth's Gut: sp campaignSettlers of Wesnoth: mp scenarioWesnoth Lua Pack: lua tags and utils
updated to 1.8 and handed over: A Gryphon's Tale: sp campaign
User avatar
boru
Posts: 788
Joined: November 19th, 2009, 11:02 pm

Re: wmllint tutorial

Post by boru »

So we all add these # wmllint: recognize x lines to our code, not because anything's wrong, but just to make wmllint happy?
“It is written in my life-blood, such as that is, thick or thin; and I can no other.” - J.R.R. Tolkien

My campaign: Swamplings - Four centuries before the founding of Wesnoth, the first wolf rider emerges from a tribe of lowly swamp goblins.
User avatar
pauxlo
Posts: 1049
Joined: September 19th, 2006, 8:54 pm

Re: wmllint tutorial

Post by pauxlo »

Not to make wmllint happy, but to allow wmllint to show where you really misspelled some unit ID.
Anonymissimus
Inactive Developer
Posts: 2461
Joined: August 15th, 2008, 8:46 pm
Location: Germany

Re: wmllint tutorial

Post by Anonymissimus »

It's much easier to spot the mistakes if you usually have 0 errors and warnings in your "build log", so to say...
projects (BfW 1.12):
A Simple Campaign: campaign draft for wml startersPlan Your Advancements: mp mod
The Earth's Gut: sp campaignSettlers of Wesnoth: mp scenarioWesnoth Lua Pack: lua tags and utils
updated to 1.8 and handed over: A Gryphon's Tale: sp campaign
User avatar
boru
Posts: 788
Joined: November 19th, 2009, 11:02 pm

Re: wmllint tutorial

Post by boru »

@pauxlo- these are not misspellings, otherwise the campaign would not function properly.

@Anonymissimus - I agree it would be nice to run this and get zero errors.
“It is written in my life-blood, such as that is, thick or thin; and I can no other.” - J.R.R. Tolkien

My campaign: Swamplings - Four centuries before the founding of Wesnoth, the first wolf rider emerges from a tribe of lowly swamp goblins.
User avatar
pauxlo
Posts: 1049
Joined: September 19th, 2006, 8:54 pm

Re: wmllint tutorial

Post by pauxlo »

boru wrote:@pauxlo- these are not misspellings, otherwise the campaign would not function properly.
Yes, I know (and you), but wmllint does not.

Wmllint is too dumb to recognize names from one scenario in the next one, and complains for every ID it does not know. So you "help it" by declaring the ones for which you know that they are no misspellings, and then wmllint can tell you when you really misspelled something.

Alternatively you could tell it not to check for spellings at all, there is a command line parameter, I think.
Anonymissimus
Inactive Developer
Posts: 2461
Joined: August 15th, 2008, 8:46 pm
Location: Germany

Re: wmllint tutorial

Post by Anonymissimus »

pauxlo wrote: Alternatively you could tell it not to check for spellings at all, there is a command line parameter, I think.
No, this issue is unrelated to spellchecking. Boru hasn't enabled it as far as I understand it. Spellchecking is only transformed on translatable strings such as values of attributes message=, description, name= etc. "unknown <someone> referenced by id" is a syntactic check (although the problem could still be caused by misspelling...)
projects (BfW 1.12):
A Simple Campaign: campaign draft for wml startersPlan Your Advancements: mp mod
The Earth's Gut: sp campaignSettlers of Wesnoth: mp scenarioWesnoth Lua Pack: lua tags and utils
updated to 1.8 and handed over: A Gryphon's Tale: sp campaign
User avatar
Sapient
Inactive Developer
Posts: 4453
Joined: November 26th, 2005, 7:41 am
Contact:

Re: wmllint tutorial

Post by Sapient »

boru wrote:So we all add these # wmllint: recognize x lines to our code, not because anything's wrong, but just to make wmllint happy?

if you don't like it, you can always open wmllint with a text editor, search for the line that prints out that undesired error message, and simply comment it out or change it to "pass" (which means to do nothing).

That will make it shut up about whatever error messages you find useless.
http://www.wesnoth.org/wiki/User:Sapient... "Looks like your skills saved us again. Uh, well at least, they saved Soarin's apple pie."
Post Reply