(GEP-386) Validate that mode attributes are strings

This commit introduces two new issues. The first one  isfor cases
where a non-octal integer literal is used as a file mode. This issue
is only relevant in versions >= 4.0 and the condition will always be
reported as an error. The second is a stylistic issue for the case
where an integer literal is used the mode attribute. It's motivated
by the style guide that recommends that this value should be a
string in all cases.

A quick fix is added for both problems. It converts the value to
a single quoted string and adds a leading zero if that is missing.

The stylistic issue can be controlled with a settable preference. The
default value setting is WARNING.