Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ADD] *: pre-commit #237

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .copier-answers.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Do NOT update manually; changes here will be overwritten by Copier
_commit: 3839cf0
_src_path: https://github.com/ingadhoc/addons-repo-template.git
description: ''
is_private: false
name: ADHOC Miscellaneous Modules
odoo_version: 18.0
pre_commit_ignore: []
slug: ''

34 changes: 34 additions & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# ⚠️ DO NOT EDIT THIS FILE, IT IS GENERATED BY COPIER ⚠️
# Changes here will be lost on a future update.
# See: https://github.com/ingadhoc/addons-repo-template

name: pre-commit

on:
push:
branches: "*.0"
pull_request:

jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v4
-
id: setup-python
name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
cache: "pip"
-
name: Pre-commit cache
uses: actions/cache@v4
with:
path: ~/.cache/pre-commit
key: pre-commit|${{ steps.setup-python.outputs.python-version }}|${{ hashFiles('.pre-commit-config.yaml') }}
-
name: Pre-commit
uses: pre-commit/[email protected]
13 changes: 10 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# ⚠️ DO NOT EDIT THIS FILE, IT IS GENERATED BY COPIER ⚠️
# Changes here will be lost on a future update.
# See: https://github.com/ingadhoc/addons-repo-template

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
Expand Down Expand Up @@ -29,7 +33,6 @@ pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.vscode/
.coverage
.cache
nosetests.xml
Expand All @@ -38,6 +41,12 @@ coverage.xml
# Translations
*.mo

# Ensure we never commit pgdumps
*.dump
*.sql
*.pg
*.pg.gpg

# Mr Developer
.mr.developer.cfg
.project
Expand All @@ -51,5 +60,3 @@ coverage.xml

# Sphinx documentation
docs/_build/
#
.idea/
69 changes: 69 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# ⚠️ DO NOT EDIT THIS FILE, IT IS GENERATED BY COPIER ⚠️
# Changes here will be lost on a future update.
# See: https://github.com/ingadhoc/addons-repo-template

exclude: |
(?x)

# We don't want to mess with tool-generated files
.svg$|/tests/([^/]+/)?cassettes/|^.copier-answers.yml$|^.github/|^eslint.config.cjs|^prettier.config.cjs|
# Library files can have extraneous formatting (even minimized)
/static/(src/)?lib/|
# Ignore build and dist directories in addons
/build/|/dist/|
# Ignore test files in addons
/tests/samples/.*|
# You don't usually want a bot to modify your legal texts
(LICENSE.*|COPYING.*)

# Keep in sync with .github/workflows/pre-commit.yml
default_language_version:
python: python3

repos:

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: check-added-large-files
- id: check-case-conflict
- id: check-docstring-first
- id: check-executables-have-shebangs
- id: check-merge-conflict
- id: check-symlinks
- id: check-xml
- id: check-yaml
- id: debug-statements
- id: end-of-file-fixer
- id: mixed-line-ending
args: ["--fix=lf"]
- id: trailing-whitespace
# exclude autogenerated files
exclude: \.pot?$

- repo: https://github.com/OCA/odoo-pre-commit-hooks
rev: v0.0.35
hooks:
- id: oca-checks-odoo-module
args:
- --disable=xml-dangerous-qweb-replace-low-priority,xml-view-dangerous-replace-low-priority,xml-oe-structure-missing-id
- id: oca-checks-po
args:
- --disable=po-pretty-format

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.6.8
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
- id: ruff-format

- repo: https://github.com/OCA/pylint-odoo
rev: v9.1.3
hooks:
- id: pylint_odoo

