Skip to content

Commit 3410b75

Browse files
authored
Merge pull request #2 from argodevops/feature/run-sim-example
feat: pre-commit
2 parents 7821b40 + 5aec3ac commit 3410b75

File tree

5 files changed

+67
-21
lines changed

5 files changed

+67
-21
lines changed

.pre-commit-config.yaml

Lines changed: 51 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,58 @@
1+
# To use:
2+
#
3+
# pre-commit run -a
4+
#
5+
# Or:
6+
#
7+
# pre-commit install # (runs every time you commit in git)
8+
#
9+
# To update this file:
10+
#
11+
# pre-commit autoupdate
12+
#
13+
# See https://github.com/pre-commit/pre-commit
14+
115
repos:
16+
# Standard hooks
17+
- repo: https://github.com/pre-commit/pre-commit-hooks
18+
rev: v4.5.0
19+
hooks:
20+
- id: check-added-large-files
21+
- id: check-case-conflict
22+
- id: check-docstring-first
23+
- id: check-merge-conflict
24+
- id: check-symlinks
25+
- id: check-toml
26+
- id: debug-statements
27+
- id: mixed-line-ending
28+
- id: requirements-txt-fixer
29+
- id: trailing-whitespace
30+
31+
- repo: https://github.com/timothycrosley/isort
32+
rev: 5.13.2
33+
hooks:
34+
- id: isort
35+
exclude: ^(docs/)|(project/)|(assignments/)|(project/interface/)|(examples/)
36+
37+
# - repo: https://github.com/pre-commit/mirrors-mypy
38+
# rev: v1.8.0
39+
# hooks:
40+
# - id: mypy
41+
# exclude: ^(docs/)|(project/)|(assignments/)|(project/interface/)|(examples/)
42+
243
- repo: https://github.com/psf/black
3-
rev: 22.8.0
44+
rev: 23.12.1
445
hooks:
546
- id: black
47+
648
- repo: https://github.com/astral-sh/ruff-pre-commit
7-
# Ruff version.
8-
rev: v0.1.7
49+
rev: v0.1.9
950
hooks:
10-
# Run the linter.
1151
- id: ruff
12-
# Run the formatter.
13-
- id: ruff-format
52+
- id: ruff-format
53+
54+
# # Doc linter
55+
# - repo: https://github.com/terrencepreilly/darglint
56+
# rev: v1.8.1
57+
# hooks:
58+
# - id: darglint

config/sim.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
informer:
22
command: java -version -Dtest.properties
3-
properties:
3+
properties:
44
personSearch: person.csv
55
vehicleSearch: vehicle.csv
66
locationSearch: location.csv

output.log

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ personSearch=person.csv
131131
2023-12-04 17:58:26,476 - INFO - Simulaton: informer
132132
2023-12-04 17:58:26,476 - INFO - Simulation properties: {'command': 'java -jar simulation.informer -Dtest.properties', 'properties': {'personSearch': 'person.csv'}}
133133
2023-12-04 17:58:26,477 - INFO - Building test.properties file
134-
2023-12-04 17:58:26,477 - INFO -
134+
2023-12-04 17:58:26,477 - INFO -
135135
2023-12-04 17:58:26,477 - INFO - # TEST PROPERTIES. ENV dc1, SIM informer
136136
domain=https://example.com/dc1
137137
personSearch=person.csv
@@ -167,7 +167,7 @@ domain=https://example.com/dc1
167167
personSearch=person.csv
168168

