Make the changelog parser more lenient, please!
Posted: Sun Apr 07, 2019 11:51 pm
About a month ago, I posted a changelog tutorial because I didn't like that the changelog button in the game's mods manager was inactive for so many mods I looked at. I strongly feel that every mod should have a changelog (it's a courtesy to prospective users, and a necessity if the update is known to break something), and that it should be accessible inside the game. You -- the developers -- have already provided a wonderful tool to allow that. Unfortunately, it seems to be rather hard to use this tool -- and the lack of official documentation doesn't make it any easier.
With the tutorial, I've tried to educate modders about writing changelogs that make use of the great abilities of the in-game parser. When I posted the first version, what little information I could provide came from comparing changelogs that did parse correctly against others that didn't. It was based mainly on guesswork, and some things I'd figured out were incorrect or incomplete, but with very helpful input from the community and developers (thanks again, Bilka!), and after playing around with several "real" changelogs to find mistakes, I was able to add a lot of information over time. (It's still WIP; just as I'm writing this, somebody has pointed out a new problem in the other thread.)
By now, I've probably spent more time carefully looking over non-working changelogs than most people who care to read this. I think I know all of the common errors, and I've even found some of the rarer ones. Therefore, I believe I can rightfully claim to be quite competent in changelog matters now.
In the past few weeks, quite a number of changelogs had entries like "Added changelog", or "Fixed changelogs not showing in game". This clearly shows that many modders are willing to provide parsable changelogs once they've learnt about what is needed.
There definitely are bugs that are clearly down-to-earth bugs, and it is perfectly OK that parsing such a bug results in an error. I'm thinking of the header line starting with a dot instead of a dash, for example, or the missing line break in front of the header line (so it was glued to the end of the previous line). But there are also bugs that are really hard to find, and completely unnecessary. A space after a colon results in an error? An empty line, with just a tabulator before the line break, breaks parsing? So does a header line with 100 instead of 99 dashes? No, this can't be serious! That must be somebody's idea of a joke, but it's a bad joke by my book.
In my opinion, there are two things you could do to help modders write working changelog files:
With the tutorial, I've tried to educate modders about writing changelogs that make use of the great abilities of the in-game parser. When I posted the first version, what little information I could provide came from comparing changelogs that did parse correctly against others that didn't. It was based mainly on guesswork, and some things I'd figured out were incorrect or incomplete, but with very helpful input from the community and developers (thanks again, Bilka!), and after playing around with several "real" changelogs to find mistakes, I was able to add a lot of information over time. (It's still WIP; just as I'm writing this, somebody has pointed out a new problem in the other thread.)
By now, I've probably spent more time carefully looking over non-working changelogs than most people who care to read this. I think I know all of the common errors, and I've even found some of the rarer ones. Therefore, I believe I can rightfully claim to be quite competent in changelog matters now.
In the past few weeks, quite a number of changelogs had entries like "Added changelog", or "Fixed changelogs not showing in game". This clearly shows that many modders are willing to provide parsable changelogs once they've learnt about what is needed.
Yes, dear developers, believe it or not: There still are many people out there who are totally unaware that something like a special syntax for changelog files even exists!
However, some of them failed, and even though they thought they had done everything correctly, their changelogs couldn't be parsed. By any means, that is definitely not because they've been too stupid to follow some clearly laid out rules, but because the rules are absurdly strict! One modder even added "It's apparently a science field" to his "fixed changelog" entry -- that should show how hard it is to follow the rules, even if one wants to. I therefore appeal to you, the developers: Please, make the changelog parser more lenient, more tolerant of minor mistakes!There definitely are bugs that are clearly down-to-earth bugs, and it is perfectly OK that parsing such a bug results in an error. I'm thinking of the header line starting with a dot instead of a dash, for example, or the missing line break in front of the header line (so it was glued to the end of the previous line). But there are also bugs that are really hard to find, and completely unnecessary. A space after a colon results in an error? An empty line, with just a tabulator before the line break, breaks parsing? So does a header line with 100 instead of 99 dashes? No, this can't be serious! That must be somebody's idea of a joke, but it's a bad joke by my book.
In my opinion, there are two things you could do to help modders write working changelog files:
- Relax the rules, for example by using a kind of pre-processor that converts wrong changelog files to the right format! Most minor mistakes could be caught with regular expressions. I'll use sed-commands in the following, but I guess C and Lua allow for regular expressions as well.
- Globally replace tabs with a space:
Code: Select all
's/\t/ /g'
- Delete empty lines, including lines that contain only spaces:
Code: Select all
'/^ *$/d'
- Make sure the first line is a header line:
Code: Select all
'1 s/^ *\([^-][^-].\+\)$/---------------------------------------------------------------------------------------------------\n\1/'
- Make sure the last line is not a header line:
Code: Select all
'$ s/^ *-\+ *$//'
- Make sure all headerlines have the required format:
Code: Select all
's/^ *-\+ *$/---------------------------------------------------------------------------------------------------/'
- Delete lines with empty Date fields:
Code: Select all
'/^ *[Dd][Aa][Tt][Ee] *: *$/d'
- Correctly format Version lines:
Code: Select all
's/^ *\[Vv][Ee][Rr][Ss][Ii][Oo][Nn] *:\(.\+\)*$/Version: /\1/'
- Correctly format any remaining Date lines:
Code: Select all
's/^ *[Dd][Aa][Tt][Ee] *: *\(.\+\) *$/Date: \1/'
- Make sure the other field/category names are formatted correctly:
Code: Select all
's/^ *\([^:]\+\) *: *-* *\(.\+\) *$/ \1:\n - \2/'
- Make sure the actual entries are indented correctly:
Code: Select all
's/^ *-* *\(.\+\) *$/ - \1/'
- Just to make sure, remove any trailing spaces:
Code: Select all
's/ *$//'
- Globally replace tabs with a space:
- … the error messages. Make them more expressive, please! A message like this is good: because it tells exactly what is wrong here. But a message like
Code: Select all
Failed to parse changelog for mod [insert mod name here]: invalid changelog file, error on line 4, missing category.
doesn't give any clue what could be wrong. Considering that most of the buggy files fail to parse because of too many (or not enough) spaces or dashes, or because they contain the wrong kind of white space characters (i.e. tabulators), such error messages are not really useful.Code: Select all
Failed to parse changelog for mod [insert mod name here]: invalid changelog file, error on line 123.
Actually, I'm confined to version 0.17.14 because of a still-unfixed bug introduced in 0.17.15, and two of the mods I wanted to use are disabled because they depend on base >= 0.17.14, so I'm definitely an interested party there!
But with a few small changes (yes, I know it's easy to say that if you don't have to implement them) you could make life much easier for a lot of the modders and, consequently, their -- and your! -- users. Just do so, pretty please!