Skip to content

Commit 34d5393

Browse files
author
tobaman
committed
feat: Initialize App
0 parents  commit 34d5393

File tree

18 files changed

+763
-0
lines changed

18 files changed

+763
-0
lines changed

.editorconfig

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Root editor config file
2+
root = true
3+
4+
# Common settings
5+
[*]
6+
end_of_line = lf
7+
insert_final_newline = true
8+
trim_trailing_whitespace = true
9+
charset = utf-8
10+
11+
# python, js indentation settings
12+
[{*.py,*.js,*.vue,*.css,*.scss,*.html}]
13+
indent_style = tab
14+
indent_size = 4
15+
max_line_length = 99
16+
17+
# JSON files - mostly doctype schema files
18+
[{*.json}]
19+
insert_final_newline = false
20+
indent_style = space
21+
indent_size = 2

.eslintrc

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
{
2+
"env": {
3+
"browser": true,
4+
"node": true,
5+
"es2022": true
6+
},
7+
"parserOptions": {
8+
"sourceType": "module"
9+
},
10+
"extends": "eslint:recommended",
11+
"rules": {
12+
"indent": "off",
13+
"brace-style": "off",
14+
"no-mixed-spaces-and-tabs": "off",
15+
"no-useless-escape": "off",
16+
"space-unary-ops": ["error", { "words": true }],
17+
"linebreak-style": "off",
18+
"quotes": ["off"],
19+
"semi": "off",
20+
"camelcase": "off",
21+
"no-unused-vars": "off",
22+
"no-console": ["warn"],
23+
"no-extra-boolean-cast": ["off"],
24+
"no-control-regex": ["off"],
25+
},
26+
"root": true,
27+
"globals": {
28+
"frappe": true,
29+
"Vue": true,
30+
"SetVueGlobals": true,
31+
"__": true,
32+
"repl": true,
33+
"Class": true,
34+
"locals": true,
35+
"cint": true,
36+
"cstr": true,
37+
"cur_frm": true,
38+
"cur_dialog": true,
39+
"cur_page": true,
40+
"cur_list": true,
41+
"cur_tree": true,
42+
"msg_dialog": true,
43+
"is_null": true,
44+
"in_list": true,
45+
"has_common": true,
46+
"posthog": true,
47+
"has_words": true,
48+
"validate_email": true,
49+
"open_web_template_values_editor": true,
50+
"validate_name": true,
51+
"validate_phone": true,
52+
"validate_url": true,
53+
"get_number_format": true,
54+
"format_number": true,
55+
"format_currency": true,
56+
"comment_when": true,
57+
"open_url_post": true,
58+
"toTitle": true,
59+
"lstrip": true,
60+
"rstrip": true,
61+
"strip": true,
62+
"strip_html": true,
63+
"replace_all": true,
64+
"flt": true,
65+
"precision": true,
66+
"CREATE": true,
67+
"AMEND": true,
68+
"CANCEL": true,
69+
"copy_dict": true,
70+
"get_number_format_info": true,
71+
"strip_number_groups": true,
72+
"print_table": true,
73+
"Layout": true,
74+
"web_form_settings": true,
75+
"$c": true,
76+
"$a": true,
77+
"$i": true,
78+
"$bg": true,
79+
"$y": true,
80+
"$c_obj": true,
81+
"refresh_many": true,
82+
"refresh_field": true,
83+
"toggle_field": true,
84+
"get_field_obj": true,
85+
"get_query_params": true,
86+
"unhide_field": true,
87+
"hide_field": true,
88+
"set_field_options": true,
89+
"getCookie": true,
90+
"getCookies": true,
91+
"get_url_arg": true,
92+
"md5": true,
93+
"$": true,
94+
"jQuery": true,
95+
"moment": true,
96+
"hljs": true,
97+
"Awesomplete": true,
98+
"Sortable": true,
99+
"Showdown": true,
100+
"Taggle": true,
101+
"Gantt": true,
102+
"Slick": true,
103+
"Webcam": true,
104+
"PhotoSwipe": true,
105+
"PhotoSwipeUI_Default": true,
106+
"io": true,
107+
"JsBarcode": true,
108+
"L": true,
109+
"Chart": true,
110+
"DataTable": true,
111+
"Cypress": true,
112+
"cy": true,
113+
"it": true,
114+
"describe": true,
115+
"expect": true,
116+
"context": true,
117+
"before": true,
118+
"beforeEach": true,
119+
"after": true,
120+
"qz": true,
121+
"localforage": true,
122+
"extend_cscript": true
123+
}
124+
}

