Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sourcery refactored develop branch #1

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

sourcery-ai[bot]
Copy link

@sourcery-ai sourcery-ai bot commented Mar 22, 2023

Branch develop refactored by Sourcery.

If you're happy with these changes, merge this Pull Request using the Squash and merge strategy.

See our documentation here.

Run Sourcery locally

Reduce the feedback loop during development by using the Sourcery editor plugin:

Review changes via command line

To manually merge these changes, make sure you're on the develop branch, then run:

git fetch origin sourcery/develop
git merge --ff-only FETCH_HEAD
git reset HEAD^

Help us improve this pull request!

@sourcery-ai sourcery-ai bot requested a review from Leon0824 March 22, 2023 02:02
Copy link
Author

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Due to GitHub API limits, only the first 60 comments can be shown.

# if there is already an entry in this account then just add it
# to that entry
same_head = check_if_in_list(entry, merged_gl_map)
if same_head:
if same_head := check_if_in_list(entry, merged_gl_map):
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function merge_similar_entries refactored with the following changes:

This removes the following comments ( why? ):

# to that entry
# if there is already an entry in this account then just add it

Comment on lines -50 to +54
billing_address_field = "customer_address" if party_type == "Lead" \
else party_type.lower() + "_address"
billing_address_field = (
"customer_address"
if party_type == "Lead"
else f"{party_type.lower()}_address"
)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function set_address_details refactored with the following changes:

Comment on lines -85 to +89
if party.get("default_" + f):
out[f] = party.get("default_" + f)
if party.get(f"default_{f}"):
out[f] = party.get(f"default_{f}")
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function set_other_values refactored with the following changes:

Comment on lines -124 to -129
out = {
return {
party_type.lower(): party,
account_fieldname : account,
"due_date": get_due_date(posting_date, party, party_type, account, company)
account_fieldname: account,
"due_date": get_due_date(
posting_date, party, party_type, account, company
),
}
return out
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function set_account_and_due_date refactored with the following changes:

Comment on lines -166 to +172
if not frappe.db.exists("Account", (party.strip() + " - " + company_details.abbr)):
if not frappe.db.exists(
"Account", f"{party.strip()} - {company_details.abbr}"
):
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function create_party_account refactored with the following changes:

Comment on lines -16 to +20
condition = ""
if not self.include_reconciled_entries:
condition = "and ifnull(clearance_date, '') in ('', '0000-00-00')"


condition = (
""
if self.include_reconciled_entries
else "and ifnull(clearance_date, '') in ('', '0000-00-00')"
)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function BankReconciliation.get_details refactored with the following changes:

Comment on lines -14 to -19
idx =1
for m in month_list:
for idx, m in enumerate(month_list, start=1):
mnth = self.append('budget_distribution_details')
mnth.month = m
mnth.idx = idx
idx += 1
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function BudgetDistribution.get_months refactored with the following changes:

Comment on lines -22 to +23
total = sum([flt(d.percentage_allocation) for d in self.get("budget_distribution_details")])
total = sum(
flt(d.percentage_allocation)
for d in self.get("budget_distribution_details")
)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function BudgetDistribution.validate refactored with the following changes:

frappe.throw("C-form is not applicable for Invoice: %s" % d.invoice_no)
frappe.throw(f"C-form is not applicable for Invoice: {d.invoice_no}")
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function CForm.validate refactored with the following changes:

Comment on lines -45 to +49
inv = [d.invoice_no for d in self.get('invoice_details')]
if inv:
frappe.db.sql("""update `tabSales Invoice` set c_form_no=%s, modified=%s where name in (%s)""" %
('%s', '%s', ', '.join(['%s'] * len(inv))), tuple([self.name, self.modified] + inv))
if inv := [d.invoice_no for d in self.get('invoice_details')]:
frappe.db.sql(
f"""update `tabSales Invoice` set c_form_no=%s, modified=%s where name in ({', '.join(['%s'] * len(inv))})""",
tuple([self.name, self.modified] + inv),
)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function CForm.set_cform_in_sales_invoices refactored with the following changes:

Comment on lines -57 to +58
total = sum([flt(d.grand_total) for d in self.get('invoice_details')])
total = sum(flt(d.grand_total) for d in self.get('invoice_details'))
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function CForm.set_total_invoiced_amount refactored with the following changes:

Comment on lines -17 to +33

from erpnext.accounts.doctype.chart_of_accounts.charts.account_properties import account_properties

if chart:
accounts = []

def _import_accounts(children, parent):
for child in children:
account_name = child.get("name")
account_name_in_db = unidecode(account_name.strip().lower())

if account_name_in_db in accounts:
count = accounts.count(account_name_in_db)
account_name = account_name + " " + cstr(count)
account_name = f"{account_name} {cstr(count)}"

child.update(account_properties.get(chart.get("name"), {}).get(account_name, {}))

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function ChartofAccounts.create_accounts refactored with the following changes:

Comment on lines -56 to +61
default_types_root = []
for file in ["data_account_type.xml"]:
default_types_root.append(ET.parse(os.path.join(path, "account", "data",
"data_account_type.xml")).getroot())
default_types_root = [
ET.parse(
os.path.join(path, "account", "data", "data_account_type.xml")
).getroot()
for _ in ["data_account_type.xml"]
]
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function get_default_account_types refactored with the following changes:

Comment on lines -125 to +130
node_id = prefix + "." + node.get("id") if prefix else node.get("id")

node_id = f"{prefix}." + node.get("id") if prefix else node.get("id")
types[node_id] = data

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function get_account_types refactored with the following changes:

Comment on lines -15 to +17
self.name = self.cost_center_name.strip() + ' - ' + \
frappe.db.get_value("Company", self.company, "abbr")
self.name = f'{self.cost_center_name.strip()} - ' + frappe.db.get_value(
"Company", self.company, "abbr"
)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function CostCenter.autoname refactored with the following changes:

Comment on lines -13 to +21
import test_records as jv_test_records
import test_records as jv_test_records
from erpnext.selling.doctype.sales_order.test_sales_order \
import test_records as so_test_records
import test_records as so_test_records
from erpnext.buying.doctype.purchase_order.test_purchase_order \
import test_records as po_test_records
import test_records as po_test_records
from erpnext.accounts.doctype.sales_invoice.test_sales_invoice \
import test_records as si_test_records
import test_records as si_test_records
from erpnext.accounts.doctype.purchase_invoice.test_purchase_invoice \
import test_records as pi_test_records
import test_records as pi_test_records
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function TestPaymentTool.test_make_journal_voucher refactored with the following changes:

Comment on lines -18 to +22
res = frappe.db.sql("""select name, user from `tabPOS Setting`
if res := frappe.db.sql(
"""select name, user from `tabPOS Setting`
where ifnull(user, '') = %s and name != %s and company = %s""",
(self.user, self.name, self.company))
if res:
(self.user, self.name, self.company),
):
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function POSSetting.check_for_duplicate refactored with the following changes:

Comment on lines -54 to +59
if not include_current_pos:
condition = " where name != '%s'" % self.name.replace("'", "\'")
else:
condition = ""

condition = (
""
if include_current_pos
else " where name != '%s'" % self.name.replace("'", "\'")
)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function POSSetting.set_defaults refactored with the following changes:

Comment on lines -134 to +147
if not args.item_group:
frappe.throw(_("Item Group not mentioned in item master for item {0}").format(args.item_code))
if not args.item_group:
frappe.throw(_("Item Group not mentioned in item master for item {0}").format(args.item_code))

if args.customer and not (args.customer_group and args.territory):
customer = frappe.db.get_value("Customer", args.customer, ["customer_group", "territory"])
if customer:
if customer := frappe.db.get_value(
"Customer", args.customer, ["customer_group", "territory"]
):
args.customer_group, args.territory = customer

elif args.supplier and not args.supplier_type:
args.supplier_type = frappe.db.get_value("Supplier", args.supplier, "supplier_type")

pricing_rules = get_pricing_rules(args)
pricing_rule = filter_pricing_rules(args, pricing_rules)

if pricing_rule:
if pricing_rule := filter_pricing_rules(args, pricing_rules):
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function get_pricing_rule_for_item refactored with the following changes:

Comment on lines -172 to +191
condition = " ifnull("+field+", '') in ('" + \
"', '".join([d.replace("'", "\\'").replace('"', '\\"') for d in parent_groups])+"')"
condition = (
f" ifnull({field}, '') in ('"
+ "', '".join(
[d.replace("'", "\\'").replace('"', '\\"') for d in parent_groups]
)
) + "')"
return condition



conditions = ""
for field in ["company", "customer", "supplier", "supplier_type", "campaign", "sales_partner"]:
if args.get(field):
conditions += " and ifnull("+field+", '') in (%("+field+")s, '')"
conditions += f" and ifnull({field}, '') in (%({field})s, '')"
else:
conditions += " and ifnull("+field+", '') = ''"
conditions += f" and ifnull({field}, '') = ''"

for parenttype in ["Customer Group", "Territory"]:
group_condition = _get_tree_conditions(parenttype)
if group_condition:
conditions += " and " + group_condition
conditions += f" and {group_condition}"
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function get_pricing_rules refactored with the following changes:

Comment on lines -214 to +219
max_priority = max([cint(p.priority) for p in pricing_rules])
if max_priority:
if max_priority := max(cint(p.priority) for p in pricing_rules):
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function filter_pricing_rules refactored with the following changes:

Comment on lines -244 to +249
all_rules_same = True
val = [pricing_rules[0][k] for k in fields]
for p in pricing_rules[1:]:
if val != [p[k] for k in fields]:
all_rules_same = False
break

return all_rules_same
return all(val == [p[k] for k in fields] for p in pricing_rules[1:])
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function if_all_rules_same refactored with the following changes:

Comment on lines -87 to +91
if d.item_code: # extra condn coz item_code is not mandatory in PV
if frappe.db.get_value("Item", d.item_code, "is_purchase_item") != 'Yes':
msgprint(_("Item {0} is not Purchase Item").format(d.item_code), raise_exception=True)
if (
d.item_code
and frappe.db.get_value("Item", d.item_code, "is_purchase_item") != 'Yes'
):
msgprint(_("Item {0} is not Purchase Item").format(d.item_code), raise_exception=True)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function PurchaseInvoice.check_active_purchase_items refactored with the following changes:

This removes the following comments ( why? ):

# extra condn coz item_code is not mandatory in PV

Comment on lines -108 to +114
if (acc_head and cstr(acc_head[0][0]) != cstr(self.supplier)) or (not acc_head and (self.credit_to != cstr(self.supplier) + " - " + self.company_abbr)):
if (
(acc_head and cstr(acc_head[0][0]) != cstr(self.supplier))
or not acc_head
and self.credit_to != f"{cstr(self.supplier)} - {self.company_abbr}"
):
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function PurchaseInvoice.check_for_acc_head_of_supplier refactored with the following changes:

Comment on lines -116 to +131
if d.purchase_order and not d.purchase_order in check_list and not d.purchase_receipt:
if (
d.purchase_order
and d.purchase_order not in check_list
and not d.purchase_receipt
):
check_list.append(d.purchase_order)
stopped = frappe.db.sql("select name from `tabPurchase Order` where status = 'Stopped' and name = %s", d.purchase_order)
if stopped:
if stopped := frappe.db.sql(
"select name from `tabPurchase Order` where status = 'Stopped' and name = %s",
d.purchase_order,
):
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function PurchaseInvoice.check_for_stopped_status refactored with the following changes:

  • Simplify logical expression using De Morgan identities (de-morgan)
  • Use named expression to simplify assignment and conditional (use-named-expression)

Comment on lines -245 to +247
for period in period_list:
columns.append({
columns.extend(
{
"fieldname": period.key,
"label": period.label,
"fieldtype": "Currency",
"width": 150
})

"width": 150,
}
for period in period_list
)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function get_columns refactored with the following changes:

Comment on lines -15 to +24
account_map = dict(((r.name, r) for r in frappe.db.sql("""select acc.name,
account_map = {
r.name: r
for r in frappe.db.sql(
"""select acc.name,
supp.supplier_name, supp.name as supplier
from `tabAccount` acc, `tabSupplier` supp
where acc.master_type="Supplier" and supp.name=acc.master_name""", as_dict=1)))
where acc.master_type="Supplier" and supp.name=acc.master_name""",
as_dict=1,
)
}
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function execute refactored with the following changes:

Comment on lines -89 to +103
gl_entries = frappe.db.sql("""select * from `tabGL Entry`
where docstatus < 2 %s order by posting_date, account""" %
(conditions), tuple(supplier_accounts), as_dict=1)
return gl_entries
return frappe.db.sql(
"""select * from `tabGL Entry`
where docstatus < 2 %s order by posting_date, account"""
% (conditions),
tuple(supplier_accounts),
as_dict=1,
)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function get_gl_entries refactored with the following changes:

Comment on lines -98 to +109

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function get_conditions refactored with the following changes:

Comment on lines -121 to +140
account_supplier_type_map = {}
for each in frappe.db.sql("""select acc.name, supp.supplier_type from `tabSupplier` supp,
`tabAccount` acc where supp.name = acc.master_name group by acc.name"""):
account_supplier_type_map[each[0]] = each[1]

return account_supplier_type_map
return {
each[0]: each[1]
for each in frappe.db.sql(
"""select acc.name, supp.supplier_type from `tabSupplier` supp,
`tabAccount` acc where supp.name = acc.master_name group by acc.name"""
)
}
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function get_account_supplier_type_map refactored with the following changes:

@sourcery-ai
Copy link
Author

sourcery-ai bot commented Mar 22, 2023

Sourcery Code Quality Report

❌  Merging this PR will decrease code quality in the affected files by 0.04%.

Quality metrics Before After Change
Complexity 7.80 ⭐ 7.46 ⭐ -0.34 👍
Method Length 71.08 🙂 70.74 🙂 -0.34 👍
Working memory 7.31 🙂 7.42 🙂 0.11 👎
Quality 67.73% 🙂 67.69% 🙂 -0.04% 👎
Other metrics Before After Change
Lines 22860 23455 595
Changed files Quality Before Quality After Quality Change
erpnext/accounts/general_ledger.py 74.51% 🙂 74.15% 🙂 -0.36% 👎
erpnext/accounts/party.py 66.03% 🙂 65.97% 🙂 -0.06% 👎
erpnext/accounts/utils.py 68.22% 🙂 68.50% 🙂 0.28% 👍
erpnext/accounts/doctype/account/account.py 80.58% ⭐ 80.81% ⭐ 0.23% 👍
erpnext/accounts/doctype/account/test_account.py 62.46% 🙂 62.35% 🙂 -0.11% 👎
erpnext/accounts/doctype/accounts_settings/accounts_settings.py 68.18% 🙂 63.75% 🙂 -4.43% 👎
erpnext/accounts/doctype/bank_reconciliation/bank_reconciliation.py 67.49% 🙂 67.69% 🙂 0.20% 👍
erpnext/accounts/doctype/budget_distribution/budget_distribution.py 88.10% ⭐ 88.14% ⭐ 0.04% 👍
erpnext/accounts/doctype/c_form/c_form.py 80.60% ⭐ 78.83% ⭐ -1.77% 👎
erpnext/accounts/doctype/chart_of_accounts/chart_of_accounts.py 34.22% 😞 34.15% 😞 -0.07% 👎
erpnext/accounts/doctype/chart_of_accounts/charts/import_from_openerp.py 41.01% 😞 40.26% 😞 -0.75% 👎
erpnext/accounts/doctype/cost_center/cost_center.py 85.89% ⭐ 85.88% ⭐ -0.01% 👎
erpnext/accounts/doctype/fiscal_year/fiscal_year.py 74.72% 🙂 74.18% 🙂 -0.54% 👎
erpnext/accounts/doctype/gl_entry/gl_entry.py 72.92% 🙂 72.75% 🙂 -0.17% 👎
erpnext/accounts/doctype/journal_voucher/journal_voucher.py 60.83% 🙂 61.25% 🙂 0.42% 👍
erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.py 67.36% 🙂 67.42% 🙂 0.06% 👍
erpnext/accounts/doctype/payment_tool/test_payment_tool.py 63.27% 🙂 63.29% 🙂 0.02% 👍
erpnext/accounts/doctype/pos_setting/pos_setting.py 84.79% ⭐ 84.19% ⭐ -0.60% 👎
erpnext/accounts/doctype/pricing_rule/pricing_rule.py 57.81% 🙂 57.34% 🙂 -0.47% 👎
erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py 62.06% 🙂 62.50% 🙂 0.44% 👍
erpnext/accounts/doctype/sales_invoice/sales_invoice.py 72.02% 🙂 72.08% 🙂 0.06% 👍
erpnext/accounts/report/financial_statements.py 57.69% 🙂 58.22% 🙂 0.53% 👍
erpnext/accounts/report/accounts_payable/accounts_payable.py 53.16% 🙂 49.85% 😞 -3.31% 👎
erpnext/accounts/report/accounts_receivable/accounts_receivable.py 67.91% 🙂 69.00% 🙂 1.09% 👍
erpnext/accounts/report/bank_clearance_summary/bank_clearance_summary.py 90.28% ⭐ 90.66% ⭐ 0.38% 👍
erpnext/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.py 70.78% 🙂 70.05% 🙂 -0.73% 👎
erpnext/accounts/report/budget_variance_report/budget_variance_report.py 55.98% 🙂 56.69% 🙂 0.71% 👍
erpnext/accounts/report/customer_account_head/customer_account_head.py 82.17% ⭐ 82.05% ⭐ -0.12% 👎
erpnext/accounts/report/general_ledger/general_ledger.py 68.46% 🙂 67.31% 🙂 -1.15% 👎
erpnext/accounts/report/gross_profit/gross_profit.py 62.92% 🙂 62.12% 🙂 -0.80% 👎
erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.py 61.74% 🙂 59.78% 🙂 -1.96% 👎
erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py 60.77% 🙂 58.40% 🙂 -2.37% 👎
erpnext/accounts/report/payment_period_based_on_invoice_date/payment_period_based_on_invoice_date.py 59.75% 🙂 59.08% 🙂 -0.67% 👎
erpnext/accounts/report/purchase_register/purchase_register.py 59.48% 🙂 58.68% 🙂 -0.80% 👎
erpnext/accounts/report/sales_register/sales_register.py 61.56% 🙂 60.13% 🙂 -1.43% 👎
erpnext/accounts/report/supplier_account_head/supplier_account_head.py 82.17% ⭐ 82.05% ⭐ -0.12% 👎
erpnext/accounts/report/trial_balance/trial_balance.py 64.24% 🙂 64.19% 🙂 -0.05% 👎
erpnext/buying/doctype/purchase_common/purchase_common.py 40.37% 😞 39.29% 😞 -1.08% 👎
erpnext/buying/doctype/purchase_order/purchase_order.py 77.09% ⭐ 76.75% ⭐ -0.34% 👎
erpnext/buying/doctype/supplier/supplier.py 88.80% ⭐ 89.14% ⭐ 0.34% 👍
erpnext/controllers/accounts_controller.py 64.38% 🙂 64.82% 🙂 0.44% 👍
erpnext/controllers/buying_controller.py 58.05% 🙂 57.48% 🙂 -0.57% 👎
erpnext/controllers/queries.py 65.74% 🙂 67.08% 🙂 1.34% 👍
erpnext/controllers/recurring_document.py 64.60% 🙂 64.58% 🙂 -0.02% 👎
erpnext/controllers/selling_controller.py 67.21% 🙂 68.08% 🙂 0.87% 👍
erpnext/controllers/status_updater.py 58.36% 🙂 57.46% 🙂 -0.90% 👎
erpnext/controllers/stock_controller.py 60.71% 🙂 59.56% 🙂 -1.15% 👎
erpnext/controllers/trends.py 50.61% 🙂 50.39% 🙂 -0.22% 👎
erpnext/home/__init__.py 74.04% 🙂 74.01% 🙂 -0.03% 👎
erpnext/home/doctype/feed/feed.py 68.87% 🙂 70.99% 🙂 2.12% 👍
erpnext/hr/doctype/appraisal/appraisal.py 84.01% ⭐ 83.60% ⭐ -0.41% 👎
erpnext/hr/doctype/attendance/attendance.py 90.28% ⭐ 89.83% ⭐ -0.45% 👎
erpnext/hr/doctype/employee/employee.py 73.50% 🙂 73.60% 🙂 0.10% 👍
erpnext/hr/doctype/holiday_list/holiday_list.py 83.74% ⭐ 83.74% ⭐ 0.00%
erpnext/hr/doctype/job_applicant/get_job_applications.py 66.98% 🙂 66.90% 🙂 -0.08% 👎
erpnext/hr/doctype/leave_allocation/leave_allocation.py 88.55% ⭐ 88.50% ⭐ -0.05% 👎
erpnext/hr/doctype/leave_application/leave_application.py 75.32% ⭐ 75.39% ⭐ 0.07% 👍
erpnext/hr/doctype/leave_application/test_leave_application.py 84.86% ⭐ 84.88% ⭐ 0.02% 👍
erpnext/hr/doctype/leave_block_list/leave_block_list.py 68.20% 🙂 70.07% 🙂 1.87% 👍
erpnext/hr/doctype/leave_control_panel/leave_control_panel.py 67.01% 🙂 67.67% 🙂 0.66% 👍
erpnext/hr/doctype/salary_manager/salary_manager.py 79.88% ⭐ 78.85% ⭐ -1.03% 👎
erpnext/hr/doctype/salary_slip/salary_slip.py 74.95% 🙂 73.63% 🙂 -1.32% 👎
erpnext/hr/doctype/salary_structure/salary_structure.py 84.95% ⭐ 85.51% ⭐ 0.56% 👍
erpnext/hr/doctype/upload_attendance/upload_attendance.py 78.62% ⭐ 77.71% ⭐ -0.91% 👎
erpnext/hr/report/employee_birthday/employee_birthday.py 88.03% ⭐ 87.90% ⭐ -0.13% 👎
erpnext/hr/report/employee_leave_balance/employee_leave_balance.py 32.48% 😞 33.36% 😞 0.88% 👍
erpnext/hr/report/monthly_attendance_sheet/monthly_attendance_sheet.py 66.34% 🙂 65.56% 🙂 -0.78% 👎
erpnext/hr/report/monthly_salary_register/monthly_salary_register.py 70.93% 🙂 71.92% 🙂 0.99% 👍
erpnext/manufacturing/doctype/bom/bom.py 74.44% 🙂 74.16% 🙂 -0.28% 👎
erpnext/manufacturing/doctype/production_order/production_order.py 80.08% ⭐ 79.56% ⭐ -0.52% 👎
erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.py 70.18% 🙂 70.46% 🙂 0.28% 👍
erpnext/patches/repair_tools/fix_naming_series_records_lost_by_reload.py 70.99% 🙂 69.20% 🙂 -1.79% 👎
erpnext/patches/v4_0/fix_contact_address.py 84.94% ⭐ 79.91% ⭐ -5.03% 👎
erpnext/patches/v4_0/fix_employee_user_id.py 78.00% ⭐ 75.69% ⭐ -2.31% 👎
erpnext/patches/v4_0/map_charge_to_taxes_and_charges.py 91.91% ⭐ 91.26% ⭐ -0.65% 👎
erpnext/patches/v4_0/set_naming_series_property_setter.py 58.40% 🙂 58.99% 🙂 0.59% 👍
erpnext/patches/v4_0/split_email_settings.py 84.89% ⭐ 84.81% ⭐ -0.08% 👎
erpnext/patches/v4_0/update_custom_print_formats_for_renamed_fields.py 71.38% 🙂 71.38% 🙂 0.00%
erpnext/patches/v4_0/update_user_properties.py 85.82% ⭐ 84.73% ⭐ -1.09% 👎
erpnext/projects/utils.py 74.82% 🙂 74.71% 🙂 -0.11% 👎
erpnext/projects/doctype/project/project.py 85.06% ⭐ 84.80% ⭐ -0.26% 👎
erpnext/projects/doctype/task/task.py 76.84% ⭐ 76.65% ⭐ -0.19% 👎
erpnext/projects/doctype/time_log/time_log.py 82.31% ⭐ 81.58% ⭐ -0.73% 👎
erpnext/projects/report/daily_time_log_summary/daily_time_log_summary.py 62.30% 🙂 61.78% 🙂 -0.52% 👎
erpnext/projects/report/project_wise_stock_tracking/project_wise_stock_tracking.py 87.33% ⭐ 87.88% ⭐ 0.55% 👍
erpnext/selling/doctype/campaign/campaign.py 83.54% ⭐ 83.38% ⭐ -0.16% 👎
erpnext/selling/doctype/customer/customer.py 84.41% ⭐ 84.35% ⭐ -0.06% 👎
erpnext/selling/doctype/installation_note/installation_note.py 83.71% ⭐ 83.51% ⭐ -0.20% 👎
erpnext/selling/doctype/lead/lead.py 79.54% ⭐ 79.57% ⭐ 0.03% 👍
erpnext/selling/doctype/opportunity/opportunity.py 74.19% 🙂 73.98% 🙂 -0.21% 👎
erpnext/selling/doctype/quotation/quotation.py 72.63% 🙂 74.19% 🙂 1.56% 👍
erpnext/selling/doctype/sales_order/sales_order.py 72.30% 🙂 72.32% 🙂 0.02% 👍
erpnext/selling/doctype/sales_order/test_sales_order.py 72.36% 🙂 72.27% 🙂 -0.09% 👎
erpnext/selling/doctype/sms_center/sms_center.py 56.86% 🙂 58.89% 🙂 2.03% 👍
erpnext/selling/report/available_stock_for_packing_items/available_stock_for_packing_items.py 69.58% 🙂 69.72% 🙂 0.14% 👍
erpnext/selling/report/customer_acquisition_and_loyalty/customer_acquisition_and_loyalty.py 36.13% 😞 36.16% 😞 0.03% 👍
erpnext/selling/report/sales_person_target_variance_item_group_wise/sales_person_target_variance_item_group_wise.py 52.77% 🙂 52.98% 🙂 0.21% 👍
erpnext/selling/report/sales_person_wise_transaction_summary/sales_person_wise_transaction_summary.py 75.79% ⭐ 74.53% 🙂 -1.26% 👎
erpnext/selling/report/territory_target_variance_item_group_wise/territory_target_variance_item_group_wise.py 52.77% 🙂 52.98% 🙂 0.21% 👍
erpnext/setup/install.py 82.48% ⭐ 81.32% ⭐ -1.16% 👎
erpnext/setup/utils.py 87.08% ⭐ 87.06% ⭐ -0.02% 👎
erpnext/setup/doctype/authorization_control/authorization_control.py 37.81% 😞 36.82% 😞 -0.99% 👎
erpnext/setup/doctype/authorization_rule/authorization_rule.py 62.37% 🙂 62.70% 🙂 0.33% 👍
erpnext/setup/doctype/backup_manager/backup_dropbox.py 53.90% 🙂 56.39% 🙂 2.49% 👍
erpnext/setup/doctype/backup_manager/backup_googledrive.py 79.56% ⭐ 79.44% ⭐ -0.12% 👎
erpnext/setup/doctype/company/company.py 76.79% ⭐ 76.46% ⭐ -0.33% 👎
erpnext/setup/doctype/company/fixtures/india/__init__.py 46.45% 😞 46.45% 😞 0.00%
erpnext/setup/doctype/currency_exchange/currency_exchange.py 91.17% ⭐ 91.11% ⭐ -0.06% 👎
erpnext/setup/doctype/email_digest/email_digest.py 74.70% 🙂 75.07% ⭐ 0.37% 👍
erpnext/setup/doctype/global_defaults/global_defaults.py 76.44% ⭐ 74.49% 🙂 -1.95% 👎
erpnext/setup/doctype/item_group/item_group.py 89.50% ⭐ 89.52% ⭐ 0.02% 👍
erpnext/setup/doctype/naming_series/naming_series.py 72.45% 🙂 72.41% 🙂 -0.04% 👎
erpnext/setup/doctype/sales_partner/sales_partner.py 88.72% ⭐ 87.06% ⭐ -1.66% 👎
erpnext/setup/doctype/sales_person/sales_person.py 87.45% ⭐ 86.91% ⭐ -0.54% 👎
erpnext/setup/doctype/sms_settings/sms_settings.py 81.91% ⭐ 82.00% ⭐ 0.09% 👍
erpnext/setup/page/setup_wizard/default_website.py 84.44% ⭐ 84.41% ⭐ -0.03% 👎
erpnext/setup/page/setup_wizard/install_fixtures.py 56.42% 🙂 56.42% 🙂 0.00%
erpnext/setup/page/setup_wizard/setup_wizard.py 61.04% 🙂 60.65% 🙂 -0.39% 👎
erpnext/startup/event_handlers.py 76.20% ⭐ 76.04% ⭐ -0.16% 👎
erpnext/stock/get_item_details.py 66.26% 🙂 66.67% 🙂 0.41% 👍
erpnext/stock/stock_ledger.py 50.86% 🙂 53.24% 🙂 2.38% 👍
erpnext/stock/utils.py 59.25% 🙂 58.55% 🙂 -0.70% 👎
erpnext/stock/doctype/delivery_note/delivery_note.py 75.82% ⭐ 75.60% ⭐ -0.22% 👎
erpnext/stock/doctype/delivery_note/test_delivery_note.py 65.49% 🙂 66.84% 🙂 1.35% 👍
erpnext/stock/doctype/item/item.py 73.21% 🙂 73.75% 🙂 0.54% 👍
erpnext/stock/doctype/landed_cost_voucher/landed_cost_voucher.py 81.33% ⭐ 81.39% ⭐ 0.06% 👍
erpnext/stock/doctype/material_request/material_request.py 68.65% 🙂 69.81% 🙂 1.16% 👍
erpnext/stock/doctype/packed_item/packed_item.py 61.87% 🙂 61.74% 🙂 -0.13% 👎
erpnext/stock/doctype/packing_slip/packing_slip.py 80.38% ⭐ 79.81% ⭐ -0.57% 👎
erpnext/stock/doctype/price_list/price_list.py 83.94% ⭐ 83.78% ⭐ -0.16% 👎
erpnext/stock/doctype/purchase_receipt/purchase_receipt.py 61.87% 🙂 62.09% 🙂 0.22% 👍
erpnext/stock/doctype/serial_no/serial_no.py 61.59% 🙂 62.53% 🙂 0.94% 👍
erpnext/stock/doctype/stock_entry/stock_entry.py 55.55% 🙂 54.98% 🙂 -0.57% 👎
erpnext/stock/doctype/stock_ledger_entry/stock_ledger_entry.py 74.76% 🙂 74.63% 🙂 -0.13% 👎
erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py 56.08% 🙂 56.42% 🙂 0.34% 👍
erpnext/stock/doctype/warehouse/warehouse.py 71.75% 🙂 72.46% 🙂 0.71% 👍
erpnext/stock/report/batch_wise_balance_history/batch_wise_balance_history.py 70.73% 🙂 70.70% 🙂 -0.03% 👎
erpnext/stock/report/item_prices/item_prices.py 77.81% ⭐ 78.14% ⭐ 0.33% 👍
erpnext/stock/report/itemwise_recommended_reorder_level/itemwise_recommended_reorder_level.py 73.60% 🙂 72.55% 🙂 -1.05% 👎
erpnext/stock/report/stock_ageing/stock_ageing.py 69.18% 🙂 68.66% 🙂 -0.52% 👎
erpnext/stock/report/stock_balance/stock_balance.py 64.48% 🙂 64.12% 🙂 -0.36% 👎
erpnext/stock/report/stock_ledger/stock_ledger.py 82.71% ⭐ 81.54% ⭐ -1.17% 👎
erpnext/stock/report/stock_projected_qty/stock_projected_qty.py 88.53% ⭐ 86.81% ⭐ -1.72% 👎
erpnext/stock/report/supplier_wise_sales_analytics/supplier_wise_sales_analytics.py 60.78% 🙂 60.87% 🙂 0.09% 👍
erpnext/support/doctype/customer_issue/customer_issue.py 79.24% ⭐ 77.98% ⭐ -1.26% 👎
erpnext/support/doctype/maintenance_schedule/maintenance_schedule.py 68.28% 🙂 67.25% 🙂 -1.03% 👎
erpnext/support/doctype/maintenance_visit/maintenance_visit.py 64.03% 🙂 64.56% 🙂 0.53% 👍
erpnext/support/doctype/support_ticket/get_support_mails.py 69.35% 🙂 69.83% 🙂 0.48% 👍
erpnext/support/doctype/support_ticket/support_ticket.py 83.59% ⭐ 83.06% ⭐ -0.53% 👎
erpnext/templates/pages/product_search.py 73.04% 🙂 72.69% 🙂 -0.35% 👎
erpnext/utilities/repost_stock.py 77.15% ⭐ 78.37% ⭐ 1.22% 👍
erpnext/utilities/transaction_base.py 64.35% 🙂 65.12% 🙂 0.77% 👍
erpnext/utilities/doctype/address/address.py 80.56% ⭐ 80.26% ⭐ -0.30% 👎
erpnext/utilities/doctype/address_template/address_template.py 87.14% ⭐ 87.72% ⭐ 0.58% 👍
erpnext/utilities/doctype/contact/contact.py 71.83% 🙂 73.83% 🙂 2.00% 👍
erpnext/utilities/doctype/note/note.py 83.03% ⭐ 83.26% ⭐ 0.23% 👍

Here are some functions in these files that still need a tune-up:

File Function Complexity Length Working Memory Quality Recommendation
erpnext/stock/doctype/purchase_receipt/purchase_receipt.py PurchaseReceipt.get_gl_entries 43 ⛔ 518 ⛔ 18 ⛔ 10.65% ⛔ Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py PurchaseInvoice.make_gl_entries 44 ⛔ 490 ⛔ 16 ⛔ 12.39% ⛔ Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
erpnext/stock/doctype/stock_entry/stock_entry.py StockEntry.get_stock_and_rate 41 ⛔ 389 ⛔ 17 ⛔ 13.13% ⛔ Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
erpnext/buying/doctype/purchase_common/purchase_common.py PurchaseCommon.validate_for_items 44 ⛔ 406 ⛔ 15 😞 14.21% ⛔ Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
erpnext/stock/doctype/serial_no/serial_no.py validate_serial_no 43 ⛔ 307 ⛔ 16 ⛔ 15.35% ⛔ Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions

Legend and Explanation

The emojis denote the absolute quality of the code:

  • ⭐ excellent
  • 🙂 good
  • 😞 poor
  • ⛔ very poor

The 👍 and 👎 indicate whether the quality has improved or gotten worse with this pull request.


Please see our documentation here for details on how these metrics are calculated.

We are actively working on this report - lots more documentation and extra metrics to come!

Help us improve this quality report!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

0 participants