style: Refactor the style checker as a Python package
Review Request #3383 - Created March 16, 2016 and submitted
| Information | |
|---|---|
| Andreas Sandberg | |
| gem5 | |
| default | |
| Reviewers | |
| Default | |
Changeset 11374:e2a7d111ec6e
---------------------------
style: Refactor the style checker as a Python package
Refactor the style checker into a Python module that can be reused by
command line tools that integrate with git. In particular:
* Create a style package in util
* Move style validators from style.py to the style/validators.py.
* Move style verifiers from style.py to the style/verifiers.py.
* Move utility functions (sort_includes, region handling,
file_types) into the style package
* Move generic code from style.py to style/style.py.
Signed-off-by: Andreas Sandberg <andreas.sandberg@arm.com>
Reviewed-by: Curtis Dunham <curtis.dunham@arm.com>
Posted (March 24, 2016, 9 p.m.)
Do the "validators" do anything the "verifiers" don't? If the only usage of the validators is when people manually type 'hg m5format' (which I never do), and the validators don't include any additional checks, then I'd be fine with just getting rid of them.
On closer inspection, the one thing validate() currently checks that the verifiers don't is whether the file has any carriage returns (i.e., DOS-format files). If we added that to the Whitespace verifier then I think the coverage would be a superset.
Ship It!