.github/workflows/ci.yml

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
2+
name: CI
3+
4+
on:
5+
push:
6+
branches:
7+
- develop
8+
pull_request:
9+
10+
concurrency:
11+
group: develop-tcs_bugfix-${{ github.event.number }}
12+
cancel-in-progress: true
13+
14+
jobs:
15+
tests:
16+
runs-on: ubuntu-latest
17+
strategy:
18+
fail-fast: false
19+
name: Server
20+
21+
services:
22+
redis-cache:
23+
image: redis:alpine
24+
ports:
25+
- 13000:6379
26+
redis-queue:
27+
image: redis:alpine
28+
ports:
29+
- 11000:6379
30+
mariadb:
31+
image: mariadb:10.6
32+
env:
33+
MYSQL_ROOT_PASSWORD: root
34+
ports:
35+
- 3306:3306
36+
options: --health-cmd="mariadb-admin ping" --health-interval=5s --health-timeout=2s --health-retries=3
37+
38+
steps:
39+
- name: Clone
40+
uses: actions/checkout@v3
41+
42+
- name: Find tests
43+
run: |
44+
echo "Finding tests"
45+
grep -rn "def test" > /dev/null
46+
47+
- name: Setup Python
48+
uses: actions/setup-python@v4
49+
with:
50+
python-version: '3.10'
51+
52+
- name: Setup Node
53+
uses: actions/setup-node@v3
54+
with:
55+
node-version: 18
56+
check-latest: true
57+
58+
- name: Cache pip
59+
uses: actions/cache@v4
60+
with:
61+
path: ~/.cache/pip
62+
key: ${{ runner.os }}-pip-${{ hashFiles('**/*requirements.txt', '**/pyproject.toml', '**/setup.py', '**/setup.cfg') }}
63+
restore-keys: |
64+
${{ runner.os }}-pip-
65+
${{ runner.os }}-
66+
67+
- name: Get yarn cache directory path
68+
id: yarn-cache-dir-path
69+
run: 'echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT'
70+
71+
- uses: actions/cache@v4
72+
id: yarn-cache
73+
with:
74+
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
75+
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
76+
restore-keys: |
77+
${{ runner.os }}-yarn-
78+
79+
- name: Install MariaDB Client
80+
run: sudo apt-get install mariadb-client-10.6
81+
82+
- name: Setup
83+
run: |
84+
pip install frappe-bench
85+
bench init --skip-redis-config-generation --skip-assets --python "$(which python)" ~/frappe-bench
86+
mariadb --host 127.0.0.1 --port 3306 -u root -proot -e "SET GLOBAL character_set_server = 'utf8mb4'"
87+
mariadb --host 127.0.0.1 --port 3306 -u root -proot -e "SET GLOBAL collation_server = 'utf8mb4_unicode_ci'"
88+
89+
- name: Install
90+
working-directory: /home/runner/frappe-bench
91+
run: |
92+
bench get-app tcs_bugfix $GITHUB_WORKSPACE
93+
bench setup requirements --dev
94+
bench new-site --db-root-password root --admin-password admin test_site
95+
bench --site test_site install-app tcs_bugfix
96+
bench build
97+
env:
98+
CI: 'Yes'
99+
100+
- name: Run Tests
101+
working-directory: /home/runner/frappe-bench
102+
run: |
103+
bench --site test_site set-config allow_tests true
104+
bench --site test_site run-tests --app tcs_bugfix
105+
env:
106+
TYPE: server

