Use last python image for linting

The linting check can be done on any docker image with the latest python
version.

This updates de pre-commit checks and fix file linting to conform to new
standards.
This commit is contained in:
Rémy Taymans 2023-11-09 16:39:40 +01:00
parent 690ab60699
commit 6a36c97ee4
10 changed files with 6 additions and 17 deletions

View File

@ -5,9 +5,8 @@ stages:
- release
pre-commit:
image: python
stage: lint
tags:
- shell
only:
- merge_requests
before_script:

View File

@ -2,7 +2,7 @@
exclude: '^tests/data/output_expected/'
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.4.0
rev: v4.5.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
@ -19,15 +19,15 @@ repos:
- id: check-merge-conflict
- id: check-symlinks
- repo: https://github.com/pre-commit/mirrors-isort
rev: v5.7.0
rev: v5.10.1
hooks:
- id: isort
- repo: https://github.com/psf/black
rev: 22.3.0
rev: 23.11.0
hooks:
- id: black
- repo: https://github.com/PyCQA/flake8
rev: "3.9.2"
rev: "6.1.0"
hooks:
- id: flake8
# - repo: https://gitlab.com/smop/pre-commit-hooks

View File

@ -27,7 +27,6 @@ def docker_build(ctx, versions):
# Build images for each odoo version
for odoo_version in get_odoo_versions_from_options(ctx, versions):
odoo_requirement_file_path = (
get_odoo_env_path(ctx, odoo_version) / "src/odoo/requirements.txt"
)

View File

@ -33,7 +33,6 @@ from odoo_openupgrade_wizard.tools.tools_system import ensure_folder_writable
)
@click.pass_context
def generate_module_analysis(ctx, step, database, modules):
migration_steps = get_migration_steps_from_options(ctx, step - 1, step)
initial_step = migration_steps[0].copy()

View File

@ -67,7 +67,6 @@ def database_option_required(function):
def get_odoo_versions_from_options(ctx, versions_arg):
if not versions_arg:
return ctx.obj["config"]["odoo_versions"]
else:

View File

@ -23,7 +23,6 @@ from odoo_openupgrade_wizard.tools.tools_postgres import (
@database_option_required
@click.pass_context
def upgrade(ctx, first_step, last_step, database):
migration_steps = get_migration_steps_from_options(
ctx, first_step, last_step
)

View File

@ -107,7 +107,6 @@ def generate_odoo_command(
stop_after_init: bool = False,
shell: bool = False,
) -> str:
odoo_env_path = get_odoo_env_path(ctx, migration_step["version"])
# Compute 'server_wide_modules'
@ -295,7 +294,6 @@ def execute_click_odoo_python_files(
python_files: list = [],
execution_context: str = False,
):
if not python_files:
# Get post-migration python scripts to execute
script_folder = get_script_folder(ctx, migration_step)

View File

@ -10,7 +10,6 @@ _ODOO_RPC_URL = "0.0.0.0"
class OdooInstance:
env = False
version = False
@ -84,7 +83,7 @@ class OdooInstance:
return model.browse(model.create(vals))
def install_modules(self, module_names):
if type(module_names) == str:
if type(module_names) is str:
module_names = [module_names]
installed_modules = []
i = 0

View File

@ -117,7 +117,6 @@ class Analysis(object):
# Instanciate a new odoo_module
for module_name in module_list:
addon_path = OdooModule.get_addon_path(
ctx, module_name, self.initial_version
)
@ -476,7 +475,6 @@ class OdooModule(object):
class OdooModuleVersion(object):
_exclude_directories = [
"lib",
"demo",

View File

@ -84,7 +84,6 @@ def ensure_file_exists_from_template(
def git_aggregate(folder_path: Path, config_path: Path, jobs: int):
args = argparse.Namespace(
command="aggregate",
config=str(config_path),