Skip to content

Commit 37a282e

Browse files
committed
#1930 fix pre-commit configuration & format python files
Signed-off-by: Julien Buret <jburet@gmail.com>
1 parent 0e3d836 commit 37a282e

File tree

223 files changed

+1384
-646
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

223 files changed

+1384
-646
lines changed

.pre-commit-config.yaml

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
1+
files: \.py$
12
repos:
23
- repo: https://github.com/gitleaks/gitleaks
3-
rev: v8.22.1
4+
rev: v8.28.0
45
# the default gitleaks configuration file : https://github.com/gitleaks/gitleaks/blob/master/config/gitleaks.toml
56
hooks:
67
- id: gitleaks
78
- repo: https://github.com/psf/black
8-
rev: 23.11.0
9+
rev: 25.9.0
910
hooks:
1011
- id: black
1112
files: ^/gen-ai/orchestrator-server/src/main/python/
12-
language_version: python3.9
13+
language_version: python3
1314
- repo: https://github.com/Lucas-C/pre-commit-hooks
14-
rev: v1.5.4
15+
rev: v1.5.5
1516
hooks:
1617
- id: insert-license
1718
files: \.py$
@@ -21,24 +22,25 @@ repos:
2122
- --use-current-year
2223
- --no-extra-eol
2324
- repo: https://github.com/pre-commit/pre-commit-hooks
24-
rev: v4.5.0
25+
rev: v6.0.0
2526
hooks:
2627
- id: check-ast
2728
- id: double-quote-string-fixer
2829
- id: trailing-whitespace
2930
- id: end-of-file-fixer
3031
files: '\.md$'
3132
- repo: https://github.com/pycqa/isort
32-
rev: 5.12.0
33+
rev: 7.0.0
3334
hooks:
3435
- id: isort
3536
files: "\\.(py)$"
3637
args: [ --settings-path=gen-ai/orchestrator-server/src/main/python/server/pyproject.toml ]
3738
- repo: https://github.com/hadialqattan/pycln
38-
rev: v2.3.0
39+
rev: v2.6.0
3940
hooks:
4041
- id: pycln
4142
- repo: https://github.com/pypa/pip-audit
42-
rev: v2.7.3
43+
rev: v2.9.0
4344
hooks:
44-
- id: pip-audit
45+
- id: pip-audit
46+
additional_dependencies: ["pip>=25.3"]

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ Open Conversational AI platform to build Bots:
3535

3636
💬 Contact: [https://gitter.im/tockchat/Lobby](https://gitter.im/tockchat/Lobby)
3737

38-
## Using Pre-commit
38+
## Python developers : using Pre-commit
3939

40-
This project uses **pre-commit** to automate code checks and formatting before each commit, ensuring consistent code quality and reducing errors.<br/>
40+
The python part of the project uses **pre-commit** to automate code checks and formatting before each commit, ensuring consistent code quality and reducing errors.<br/>
4141
It is very important to always execute these hooks to maintain the quality of the code.
4242

4343
### Installation

docs/hooks/Rellinkadd.py

Lines changed: 27 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,44 @@
1+
# Copyright (C) 2025 Credit Mutuel Arkea
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
#
115
import os
16+
217
from mkdocs.config.defaults import MkDocsConfig
318
from mkdocs.structure.files import Files
419
from mkdocs.structure.pages import Page
520

21+
622
def on_page_markdown(
723
markdown: str, *, page: Page, config: MkDocsConfig, files: Files
8-
):
24+
):
925
docs_dir = config['docs_dir']
10-
11-
includes_dir = os.path.join(docs_dir, '../includes')
12-
chatbot_path = os.path.join(includes_dir, 'chatbot.md')
13-
26+
27+
includes_dir = os.path.join(docs_dir, '../includes')
28+
chatbot_path = os.path.join(includes_dir, 'chatbot.md')
29+
1430
if not os.path.exists(chatbot_path):
1531
print(f"⚠️ Fichier 'chatbot.md' introuvable à {chatbot_path}")
16-
return markdown
32+
return markdown
1733

1834
with open(chatbot_path, 'r', encoding='utf-8') as f:
1935
chatbot_content = f.read()
20-
21-
markdown += "\n\n" + chatbot_content
22-
23-
36+
37+
markdown += '\n\n' + chatbot_content
38+
39+
2440
if page.file.url in ('fr/index.md', 'en/index.md'):
25-
path_to_docs_root = './'
41+
path_to_docs_root = './'
2642
else:
2743

2844
depth = len(page.file.url.split('/')) - 1

docs/hooks/copyapiswagger.py

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,42 @@
1-
import os
1+
# Copyright (C) 2025 Credit Mutuel Arkea
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
#
215
import shutil
316
from pathlib import Path
17+
418
from mkdocs.plugins import BasePlugin
519

620
tock_apistatic = {
7-
"../../bot/connector-web/web-connector.html": "api/web-connector.html",
8-
"../../bot/connector-web/Swagger_TOCKWebConnector.yaml": "api/Swagger_TOCKWebConnector.yaml",
9-
"../../nlp/api/doc/src/main/doc/admin.html": "api/admin.html",
10-
"../../nlp/api/doc/src/main/doc/admin.yaml": "api/admin.yaml",
11-
"../../nlp/api/doc/src/main/doc/index.html": "api/index.html",
12-
"../../nlp/api/doc/src/main/doc/nlp.yaml": "api/nlp.yaml"
21+
'../../bot/connector-web/web-connector.html': 'api/web-connector.html',
22+
'../../bot/connector-web/Swagger_TOCKWebConnector.yaml': 'api/Swagger_TOCKWebConnector.yaml',
23+
'../../nlp/api/doc/src/main/doc/admin.html': 'api/admin.html',
24+
'../../nlp/api/doc/src/main/doc/admin.yaml': 'api/admin.yaml',
25+
'../../nlp/api/doc/src/main/doc/index.html': 'api/index.html',
26+
'../../nlp/api/doc/src/main/doc/nlp.yaml': 'api/nlp.yaml'
1327
}
1428

1529
def on_pre_build(config):
1630

1731
docs_dir = Path(config['docs_dir'])
18-
32+
1933
global tock_apistatic
2034

2135
for source, relative_dest in tock_apistatic.items():
2236

2337
destination = docs_dir / relative_dest
2438
source_path = docs_dir / source
25-
39+
2640

2741
destination.parent.mkdir(parents=True, exist_ok=True)
2842

@@ -32,7 +46,7 @@ def on_pre_build(config):
3246
except Exception as e:
3347
print(f"Error deleting {destination}: {e}")
3448

35-
49+
3650
try:
3751
shutil.copy(source_path, destination)
3852
except FileNotFoundError:

0 commit comments

Comments
 (0)