Skip to content

Commit 9275519

Browse files
authored
Merge pull request #1737 from frappe/version-14-hotfix
chore: release v14
2 parents 595c369 + 6d5c118 commit 9275519

File tree

286 files changed

+4271
-4241
lines changed

Some content is hidden

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

286 files changed

+4271
-4241
lines changed

.editorconfig

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
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+
# js indentation settings
12+
[{*.js,*.vue,*.css,*.scss,*.html}]
13+
indent_style = tab
14+
indent_size = 4
15+
max_line_length = 99

.flake8

-37
This file was deleted.

.git-blame-ignore-revs

+7-1
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,10 @@
1515
76c895a6c659356151433715a1efe9337e348c11
1616

1717
# bulk formatting
18-
b55d6e27af6bd274dfa47e66a3012ddec68ce798
18+
b55d6e27af6bd274dfa47e66a3012ddec68ce798
19+
20+
# js, scss prettier formatting
21+
4a224b988a254a053e9c49cd101cd67d433aed90
22+
23+
# python ruff formatting
24+
7b0d00220047545d3d18650235dac9cebe0d2bca

.github/helper/.flake8_strict

-73
This file was deleted.

.github/helper/documentation.py

+4-7
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,14 @@ def uri_validator(x):
77
result = urlparse(x)
88
return all([result.scheme, result.netloc, result.path])
99

10+
1011
def docs_link_exists(body):
1112
for line in body.splitlines():
1213
for word in line.split():
13-
if word.startswith('http') and uri_validator(word):
14+
if word.startswith("http") and uri_validator(word):
1415
parsed_url = urlparse(word)
1516
if parsed_url.netloc == "github.com":
16-
parts = parsed_url.path.split('/')
17+
parts = parsed_url.path.split("/")
1718
if len(parts) == 5 and parts[1] == "frappe" and parts[2] == "hrms":
1819
return True
1920
elif parsed_url.netloc == "frappehr.com":
@@ -30,11 +31,7 @@ def docs_link_exists(body):
3031
head_sha = (payload.get("head") or {}).get("sha")
3132
body = (payload.get("body") or "").lower()
3233

33-
if (title.startswith("feat")
34-
and head_sha
35-
and "no-docs" not in body
36-
and "backport" not in body
37-
):
34+
if title.startswith("feat") and head_sha and "no-docs" not in body and "backport" not in body:
3835
if docs_link_exists(body):
3936
print("Documentation Link Found. You're Awesome! 🎉")
4037

.github/helper/translation.py

+21-13
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,24 @@
22
import sys
33

44
errors_encounter = 0
5-
pattern = re.compile(r"_\(([\"']{,3})(?P<message>((?!\1).)*)\1(\s*,\s*context\s*=\s*([\"'])(?P<py_context>((?!\5).)*)\5)*(\s*,(\s*?.*?\n*?)*(,\s*([\"'])(?P<js_context>((?!\11).)*)\11)*)*\)")
5+
pattern = re.compile(
6+
r"_\(([\"']{,3})(?P<message>((?!\1).)*)\1(\s*,\s*context\s*=\s*([\"'])(?P<py_context>((?!\5).)*)\5)*(\s*,(\s*?.*?\n*?)*(,\s*([\"'])(?P<js_context>((?!\11).)*)\11)*)*\)"
7+
)
68
words_pattern = re.compile(r"_{1,2}\([\"'`]{1,3}.*?[a-zA-Z]")
79
start_pattern = re.compile(r"_{1,2}\([f\"'`]{1,3}")
810
f_string_pattern = re.compile(r"_\(f[\"']")
911
starts_with_f_pattern = re.compile(r"_\(f")
1012

1113
# skip first argument
1214
files = sys.argv[1:]
13-
files_to_scan = [_file for _file in files if _file.endswith(('.py', '.js'))]
15+
files_to_scan = [_file for _file in files if _file.endswith((".py", ".js"))]
1416

1517
for _file in files_to_scan:
16-
with open(_file, 'r') as f:
17-
print(f'Checking: {_file}')
18+
with open(_file, "r") as f:
19+
print(f"Checking: {_file}")
1820
file_lines = f.readlines()
1921
for line_number, line in enumerate(file_lines, 1):
20-
if 'frappe-lint: disable-translate' in line:
22+
if "frappe-lint: disable-translate" in line:
2123
continue
2224

2325
start_matches = start_pattern.search(line)
@@ -28,33 +30,39 @@
2830
has_f_string = f_string_pattern.search(line)
2931
if has_f_string:
3032
errors_encounter += 1
31-
print(f'\nF-strings are not supported for translations at line number {line_number}\n{line.strip()[:100]}')
33+
print(
34+
f"\nF-strings are not supported for translations at line number {line_number}\n{line.strip()[:100]}"
35+
)
3236
continue
3337
else:
3438
continue
3539

3640
match = pattern.search(line)
3741
error_found = False
3842

39-
if not match and line.endswith((',\n', '[\n')):
43+
if not match and line.endswith((",\n", "[\n")):
4044
# concat remaining text to validate multiline pattern
41-
line = "".join(file_lines[line_number - 1:])
42-
line = line[start_matches.start() + 1:]
45+
line = "".join(file_lines[line_number - 1 :])
46+
line = line[start_matches.start() + 1 :]
4347
match = pattern.match(line)
4448

4549
if not match:
4650
error_found = True
47-
print(f'\nTranslation syntax error at line number {line_number}\n{line.strip()[:100]}')
51+
print(f"\nTranslation syntax error at line number {line_number}\n{line.strip()[:100]}")
4852

