Skip to content

Commit 2ff40a0

Browse files
author
abrar2030
committed
Refactor code and enhance maintainability.
1 parent 41075c1 commit 2ff40a0

2 files changed

Lines changed: 67 additions & 67 deletions

File tree

‎.github/workflows/cicd.yml‎

Lines changed: 65 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1,82 +1,82 @@
11
name: CI Formatting Check
22

33
on:
4-
push:
5-
branches: [main, develop]
6-
pull_request:
7-
branches: [main, develop]
8-
workflow_dispatch:
4+
push:
5+
branches: [main, develop]
6+
pull_request:
7+
branches: [main, develop]
8+
workflow_dispatch:
99

1010
jobs:
11-
formatting_check:
12-
runs-on: ubuntu-latest
11+
formatting_check:
12+
runs-on: ubuntu-latest
1313

14-
env:
15-
BACKEND_DIR: backend # Python project
16-
FRONTEND_DIR: frontend # Node/JS project
14+
env:
15+
BACKEND_DIR: backend # Python project
16+
FRONTEND_DIR: frontend # Node/JS project
1717

18-
steps:
19-
# -------------------------------
20-
# Checkout
21-
# -------------------------------
22-
- name: Checkout Repository
23-
uses: actions/checkout@v4
18+
steps:
19+
# -------------------------------
20+
# Checkout
21+
# -------------------------------
22+
- name: Checkout Repository
23+
uses: actions/checkout@v4
2424

25-
# -------------------------------
26-
# Python Setup + Formatting
27-
# -------------------------------
28-
- name: Set up Python
29-
uses: actions/setup-python@v5
30-
with:
31-
python-version: '3.10'
25+
# -------------------------------
26+
# Python Setup + Formatting
27+
# -------------------------------
28+
- name: Set up Python
29+
uses: actions/setup-python@v5
30+
with:
31+
python-version: "3.10"
3232

33-
- name: Install Python Formatters
34-
run: |
35-
pip install autoflake isort black
33+
- name: Install Python Formatters
34+
run: |
35+
pip install autoflake isort black
3636
37-
- name: Run Python Formatting Checks
38-
working-directory: ${{ env.BACKEND_DIR }}
39-
run: |
40-
echo "=== Running autoflake (diff mode) ==="
41-
cp -r . /tmp/python_copy
37+
- name: Run Python Formatting Checks
38+
working-directory: ${{ env.BACKEND_DIR }}
39+
run: |
40+
echo "=== Running autoflake (diff mode) ==="
41+
cp -r . /tmp/python_copy
4242
43-
autoflake \
44-
--remove-all-unused-imports \
45-
--remove-unused-variables \
46-
--recursive \
47-
--ignore-init-module-imports \
48-
--in-place \
49-
/tmp/python_copy
43+
autoflake \
44+
--remove-all-unused-imports \
45+
--remove-unused-variables \
46+
--recursive \
47+
--ignore-init-module-imports \
48+
--in-place \
49+
/tmp/python_copy
5050
51-
echo "Comparing files..."
52-
diff -r . /tmp/python_copy > /dev/null || {
53-
echo "autoflake found issues."
54-
exit 1
55-
}
51+
echo "Comparing files..."
52+
diff -r . /tmp/python_copy > /dev/null || {
53+
echo "autoflake found issues."
54+
exit 1
55+
}
5656
57-
echo "=== Running black ==="
58-
black . --check
57+
echo "=== Running black ==="
58+
black . --check
5959
60-
# -------------------------------
61-
# Node + Prettier Setup
62-
# -------------------------------
63-
- name: Set up Node.js
64-
uses: actions/setup-node@v4
65-
with:
66-
node-version: '18'
60+
# -------------------------------
61+
# Node + Prettier Setup
62+
# -------------------------------
63+
- name: Set up Node.js
64+
uses: actions/setup-node@v4
65+
with:
66+
node-version: "18"
6767

68-
- name: Install Node Dependencies
69-
working-directory: ${{ env.FRONTEND_DIR }}
70-
run: npm install
68+
- name: Install Node Dependencies
69+
working-directory: ${{ env.FRONTEND_DIR }}
70+
run: npm install
7171

72-
- name: Run Prettier Checks
73-
working-directory: ${{ env.FRONTEND_DIR }}
74-
run: |
75-
echo "=== Running Prettier ==="
76-
npx prettier --check "**/*.{js,jsx,ts,tsx,json,html,css,md}"
72+
- name: Run Prettier Checks
73+
working-directory: ${{ env.FRONTEND_DIR }}
74+
run: |
75+
echo "=== Running Prettier ==="
76+
npx prettier --check "**/*.{js,jsx,ts,tsx,json,html,css,md}"
7777
78-
# -------------------------------
79-
# Done
80-
# -------------------------------
81-
- name: Finalize Check
82-
run: echo "All formatting checks completed successfully."
78+
# -------------------------------
79+
# Done
80+
# -------------------------------
81+
- name: Finalize Check
82+
run: echo "All formatting checks completed successfully."

‎.pre-commit-config.yaml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
repos:
22
- repo: https://github.com/pycqa/isort
3-
rev: 6.0.1 # valid / released version :contentReference[oaicite:0]{index=0}
3+
rev: 6.0.1 # valid / released version :contentReference[oaicite:0]{index=0}
44
hooks:
55
- id: isort
66
name: Sort imports
@@ -14,7 +14,7 @@ repos:
1414
language_version: python3
1515

1616
- repo: https://github.com/pycqa/flake8
17-
rev: 6.0.0 # or another valid tag / release
17+
rev: 6.0.0 # or another valid tag / release
1818
hooks:
1919
- id: flake8
2020
name: Check Python style with Flake8

0 commit comments

Comments
 (0)