Skip to content

Commit

Permalink
Update repository with dev tools
Browse files Browse the repository at this point in the history
  • Loading branch information
kmagusiak committed Jul 7, 2024
1 parent eefd813 commit f9a9bda
Show file tree
Hide file tree
Showing 14 changed files with 57 additions and 71 deletions.
16 changes: 9 additions & 7 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"vscode": {
"settings": {
"editor.insertSpaces": false,
"editor.rulers": [79, 100],
"editor.rulers": [79, 100, 116],
"files.eol": "\n",
"search.followSymlinks": true,
"terminal.integrated.defaultProfile.linux": "bash",
Expand Down Expand Up @@ -46,20 +46,22 @@

"extensions": [
"ms-python.python",
"ms-python.black-formatter",
"ms-python.flake8",
"ms-python.isort",
"ms-python.vscode-pylance",
//"ms-python.black-formatter",
//"ms-python.flake8",
//"ms-python.isort",
"charliermarsh.ruff",
//"dbaeumer.vscode-eslint",
"mtxr.sqltools",
"mtxr.sqltools-driver-pg",
"eamodio.gitlens",
"mstuttgart.odoo-snippets",
"visualstudioexptteam.vscodeintellicode",
// odoo addons
"Odoo.odoo",
"mstuttgart.odoo-snippets",
"scapigliato.vsc-odoo-development",
"scapigliato.odoo-snippets",
// my addons
"dbaeumer.vscode-eslint",
"donjayamanne.githistory",
"foam.foam-vscode",
"gruntfuggly.todo-tree",
"mechatroner.rainbow-csv",
Expand Down
23 changes: 0 additions & 23 deletions .flake8

This file was deleted.

10 changes: 4 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
# Python files
*.py[cod]
__pycache__
.*_cache

# Local files
/.env
*.override.yaml
/.vscode/launch.json

# Temporary files
# Python and temporary files
*.py[cod]
__pycache__
.*_cache
*~
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"editor.insertSpaces": false,
"editor.rulers": [79, 100],
"editor.rulers": [78, 100, 116],
"files.eol": "\n",
"search.useIgnoreFiles": false,
"[python]": {
Expand Down
13 changes: 1 addition & 12 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,16 +1,5 @@
arg ODOO_VERSION=master
arg DOCKER_BASE_IMAGE=base_image

# Base image with added development tools
from ghcr.io/kmagusiak/odoo-docker:${ODOO_VERSION} as base_image
user root
run apt-get update \
&& apt-get install -y --no-install-recommends \
bash-completion gettext git htop less openssh-client vim
# chrome for testing
run curl https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb --output /tmp/google-chrome.deb \
&& apt-get install -y --no-install-recommends /tmp/google-chrome.deb \
&& rm /tmp/google-chrome.deb
arg DOCKER_BASE_IMAGE=ghcr.io/kmagusiak/odoo-docker:${ODOO_VERSION}-dev

# Create the vscode development image
# python (dev) requirements
Expand Down
3 changes: 2 additions & 1 deletion addons/template/.pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ method-required-super=create,write,read,unlink,copy,setUp,setUpClass,tearDown,de
[MESSAGES CONTROL]
disable=all

# some disabled rules that can be interesting for teams
# - manifest-required-author
enable=async,logging,method_args,modified_iteration,stdlib,
anomalous-backslash-in-string,
arguments-differ,
Expand All @@ -35,7 +37,6 @@ enable=async,logging,method_args,modified_iteration,stdlib,
license-allowed,
manifest-author-string,
manifest-deprecated-key,
manifest-required-author,
manifest-required-key,
manifest-version-format,
method-compute,
Expand Down
9 changes: 4 additions & 5 deletions addons/template/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@ cd "$(dirname "$0")"
[[ "$0" != *.git/hooks/* ]] || cd ../..

pre_commit() {
flake8
black --check .
isort --check-only .
ruff check
ruff format --check
lint_text
}

Expand All @@ -23,8 +22,8 @@ lint_text() {
}

format() {
black .
isort .
ruff check --fix
ruff format
}

lint() {
Expand Down
14 changes: 11 additions & 3 deletions addons/template/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@
requires = [
"setuptools>=61",
"setuptools-scm>=6",
"wheel",
]
build-backend = "setuptools.build_meta"

[tool.setuptools_scm]
local_scheme = "no-local-version"

[tool.black]
line-length = 100
skip-string-normalization = 1
Expand All @@ -17,5 +19,11 @@ ignore_missing_imports = true
profile = "black"
line_length = 100

[tool.setuptools_scm]
local_scheme = "no-local-version"
[tool.ruff]
line-length = 100

[tool.ruff.format]
quote-style="preserve"

[tool.ruff.lint.per-file-ignores]
"__init__.py" = ["F401"]
13 changes: 8 additions & 5 deletions addons/template/template_module/i18n/template_module.pot
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Project-Id-Version: Odoo Server 17.4alpha1\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-07-07 09:09+0000\n"
"PO-Revision-Date: 2024-07-07 09:09+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
Expand Down Expand Up @@ -34,13 +36,14 @@ msgid "Hello"
msgstr ""

#. module: template_module
#: model:ir.model.fields,field_description:template_module.field_template_template__id
msgid "ID"
#. odoo-python
#: code:addons/template_module/models/template.py:0
msgid "Hello %s"
msgstr ""

#. module: template_module
#: model:ir.model.fields,field_description:template_module.field_template_template____last_update
msgid "Last Modified on"
#: model:ir.model.fields,field_description:template_module.field_template_template__id
msgid "ID"
msgstr ""

#. module: template_module
Expand Down
3 changes: 2 additions & 1 deletion addons/template/template_module/models/template.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from odoo import api, fields, models
from odoo.tools.translate import _


class Template(models.Model):
Expand All @@ -11,4 +12,4 @@ class Template(models.Model):
@api.depends('name')
def _compute_hello(self):
for r in self:
r.hello = "Hello %s" % r.name
r.hello = _("Hello %s", r.name)
3 changes: 2 additions & 1 deletion addons/template/template_module/views/views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,6 @@
</record>
<menuitem id="action_template_template_menu"
action="action_template_template"
parent="base.menu_reporting_dashboard"/>
/>
<!-- parent="base.menu_administration" -->
</odoo>
14 changes: 11 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@
requires = [
"setuptools>=61",
"setuptools-scm>=6",
"wheel",
]
build-backend = "setuptools.build_meta"

[tool.setuptools_scm]
local_scheme = "no-local-version"

[tool.black]
line-length = 100
skip-string-normalization = 1
Expand All @@ -17,5 +19,11 @@ ignore_missing_imports = true
profile = "black"
line_length = 100

[tool.setuptools_scm]
local_scheme = "no-local-version"
[tool.ruff]
line-length = 100

[tool.ruff.format]
quote-style="preserve"

[tool.ruff.lint.per-file-ignores]
"__init__.py" = ["F401"]
3 changes: 1 addition & 2 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
# linting and formatting
black>=22
flake8>=7
isort>=5
pylint-odoo>=9
ruff>=0.5

# debugging and tools
debugpy
Expand Down
2 changes: 1 addition & 1 deletion scripts/env-template
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ DEBUGPY_ENABLE=1
# Odoo Configuration file defaults
ADMIN_PASSWORD=odooadmin
# DB_SSLMODE=prefer
# DB_TEMPLATE=template1
# DB_TEMPLATE=template0
# DB_FILTER=.*
DB_NAME=odoo
# LIMIT_MEMORY_HARD=2684354560
Expand Down

0 comments on commit f9a9bda

Please sign in to comment.