[RFC] Multi-glob rules && cmd_rules
Marius Kruger
amanic at gmail.com
Thu Jan 15 20:56:44 GMT 2009
hi,
<bzr help rules> wrote:
> Rules are defined in ini file format where the sections are file glob
> patterns and the contents of each section are the preferences for files
> matching that pattern. For example:
>
> [name *.bat]
> eol = dos
>
> [name *.html]
> keywords = escape
I've always suspected but finally decided that I NEED rules to properly
configure my text checker plugin.
here is an example of what I'd like to configure:
==
[name *.py, *.java, NEWS, README]
trailing_whitespace=fail
leading_tabs=warn
newline_at_eof=warn
long_line_length=80
long_lines=ask
==
As you can see I'd like to specify the same bunch of rules for multiple
globs.
I was thinking that we could split them up in
rules.IniBasedRulesSearcher.__init__,
but then we'd have to
(1) keep a dict of pattern->rules entries for when we match rules.
I figured that the config is read into memory anyways, so it wouldn't be
that bad
to get what we need all at once and keep it. OR
(2) we just need to keep a dict of glob->section mappings.
Would one of those be ok?
Also I think it would be handy to have a command to print out all the rules
affecting
a specific branch or file eg:
bzr rules
[name *.bat]
eol = dos
...
bzr rules x.bat
eol = dos
But then we'd have to rename the rules help topic.
regards
marius
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://lists.ubuntu.com/archives/bazaar/attachments/20090115/1de1235f/attachment.htm
More information about the bazaar
mailing list