.github/workflows/linter.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
2+
name: Linters
3+
4+
on:
5+
pull_request:
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: read
10+
11+
concurrency:
12+
group: ${{ github.workflow }}-${{ github.ref }}
13+
cancel-in-progress: true
14+
15+
jobs:
16+
linter:
17+
name: 'Frappe Linter'
18+
runs-on: ubuntu-latest
19+
if: github.event_name == 'pull_request'
20+
21+
steps:
22+
- uses: actions/checkout@v4
23+
- uses: actions/setup-python@v5
24+
with:
25+
python-version: '3.10'
26+
cache: pip
27+
- uses: pre-commit/action@v3.0.0
28+
29+
- name: Download Semgrep rules
30+
run: git clone --depth 1 https://github.com/frappe/semgrep-rules.git frappe-semgrep-rules
31+
32+
- name: Run Semgrep rules
33+
run: |
34+
pip install semgrep
35+
semgrep ci --config ./frappe-semgrep-rules/rules --config r/python.lang.correctness
36+
37+
deps-vulnerable-check:
38+
name: 'Vulnerable Dependency Check'
39+
runs-on: ubuntu-latest
40+
41+
steps:
42+
- uses: actions/setup-python@v5
43+
with:
44+
python-version: '3.10'
45+
46+
- uses: actions/checkout@v4
47+
48+
- name: Cache pip
49+
uses: actions/cache@v3
50+
with:
51+
path: ~/.cache/pip
52+
key: ${{ runner.os }}-pip-${{ hashFiles('**/*requirements.txt', '**/pyproject.toml', '**/setup.py') }}
53+
restore-keys: |
54+
${{ runner.os }}-pip-
55+
${{ runner.os }}-
56+
57+
- name: Install and run pip-audit
58+
run: |
59+
pip install pip-audit
60+
cd ${GITHUB_WORKSPACE}
61+
pip-audit --desc on .

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
.DS_Store
2+
*.pyc
3+
*.egg-info
4+
*.swp
5+
tags
6+
node_modules
7+
__pycache__

.pre-commit-config.yaml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
exclude: 'node_modules|.git'
2+
default_stages: [pre-commit]
3+
fail_fast: false
4+
5+
6+
repos:
7+
- repo: https://github.com/pre-commit/pre-commit-hooks
8+
rev: v5.0.0
9+
hooks:
10+
- id: trailing-whitespace
11+
files: "tcs_bugfix.*"
12+
exclude: ".*json$|.*txt$|.*csv|.*md|.*svg"
13+
- id: check-merge-conflict
14+
- id: check-ast
15+
- id: check-json
16+
- id: check-toml
17+
- id: check-yaml
18+
- id: debug-statements
19+
20+
- repo: https://github.com/astral-sh/ruff-pre-commit
21+
rev: v0.8.1
22+
hooks:
23+
- id: ruff
24+
name: "Run ruff import sorter"
25+
args: ["--select=I", "--fix"]
26+
27+
- id: ruff
28+
name: "Run ruff linter"
29+
30+
- id: ruff-format
31+
name: "Run ruff formatter"
32+
33+
- repo: https://github.com/pre-commit/mirrors-prettier
34+
rev: v2.7.1
35+
hooks:
36+
- id: prettier
37+
types_or: [javascript, vue, scss]
38+
# Ignore any files that might contain jinja / bundles
39+
exclude: |
40+
(?x)^(
41+
tcs_bugfix/public/dist/.*|
42+
.*node_modules.*|
43+
.*boilerplate.*|
44+
tcs_bugfix/templates/includes/.*|
45+
tcs_bugfix/public/js/lib/.*
46+
)$
47+
48+
49+
- repo: https://github.com/pre-commit/mirrors-eslint
50+
rev: v8.44.0
51+
hooks:
52+
- id: eslint
53+
types_or: [javascript]
54+
args: ['--quiet']
55+
# Ignore any files that might contain jinja / bundles
56+
exclude: |
57+
(?x)^(
58+
tcs_bugfix/public/dist/.*|
59+
cypress/.*|
60+
.*node_modules.*|
61+
.*boilerplate.*|
62+
tcs_bugfix/templates/includes/.*|
63+
tcs_bugfix/public/js/lib/.*
64+
)$
65+
66+
ci:
67+
autoupdate_schedule: weekly
68+
skip: []
69+
submodules: false

0 commit comments

Comments
 (0)