diff --git a/.pre-commit-hooks.yaml b/.pre-commit-hooks.yaml index 9396d55..7e490d6 100644 --- a/.pre-commit-hooks.yaml +++ b/.pre-commit-hooks.yaml @@ -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] \ No newline at end of file diff --git a/pre_commit_hooks/loaderon-hooks/Documentation/pre-commit-yaml-config.txt b/pre_commit_hooks/loaderon-hooks/Documentation/pre-commit-yaml-config.txt new file mode 100644 index 0000000..bfcaa3f --- /dev/null +++ b/pre_commit_hooks/loaderon-hooks/Documentation/pre-commit-yaml-config.txt @@ -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, '', + ] + - 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| )*