Skip to content

Commit 4bd47a8

Browse files
committed
chore: formatting, naming
1 parent 4ade074 commit 4bd47a8

File tree

7 files changed

+418
-340
lines changed

7 files changed

+418
-340
lines changed

.github/workflows/ci.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
- name: Set up Python
1818
uses: actions/setup-python@v4
1919
with:
20-
python-version: '3.10'
20+
python-version: "3.10"
2121

2222
- name: Download Semgrep rules
2323
run: git clone --depth 1 https://github.com/frappe/semgrep-rules.git frappe-semgrep-rules

.pre-commit-config.yaml

+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
exclude: 'node_modules|.git'
2+
default_stages: [commit]
3+
fail_fast: false
4+
5+
repos:
6+
- repo: https://github.com/pre-commit/pre-commit-hooks
7+
rev: v4.3.0
8+
hooks:
9+
- id: trailing-whitespace
10+
files: 'order_fulfillment.*'
11+
exclude: '.*json$|.*txt$|.*csv|.*md|.*svg'
12+
- id: check-yaml
13+
- id: no-commit-to-branch
14+
args: ['--branch', 'develop']
15+
- id: check-merge-conflict
16+
- id: check-ast
17+
- id: check-json
18+
- id: check-toml
19+
- id: check-yaml
20+
- id: debug-statements
21+
22+
- repo: https://github.com/asottile/pyupgrade
23+
rev: v2.34.0
24+
hooks:
25+
- id: pyupgrade
26+
args: ['--py38-plus']
27+
28+
- repo: https://github.com/frappe/black
29+
rev: 951ccf4d5bb0d692b457a5ebc4215d755618eb68
30+
hooks:
31+
- id: black
32+
33+
- repo: local
34+
hooks:
35+
- id: prettier
36+
name: prettier
37+
entry: npx prettier . --write --ignore-path .prettierignore
38+
language: node
39+
40+
#- repo: https://github.com/PyCQA/isort
41+
# rev: 5.12.0
42+
# hooks:
43+
# - id: isort
44+
45+
- repo: https://github.com/PyCQA/flake8
46+
rev: 5.0.4
47+
hooks:
48+
- id: flake8
49+
additional_dependencies: ['flake8-bugbear']
50+
51+
- repo: https://github.com/agritheory/test_utils
52+
rev: v0.16.0
53+
hooks:
54+
- id: update_pre_commit_config
55+
#- id: clean_customized_doctypes
56+
# args: ['--app', 'order_fulfillment']
57+
#- id: validate_customizations
58+
- id: validate_python_dependencies
59+
- id: validate_javascript_dependencies
60+
61+
ci:
62+
autoupdate_schedule: weekly
63+
skip: []
64+
submodules: false

.prettierrc.js

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
module.exports = {
2+
arrowParens: 'avoid',
3+
bracketSameLine: true,
4+
bracketSpacing: true,
5+
embeddedLanguageFormatting: 'auto',
6+
htmlWhitespaceSensitivity: 'css',
7+
insertPragma: false,
8+
jsxSingleQuote: false,
9+
printWidth: 120,
10+
proseWrap: 'preserve',
11+
quoteProps: 'as-needed',
12+
requirePragma: false,
13+
semi: false,
14+
singleQuote: true,
15+
tabWidth: 2,
16+
trailingComma: 'es5',
17+
useTabs: true,
18+
vueIndentScriptAndStyle: false,
19+
}

README.md

-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ $ brew install graphviz
3434