- repo: https://github.com/rstcheck/rstcheck
rev: v6.2.1
hooks:
- id: rstcheck
10 changes: 4 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
[![Coverage Status](https://coveralls.io/repos/ingadhoc//badge.png?branch=18.0)](https://coveralls.io/r/ingadhoc/?branch=18.0)
[![Code Climate](https://codeclimate.com/github/ingadhoc//badges/gpa.svg)](https://codeclimate.com/github/ingadhoc/)

# ADHOC Miscellaneous Modules

[//]: # (addons)
[//]: # (end addons)

Translation Status
------------------
[![Transifex Status](https://www.transifex.com/projects/p/ingadhoc-miscellaneous-15-0/chart/image_png)](https://www.transifex.com/projects/p/ingadhoc-miscellaneous-15-0)

----

<img alt="ADHOC" src="http://fotos.subefotos.com/83fed853c1e15a8023b86b2b22d6145bo.png" />
**Adhoc SA** - www.adhoc.com.ar

.
4 changes: 2 additions & 2 deletions attachment_s3/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"name": "Attachments on S3 storage",
"summary": "Store assets and attachments on a S3 compatible object storage",
"version": "17.0.1.0.0",
"author": "Camptocamp,Odoo Community Association (OCA)",
"author": "Camptocamp, Odoo Community Association (OCA), ADHOC SA",
"license": "AGPL-3",
"category": "Knowledge Management",
"depends": ["base", "base_attachment_object_storage"],
Expand All @@ -15,5 +15,5 @@
},
"website": "https://github.com/camptocamp/odoo-cloud-platform",
"data": [],
'installable': False,
"installable": False,
}
12 changes: 4 additions & 8 deletions attachment_s3/models/ir_attachment.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
_logger.debug("Cannot 'import boto3'.")


class S3BucketClientRegistry(object):
class S3BucketClientRegistry:
bucket_dict = {}

@classmethod
Expand Down Expand Up @@ -131,9 +131,7 @@ def _store_file_read(self, fname):
try:
bucket = self._get_s3_bucket(name=s3uri.bucket())
except exceptions.UserError:
_logger.exception(
"error reading attachment '%s' from object storage", fname
)
_logger.exception("error reading attachment '%s' from object storage", fname)
return ""
try:
key = s3uri.item()
Expand Down Expand Up @@ -164,7 +162,7 @@ def _store_file_write(self, key, bin_data):
# TODO handle this on a better way
try:
if obj.content_length:
_logger.info('Skip uploading object %s, already exists', filename)
_logger.info("Skip uploading object %s, already exists", filename)
return filename
except Exception:
pass
Expand All @@ -173,9 +171,7 @@ def _store_file_write(self, key, bin_data):
except ClientError as error:
# log verbose error from s3, return short message for user
_logger.exception("Error during storage of the file %s" % filename)
raise exceptions.UserError(
_("The file could not be stored: %s") % str(error)
) from None
raise exceptions.UserError(_("The file could not be stored: %s") % str(error)) from None
else:
_super = super()
filename = _super._store_file_write(key, bin_data)
Expand Down
3 changes: 1 addition & 2 deletions attachment_s3/s3uri.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
import re


class S3Uri(object):

class S3Uri:
_url_re = re.compile("^s3:///*([^/]*)/?(.*)", re.IGNORECASE | re.UNICODE)

def __init__(self, uri):
Expand Down
40 changes: 19 additions & 21 deletions base_dynamic_message/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,27 +18,25 @@
#
##############################################################################
{
'name': 'Dynamic Message',
'version': "18.0.1.0.0",
'category': 'Base',
'sequence': 14,
'summary': '',
'author': 'ADHOC SA',
'website': 'www.adhoc.com.ar',
'license': 'AGPL-3',
'images': [
"name": "Dynamic Message",
"version": "18.0.1.0.0",
"category": "Base",
"sequence": 14,
"summary": "",
"author": "ADHOC SA",
"website": "www.adhoc.com.ar",
"license": "AGPL-3",
"images": [],
"depends": [
"base",
],
'depends': [
'base',
"data": [
"security/res_groups.xml",
"security/ir.model.access.csv",
"views/ir_model_dynamic_message_views.xml",
],
'data': [
'security/res_groups.xml',
'security/ir.model.access.csv',
'views/ir_model_dynamic_message_views.xml',
],
'demo': [
],
'installable': True,
'auto_install': False,
'application': False,
"demo": [],
"installable": True,
"auto_install": False,
"application": False,
}
Loading