added all hooks to readme. Passing all tests

This commit is contained in:
Alvaro Andrés Rodríguez Scelza 2019-06-11 11:13:33 -03:00
parent 2a7440ef4f
commit c0145f16cb
3 changed files with 33 additions and 5 deletions

View file

@ -215,7 +215,7 @@
always_run: true always_run: true
- id: check-line - id: check-line
name: Check Line name: Check Line
description: Checks desired lines are formatted as desired in python an xml files. description: Checks desired lines are formatted as desired in python and xml files.
entry: check-line entry: check-line
language: python language: python
- id: check-model-name - id: check-model-name
@ -226,16 +226,19 @@
types: [python] types: [python]
- id: check-class-docstring - id: check-class-docstring
name: Check Class Docstring name: Check Class Docstring
description: Checks that each python class has a docstring.
entry: check-class-docstring entry: check-class-docstring
language: python language: python
types: [python] types: [python]
- id: check-view-name - id: check-view-name
name: Check View Name name: Check View Name
description: Checks that odoo views name follow odoo guidelines.
entry: check-view-name entry: check-view-name
language: python language: python
types: [xml] types: [xml]
- id: check-view-fields-order - id: check-view-fields-order
name: Check View Fields Order name: Check View Fields Order
description: Checks view fields order follow odoo guidelines.
entry: check-view-fields-order entry: check-view-fields-order
language: python language: python
types: [xml] types: [xml]

View file

@ -155,6 +155,31 @@ Add this to your `.pre-commit-config.yaml`
]` ]`
Receives a regular expression Receives a regular expression
- `check-branch-name` - Checks current branch name.
- To specify correct branch name use `args: [--regex]`. Example:
`args: [
--regex, 'develop\..+?\.(DEFECTO|INVES|MEJORA)\.\d+(_\d+)*'
]`
- `check-line` - Checks desired lines are formatted as desired in python and xml files.
- To specify correct branch name use `args: [--line-to-check, --regexp-to-match]`. Example:
`args: [
--line-to-check, '^(\t| )*<field.+',
--line-to-check, '^(\t| )*<record.+',
--line-to-check, '.+fields.Many2one.+',
--line-to-check, '.+fields.One2many.+',
--line-to-check, '.+fields.Many2many.+',
--line-to-check, 'class.+',
--regexp-to-match, '^(\t| )*<field name=".+"',
--regexp-to-match, '^(\t| )*<record id=".+"',
--regexp-to-match, '^(\t| )*.+_id = fields.Many2one\(',
--regexp-to-match, '^(\t| )*.+_ids = fields.One2many\(',
--regexp-to-match, '^(\t| )*.+_ids = fields.Many2many\(',
--regexp-to-match, 'class ([A-Z]+[a-z0-9]+)+\(.+\):',
]`
- `check-model-name` - Checks that odoo model name uses dot notation and has module name as prefix.
- `check-class-docstring` - Checks that each python class has a docstring.
- `check-view-name` - Checks that odoo views name follow odoo guidelines.
- `check-view-fields-order` - Checks view fields order follow odoo guidelines.
### Deprecated / replaced hooks ### Deprecated / replaced hooks

View file

@ -53,6 +53,10 @@ repos:
args: [ args: [
--exclude, '.*(\/)*__openerp__.py$', --exclude, '.*(\/)*__openerp__.py$',
] ]
- id: check-branch-name
args: [
--regex, 'develop\..+?\.(DEFECTO|INVES|MEJORA)\.\d+(_\d+)*'
]
- id: check-line - id: check-line
args: [ args: [
--line-to-check, '^(\t| )*<field.+', --line-to-check, '^(\t| )*<field.+',
@ -72,8 +76,4 @@ repos:
- id: check-model-name - id: check-model-name
- id: check-view-name - id: check-view-name
- id: check-view-fields-order - id: check-view-fields-order
- id: check-branch-name
args: [
--regex, 'develop\..+?\.(DEFECTO|INVES|MEJORA)\.\d+(_\d+)*'
]
- id: check-class-docstring - id: check-class-docstring