3535
![erd](https://user-images.githubusercontent.com/59503001/231471200-7717c3d4-75f5-45b2-8c2c-84d07ddd865b.png)
3636

37-
3837
2. Output of `get_whitelist_methods_in_app`
3938

4039
<img width="1440" alt="image" src="https://user-images.githubusercontent.com/59503001/231189481-3d0a39b9-3cf4-49e1-a456-706ff700138f.png">
Original file line numberDiff line numberDiff line change
@@ -1,88 +1,88 @@
11
{
2-
"actions": [],
3-
"allow_rename": 1,
4-
"autoname": "naming_series:",
5-
"creation": "2024-09-27 17:43:16.163405",
6-
"doctype": "DocType",
7-
"engine": "InnoDB",
8-
"field_order": [
9-
"doctypes",
10-
"doctype_substrings",
11-
"column_break_aada",
12-
"doctype_matches",
13-
"section_break_riee",
14-
"erd",
15-
"image",
16-
"naming_series"
17-
],
18-
"fields": [
19-
{
20-
"fieldname": "doctypes",
21-
"fieldtype": "Small Text",
22-
"label": "DocTypes"
23-
},
24-
{
25-
"fieldname": "doctype_substrings",
26-
"fieldtype": "Small Text",
27-
"label": "DocType Substrings"
28-
},
29-
{
30-
"fieldname": "column_break_aada",
31-
"fieldtype": "Column Break"
32-
},
33-
{
34-
"fieldname": "doctype_matches",
35-
"fieldtype": "Small Text",
36-
"label": "Doctype Matches",
37-
"read_only": 1
38-
},
39-
{
40-
"fieldname": "section_break_riee",
41-
"fieldtype": "Section Break"
42-
},
43-
{
44-
"fieldname": "erd",
45-
"fieldtype": "Image",
46-
"label": "ERD",
47-
"options": "image"
48-
},
49-
{
50-
"fieldname": "image",
51-
"fieldtype": "Attach Image",
52-
"hidden": 1,
53-
"label": "Image"
54-
},
55-
{
56-
"default": "ERD.YY.MM.DD.###",
57-
"fieldname": "naming_series",
58-
"fieldtype": "Read Only",
59-
"hidden": 1,
60-
"label": "Naming Series"
61-
}
62-
],
63-
"index_web_pages_for_search": 1,
64-
"links": [],
65-
"modified": "2024-09-28 09:11:12.364611",
66-
"modified_by": "Administrator",
67-
"module": "Frappe Er Generator",
68-
"name": "ERD",
69-
"naming_rule": "By \"Naming Series\" field",
70-
"owner": "Administrator",
71-
"permissions": [
72-
{
73-
"create": 1,
74-
"delete": 1,
75-
"email": 1,
76-
"export": 1,
77-
"print": 1,
78-
"read": 1,
79-
"report": 1,
80-
"role": "System Manager",
81-
"share": 1,
82-
"write": 1
83-
}
84-
],
85-
"sort_field": "modified",
86-
"sort_order": "DESC",
87-
"states": []
88-
}
2+
"actions": [],
3+
"allow_rename": 1,
4+
"autoname": "naming_series:",
5+
"creation": "2024-09-27 17:43:16.163405",
6+
"doctype": "DocType",
7+
"engine": "InnoDB",
8+
"field_order": [
9+
"doctypes",
10+
"doctype_substrings",
11+
"column_break_aada",
12+
"doctype_matches",
13+
"section_break_riee",
14+
"erd",
15+
"image",
16+
"naming_series"
17+
],
18+
"fields": [
19+
{
20+
"fieldname": "doctypes",
21+
"fieldtype": "Small Text",
22+
"label": "DocTypes"
23+
},
24+
{
25+
"fieldname": "doctype_substrings",
26+
"fieldtype": "Small Text",
27+
"label": "DocType Substrings"
28+
},
29+
{
30+
"fieldname": "column_break_aada",
31+
"fieldtype": "Column Break"
32+
},
33+
{
34+
"fieldname": "doctype_matches",
35+
"fieldtype": "Small Text",
36+
"label": "Doctype Matches",
37+
"read_only": 1
38+
},
39+
{
40+
"fieldname": "section_break_riee",
41+
"fieldtype": "Section Break"
42+
},
43+
{
44+
"fieldname": "erd",
45+
"fieldtype": "Image",
46+
"label": "ERD",
47+
"options": "image"
48+
},
49+
{
50+
"fieldname": "image",
51+
"fieldtype": "Attach Image",
52+
"hidden": 1,
53+
"label": "Image"
54+
},
55+
{
56+
"default": "ERD.YY.MM.DD.###",
57+
"fieldname": "naming_series",
58+
"fieldtype": "Read Only",
59+
"hidden": 1,
60+
"label": "Naming Series"
61+
}
62+
],
63+
"index_web_pages_for_search": 1,
64+
"links": [],
65+
"modified": "2024-09-28 09:11:12.364611",
66+
"modified_by": "Administrator",
67+
"module": "Frappe Er Generator",
68+
"name": "ERD",
69+
"naming_rule": "By \"Naming Series\" field",
70+
"owner": "Administrator",
71+
"permissions": [
72+
{
73+
"create": 1,
74+
"delete": 1,
75+
"email": 1,
76+
"export": 1,
77+
"print": 1,
78+
"read": 1,
79+
"report": 1,
80+
"role": "System Manager",
81+
"share": 1,
82+
"write": 1
83+
}
84+
],
85+
"sort_field": "modified",
86+
"sort_order": "DESC",
87+
"states": []
88+
}

frappe_er_generator/frappe_er_generator/doctype/erd/erd.py

+24-24
Original file line numberDiff line numberDiff line change
@@ -7,29 +7,29 @@
77

88

99
class ERD(Document):
10-
def validate(self):
11-
self.validate_directory()
12-
if self.doctypes:
13-
doctypes = (
14-
list(map(str.strip, self.doctypes.split(",")))
15-
if "," in self.doctypes
16-
else [self.doctypes.strip()]
17-
)
18-
else:
19-
doctypes = None
20-
if self.doctype_substrings:
21-
str_in = (
22-
list(map(str.strip, self.doctype_substrings.split(",")))
23-
if "," in self.doctype_substrings
24-
else [self.doctype_substrings.strip()]
25-
)
26-
else:
27-
str_in = None
10+
def validate(self):
11+
self.validate_directory()
12+
if self.doctypes:
13+
doctypes = (
14+
list(map(str.strip, self.doctypes.split(",")))
15+
if "," in self.doctypes
16+
else [self.doctypes.strip()]
17+
)
18+
else:
19+
doctypes = None
20+
if self.doctype_substrings:
21+
str_in = (
22+
list(map(str.strip, self.doctype_substrings.split(",")))
23+
if "," in self.doctype_substrings
24+
else [self.doctype_substrings.strip()]
25+
)
26+
else:
27+
str_in = None
2828

29-
file, matches = get_erd(doctypes=doctypes, str_in=str_in, site=True)
30-
self.doctype_matches = str(("\n").join(matches))
31-
self.image = file.file_url
29+
file, matches = get_erd(doctypes=doctypes, str_in=str_in, site=True)
30+
self.doctype_matches = str(("\n").join(matches))
31+
self.image = file.file_url
3232

33-
def validate_directory(self):
34-
if not frappe.db.exists("File", {"is_folder": 1, "name": "Home/ERD"}):
35-
frappe.new_doc("File", file_name="ERD", is_folder=1).insert()
33+
def validate_directory(self):
34+
if not frappe.db.exists("File", {"is_folder": 1, "name": "Home/ERD"}):
35+
frappe.new_doc("File", file_name="ERD", is_folder=1).insert()

0 commit comments

Comments
 (0)