169169
2023-12-04 18:00:37,153 - INFO - Executing simulation command: java -version -Dtest.properties
170-
2023-12-04 18:00:37,189 - INFO - Output:
170+
2023-12-04 18:00:37,189 - INFO - Output:
171171
2023-12-04 18:01:13,342 - INFO - Environment: dc1
172172
2023-12-04 18:01:13,343 - INFO - Environment properties: {'properties': {'domain': 'https://example.com/dc1'}}
173173
2023-12-04 18:01:13,343 - INFO - Simulaton: informer
@@ -262,7 +262,7 @@ locationSearch=location.csv
262262
2023-12-04 19:25:28,806 - INFO - Simulaton: informer
263263
2023-12-04 19:25:28,806 - INFO - Simulation properties: {'command': 'java -version -Dtest.properties', 'properties': {'personSearch': 'person.csv', 'vehicleSearch': 'vehicle.csv', 'locationSearch': 'location.csv'}}
264264
2023-12-04 19:25:28,806 - INFO - Building test.properties file
265-
2023-12-04 19:25:28,806 - INFO -
265+
2023-12-04 19:25:28,806 - INFO -
266266
# TEST PROPERTIES. ENV dc1, SIM informer
267267
domain=https://example.com/dc1
268268
admin_user=auto.admin
@@ -278,7 +278,7 @@ locationSearch=location.csv
278278
2023-12-04 19:27:01,965 - INFO - Simulaton: informer
279279
2023-12-04 19:27:01,965 - INFO - Simulation properties: {'command': 'java -version -Dtest.properties', 'properties': {'personSearch': 'person.csv', 'vehicleSearch': 'vehicle.csv', 'locationSearch': 'location.csv'}}
280280
2023-12-04 19:27:01,965 - INFO - Building test.properties file
281-
2023-12-04 19:27:01,965 - INFO -
281+
2023-12-04 19:27:01,965 - INFO -
282282
# TEST PROPERTIES. ENV dc1, SIM informer
283283
domain=https://example.com/dc1
284284
admin_user=auto.admin
@@ -294,7 +294,7 @@ locationSearch=location.csv
294294
2023-12-04 19:30:58,735 - INFO - Simulaton: informer
295295
2023-12-04 19:30:58,736 - INFO - Simulation properties: {'command': 'java -version -Dtest.properties', 'properties': {'personSearch': 'person.csv', 'vehicleSearch': 'vehicle.csv', 'locationSearch': 'location.csv'}}
296296
2023-12-04 19:30:58,736 - INFO - Building test.properties file
297-
2023-12-04 19:30:58,737 - INFO -
297+
2023-12-04 19:30:58,737 - INFO -
298298
# TEST PROPERTIES. ENV dc1, SIM informer
299299
domain=https://example.com/dc1
300300
admin_user=auto.admin
@@ -311,7 +311,7 @@ locationSearch=location.csv
311311
2023-12-04 19:31:23,975 - INFO - Simulation properties: {'command': 'java -version -Dtest.properties', 'properties': {'personSearch': 'person.csv', 'vehicleSearch': 'vehicle.csv', 'locationSearch': 'location.csv'}}
312312
2023-12-04 19:31:23,975 - INFO - Building test.properties file
313313
2023-12-04 19:31:23,976 - INFO - Substituting in environment variable for $ADMIN_PASSWORD
314-
2023-12-04 19:31:23,976 - INFO -
314+
2023-12-04 19:31:23,976 - INFO -
315315
# TEST PROPERTIES. ENV dc1, SIM informer
316316
domain=https://example.com/dc1
317317
admin_user=auto.admin
@@ -328,7 +328,7 @@ locationSearch=location.csv
328328
2023-12-04 19:32:09,952 - INFO - Simulation properties: {'command': 'java -version -Dtest.properties', 'properties': {'personSearch': 'person.csv', 'vehicleSearch': 'vehicle.csv', 'locationSearch': 'location.csv'}}
329329
2023-12-04 19:32:09,952 - INFO - Building test.properties file
330330
2023-12-04 19:32:09,952 - INFO - Substituting in environment variable for $ADMIN_PASSWORD
331-
2023-12-04 19:32:09,952 - INFO -
331+
2023-12-04 19:32:09,952 - INFO -
332332
# TEST PROPERTIES. ENV dc1, SIM informer
333333
domain=https://example.com/dc1
334334
admin_user=auto.admin
@@ -345,7 +345,7 @@ locationSearch=location.csv
345345
2023-12-04 19:41:58,535 - INFO - Simulation properties: {'command': 'java -version -Dtest.properties', 'properties': {'personSearch': 'person.csv', 'vehicleSearch': 'vehicle.csv', 'locationSearch': 'location.csv'}}
346346
2023-12-04 19:41:58,535 - INFO - Building test.properties file
347347
2023-12-04 19:41:58,535 - INFO - Substituting in environment variable for $ADMIN_PASSWORD
348-
2023-12-04 19:41:58,536 - INFO -
348+
2023-12-04 19:41:58,536 - INFO -
349349
# TEST PROPERTIES. ENV dc1, SIM informer
350350
domain=https://example.com/dc1
351351
admin_user=auto.admin
@@ -362,7 +362,7 @@ locationSearch=location.csv
362362
2023-12-04 19:42:13,908 - INFO - Simulation properties: {'command': 'java -version -Dtest.properties', 'properties': {'personSearch': 'person.csv', 'vehicleSearch': 'vehicle.csv', 'locationSearch': 'location.csv'}}
363363
2023-12-04 19:42:13,908 - INFO - Building test.properties file
364364
2023-12-04 19:42:13,908 - INFO - Substituting in environment variable for $ADMIN_PASSWORD
365-
2023-12-04 19:42:13,908 - INFO -
365+
2023-12-04 19:42:13,908 - INFO -
366366
# TEST PROPERTIES. ENV dc1, SIM informer
367367
domain=https://example.com/dc1
368368
admin_user=auto.admin
@@ -379,7 +379,7 @@ locationSearch=location.csv
379379
2023-12-04 19:42:55,868 - INFO - Simulation properties: {'command': 'java -version -Dtest.properties', 'properties': {'personSearch': 'person.csv', 'vehicleSearch': 'vehicle.csv', 'locationSearch': 'location.csv'}}
380380
2023-12-04 19:42:55,868 - INFO - Building test.properties file
381381
2023-12-04 19:42:55,868 - INFO - Substituting in environment variable for $ADMIN_PASSWORD
382-
2023-12-04 19:42:55,869 - INFO -
382+
2023-12-04 19:42:55,869 - INFO -
383383
# TEST PROPERTIES. ENV dc1, SIM informer
384384
domain=https://example.com/dc1
385385
admin_user=auto.admin
@@ -397,7 +397,7 @@ locationSearch=location.csv
397397
2023-12-04 19:43:04,228 - INFO - Building test.properties file
398398
2023-12-04 19:43:04,228 - INFO - Substituting in environment variable for $ADMIN_PASSWORD
399399
2023-12-04 19:43:04,228 - WARNING - Environment variable None is None
400-
2023-12-04 19:43:04,229 - INFO -
400+
2023-12-04 19:43:04,229 - INFO -
401401
# TEST PROPERTIES. ENV dc1, SIM informer
402402
domain=https://example.com/dc1
403403
admin_user=auto.admin

requirements.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
requests
2-
pre-commit
31
black
2+
pre-commit
3+
requests
44
ruff

run_simulation.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import os
1818
import subprocess
1919
import sys
20+
2021
import yaml
2122

2223

@@ -25,7 +26,7 @@ def print_usage(parser):
2526
logging.error("Please provide the 'env' and 'sim' arguments.")
2627

2728

28-
def check_file_exists(file_path):
29+
def check_file_exists(file_path: str):
2930
"""check file actually exists"""
3031
if not os.path.isfile(file_path):
3132
logging.error(f"File not found: {file_path}")

0 commit comments

Comments
 (0)