4953
if not error_found and not words_pattern.search(line):
5054
error_found = True
51-
print(f'\nTranslation is useless because it has no words at line number {line_number}\n{line.strip()[:100]}')
55+
print(
56+
f"\nTranslation is useless because it has no words at line number {line_number}\n{line.strip()[:100]}"
57+
)
5258

5359
if error_found:
5460
errors_encounter += 1
5561

5662
if errors_encounter > 0:
57-
print('\nVisit "https://frappeframework.com/docs/user/en/translations" to learn about valid translation strings.')
63+
print(
64+
'\nVisit "https://frappeframework.com/docs/user/en/translations" to learn about valid translation strings.'
65+
)
5866
sys.exit(1)
5967
else:
60-
print('\nGood To Go!')
68+
print("\nGood To Go!")

.pre-commit-config.yaml

+22-17
Original file line numberDiff line numberDiff line change
@@ -16,27 +16,32 @@ repos:
1616
- id: check-merge-conflict
1717
- id: check-ast
1818

19-
- repo: https://github.com/PyCQA/flake8
20-
rev: 5.0.4
19+
- repo: https://github.com/pre-commit/mirrors-prettier
20+
rev: v3.1.0
2121
hooks:
22-
- id: flake8
23-
additional_dependencies: [
24-
'flake8-bugbear',
25-
]
26-
args: ['--config', '.github/helper/.flake8_strict']
27-
exclude: ".*setup.py$"
22+
- id: prettier
23+
types_or: [javascript, vue, css, scss]
24+
# Ignore any files that might contain jinja / bundles
25+
exclude: |
26+
(?x)^(
27+
hrms/public/dist/.*|
28+
.*node_modules.*|
29+
.*boilerplate.*|
30+
hrms/templates/includes/.*|
31+
hrms/hr/doctype/employee_promotion/employee_promotion.js|
32+
hrms/hr/doctype/employee_transfer/employee_transfer.js|
33+
hrms/payroll/doctype/salary_structure/salary_structure.js|
34+
)$
2835
29-
- repo: https://github.com/adityahase/black
30-
rev: 9cb0a69f4d0030cdf687eddf314468b39ed54119
36+
- repo: https://github.com/astral-sh/ruff-pre-commit
37+
rev: v0.3.7
3138
hooks:
32-
- id: black
33-
additional_dependencies: ['click==8.0.4']
39+
- id: ruff
40+
name: "Run ruff linter and apply fixes"
41+
args: ["--fix"]
3442

35-
- repo: https://github.com/PyCQA/isort
36-
rev: 5.12.0
37-
hooks:
38-
- id: isort
39-
exclude: ".*setup.py$"
43+
- id: ruff-format
44+
name: "Format Python code"
4045

4146
ci:
4247
autoupdate_schedule: weekly

commitlint.config.js

+18-18
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11
module.exports = {
2-
parserPreset: 'conventional-changelog-conventionalcommits',
2+
parserPreset: "conventional-changelog-conventionalcommits",
33
rules: {
4-
'subject-empty': [2, 'never'],
5-
'type-case': [2, 'always', 'lower-case'],
6-
'type-empty': [2, 'never'],
7-
'type-enum': [
4+
"subject-empty": [2, "never"],
5+
"type-case": [2, "always", "lower-case"],
6+
"type-empty": [2, "never"],
7+
"type-enum": [
88
2,
9-
'always',
9+
"always",
1010
[
11-
'build',
12-
'chore',
13-
'ci',
14-
'docs',
15-
'feat',
16-
'fix',
17-
'perf',
18-
'refactor',
19-
'revert',
20-
'style',
21-
'test',
22-
'patch',
11+
"build",
12+
"chore",
13+
"ci",
14+
"docs",
15+
"feat",
16+
"fix",
17+
"perf",
18+
"refactor",
19+
"revert",
20+
"style",
21+
"test",
22+
"patch",
2323
],
2424
],
2525
},

hrms/controllers/tests/test_employee_reminders.py

+3-7
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,7 @@ def setUpClass(cls):
3636
to_date=getdate() + timedelta(weeks=5),
3737
)
3838

39-
test_employee = frappe.get_doc(
40-
"Employee", make_employee("[email protected]", company="_Test Company")
41-
)
39+
test_employee = frappe.get_doc("Employee", make_employee("[email protected]", company="_Test Company"))
4240

4341
# Attach the holiday list to employee
4442
test_employee.holiday_list = test_holiday_list.name
@@ -102,9 +100,7 @@ def test_is_holiday(self):
102100
self.assertTrue("test holiday1" in descriptions)
103101

104102
def test_birthday_reminders(self):
105-
employee = frappe.get_doc(
106-
"Employee", frappe.db.sql_list("select name from tabEmployee limit 1")[0]
107-
)
103+
employee = frappe.get_doc("Employee", frappe.db.sql_list("select name from tabEmployee limit 1")[0])
108104
employee.date_of_birth = "1992" + frappe.utils.nowdate()[4:]
109105
employee.company_email = "[email protected]"
110106
employee.company = "_Test Company"
@@ -133,7 +129,7 @@ def test_work_anniversary_reminders(self):
133129
send_work_anniversary_reminders,
134130
)
135131

136-
emp = make_employee(
132+
make_employee(
137133
138134
company="_Test Company",
139135
date_of_joining=frappe.utils.add_years(getdate(), -2),

0 commit comments

Comments
 (0)