mirror of
https://github.com/pre-commit/pre-commit-hooks.git
synced 2026-04-05 11:36:54 +00:00
Added hooks conf
added doc files on how to use loaderon hooks
This commit is contained in:
parent
d0220a7b00
commit
41f01dd70a
3 changed files with 132 additions and 0 deletions
|
|
@ -186,3 +186,56 @@
|
|||
language: python
|
||||
types: [text]
|
||||
stages: [commit, push, manual]
|
||||
|
||||
# Loaderon hooks:
|
||||
|
||||
- id: check-xml-encoding
|
||||
name: Checks .xml Files Encoding
|
||||
description: Checks that xml files have required encoding as first line.
|
||||
entry: check-xml-encoding
|
||||
language: python
|
||||
types: [xml]
|
||||
- id: check-location
|
||||
name: Checks Files Location
|
||||
description: Checks that specified files are located inside specified directories.
|
||||
entry: check-location
|
||||
language: python
|
||||
- id: check-using-pylint
|
||||
name: Check Python Using Pylint
|
||||
description: Checks python files using pylint.
|
||||
entry: check-using-pylint
|
||||
language: python
|
||||
types: [python]
|
||||
- id: check-branch-name
|
||||
name: Check Branch Name
|
||||
description: Checks current branch name follows '--regex' style convention.
|
||||
entry: check-branch-name
|
||||
language: python
|
||||
pass_filenames: false
|
||||
always_run: true
|
||||
- id: check-line
|
||||
name: Check Line
|
||||
description: Checks desired lines are formatted as desired in python an xml files.
|
||||
entry: check-line
|
||||
language: python
|
||||
- id: check-model-name
|
||||
name: Check Model Name
|
||||
description: Checks that model name uses dot notation and has module name as prefix.
|
||||
entry: check-model-name
|
||||
language: python
|
||||
types: [python]
|
||||
- id: check-class-docstring
|
||||
name: Check Class Docstring
|
||||
entry: check-class-docstring
|
||||
language: python
|
||||
types: [python]
|
||||
- id: check-view-name
|
||||
name: Check View Name
|
||||
entry: check-view-name
|
||||
language: python
|
||||
types: [xml]
|
||||
- id: check-view-fields-order
|
||||
name: Check View Fields Order
|
||||
entry: check-view-fields-order
|
||||
language: python
|
||||
types: [xml]
|
||||
|
|
@ -0,0 +1,79 @@
|
|||
This file show how to use loaderon-hooks, showing arguments examples when the corresponding hook needs it.
|
||||
|
||||
Add from here to your project .pre-commit-config.yaml file:
|
||||
|
||||
repos:
|
||||
- repo: https://github.com/Loaderon/pre-commit-hooks
|
||||
rev: v1.0
|
||||
hooks:
|
||||
# Loaderon hooks
|
||||
- id: check-xml-encoding
|
||||
args: [
|
||||
--encoding, '<?xml version="1.0" encoding="utf-8"?>',
|
||||
]
|
||||
- id: check-location
|
||||
args: [
|
||||
--directories, '^[^\/]+$',
|
||||
--directories, '.*\/controllers$',
|
||||
--directories, '.*\/data$',
|
||||
--directories, '.*\/i18n$',
|
||||
--directories, '.*\/models$',
|
||||
--directories, '.*\/report$',
|
||||
--directories, '.*\/security$',
|
||||
--directories, '.*\/static\/img$',
|
||||
--directories, '.*\/static\/lib\/external_lib$',
|
||||
--directories, '.*\/static\/src\/js$',
|
||||
--directories, '.*\/static\/src\/css$',
|
||||
--directories, '.*\/static\/src\/less$',
|
||||
--directories, '.*\/static\/src\/xml$',
|
||||
--directories, '.*\/static\/tests$',
|
||||
--directories, '.*[^\/static]\/tests$',
|
||||
--directories, '.*\/views$',
|
||||
--directories, '.*\/wizard$',
|
||||
|
||||
--files, '__init__.py$ __openerp__.py$',
|
||||
--files, '__init__.py$ .*\.py$ main.py$',
|
||||
--files, '.*_data\.xml$ .*_demo\.xml$',
|
||||
--files, '.*\.po$',
|
||||
--files, '__init__.py$ .*\.py$',
|
||||
--files, '__init__.py$ .*\.py$ .*_views\.xml$ .*_reports\.xml$ .*_templates\.xml$',
|
||||
--files, 'ir.model.access.csv$ .*_security\.xml$',
|
||||
--files, '.*\.png$ .*\.jpg$',
|
||||
--files, '.*\$',
|
||||
--files, '.*\.js$',
|
||||
--files, '.*\.css$',
|
||||
--files, '.*\.less$',
|
||||
--files, '.*\.xml$',
|
||||
--files, '.*\.tour\.js$',
|
||||
--files, '__init__.py$ test_.*\.py',
|
||||
--files, '.*_templates\.xml$ .*_views\.xml$',
|
||||
--files, '.*\.py$ .*_views\.xml$',
|
||||
]
|
||||
- id: check-line
|
||||
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]+)+\(.+\):',
|
||||
]
|
||||
- id: check-model-name
|
||||
- id: check-view-name
|
||||
- id: check-view-fields-order
|
||||
- id: check-using-pylint
|
||||
args: [
|
||||
--exclude, '.*(\/)*__openerp__.py$',
|
||||
]
|
||||
- id: check-branch-name
|
||||
args: [
|
||||
--regex, 'develop\..+?\.(DEFECTO|INVES|MEJORA)\.\d+(_\d+)*'
|
||||
]
|
||||
- id: check-class-docstring
|
||||
Loading…
Add table
Add a link
Reference in a new issue