parse icon indicating copy to clipboard operation
parse copied to clipboard

Configuration file handling

Open hanneskod opened this issue 9 years ago • 12 comments

Prepares for a configuration file by adding the ability of reading configs from multiple sources. Configuration handling is moved to the Conf namespace.

Merging will close #13.

hanneskod avatar Jan 28 '15 00:01 hanneskod

I'd like to also include a .dist file showing an example of the config file structure too (re: #13)

enygma avatar Jan 28 '15 02:01 enygma

This adds support for json config files, and brings in justinrainbow/json-schema to validate config file structure.

It includes a .psecio-parse.json with the settings used to run the travis builds. Is this good enough for you @enygma? Or do you think I should add support for .psecio-parse.json.dist as well?

The supported file format at this point is

{
    "paths": ["list-of-paths"],
    "ignore-paths": ["list-of-paths"],
    "extensions": ["list-of-extensions"],
    "whitelist-rules": ["list-of-rules"],
    "blacklist-rules": ["list-of-rules"],
    "disable-annotations": true|false,
    "format": "dots|progress|lines|debug|xml"
}

Instead of using verbose and debug settings I will add support for more format identifiers (lines and debug). I think that more clearly communicates what these settings actually do..

Documentation is also missing at this point...

hanneskod avatar Jan 29 '15 22:01 hanneskod

This is now ready for review..

hanneskod avatar Jan 31 '15 14:01 hanneskod

So the idea of a .dist file is to provide an example of the configuration without having a hard-coded config in the release. This way they can just copy over the .dist and use it as the config or they can make their own without having to worry about git marking it as an updated file. And since the lists in there are subjective to whatever the user's project is, it won't work with a default value like "list-of-paths" as you have there.

You can use one of the pre-build commands in Travis to copy it over to the right place too.

enygma avatar Jan 31 '15 15:01 enygma

Ah ok, good point.

If I understand correctly we don't want to parse the .dist automatically, but leave it there as an example?

hanneskod avatar Jan 31 '15 16:01 hanneskod

Yes, a .dist file isn't parsed. And then there is no actual config file that ships, because we shouldn't overwrite an existing config file.

redbeardcreator avatar Feb 04 '15 08:02 redbeardcreator

Now there is a .dist file. I guess the fact that phpunit actually parses phpunit.xml.dist made me uncertain what the requested behavior was here..

As you can see a travis build failed. This was an hhvm issue. Investigations show that PhpParser is not stable for hhvm.

https://travis-ci.org/nikic/PHP-Parser

To reflect this fact I changed our travis config so that hhvm failure is allow.

With these changes this is again ready for review.

hanneskod avatar Feb 08 '15 20:02 hanneskod

Out of curiosity, why is the default file a dot file? I think I'd prefer to see it as an always-visible file.

redbeardcreator avatar Feb 12 '15 09:02 redbeardcreator

Oh, just my preference to keep "meta"-files dotted. But you are probably right. I'll change it later today..

hanneskod avatar Feb 12 '15 11:02 hanneskod

Done..

hanneskod avatar Feb 13 '15 15:02 hanneskod

I haven't tested everything out, but the code looks good. Presuming it all works, :+1:

redbeardcreator avatar Feb 15 '15 04:02 redbeardcreator

I'll have a look at this to make it up to date some time in the future... If anyone else wants to have a go please do :smile:

hanneskod avatar Mar 27 '15 12:03 hanneskod