yapf icon indicating copy to clipboard operation
yapf copied to clipboard

YAPF: disable not respected

Open dbogatov opened this issue 4 years ago • 5 comments

Related to https://github.com/google/yapf/issues/146

	for index, record in data.iterrows():
		# yapf: disable
		cursor.execute(
			insert,
			(
				record["Employee Name"],
				record["Job Title"],
				float(record["Base Pay"]),
				float(record["Overtime Pay"]),
				float(record["Other Pay"]),
				0.0 if record["Benefits"] == "Not Provided" else float(record["Benefits"]),
				float(record["Total Pay"]),
				float(record["Total Pay & Benefits"]),
				int(record["Year"]),
				"" if math.isnan(record["Notes"]) else record["Notes"],
				record["Agency"],
				"" if math.isnan(record["Status"]) else record["Status"]
			)
		)
		# yapf: enable

Gets formatted to

	for index, record in data.iterrows():
		# yapf: disable
		cursor.execute(
			insert,
			(
			record["Employee Name"],
			record["Job Title"],
			float(record["Base Pay"]),
			float(record["Overtime Pay"]),
			float(record["Other Pay"]),
			0.0 if record["Benefits"] == "Not Provided" else float(record["Benefits"]),
			float(record["Total Pay"]),
			float(record["Total Pay & Benefits"]),
			int(record["Year"]),
			"" if math.isnan(record["Notes"]) else record["Notes"],
			record["Agency"],
			"" if math.isnan(record["Status"]) else record["Status"]
			)
		)
		# yapf: enable

dbogatov avatar Mar 15 '20 21:03 dbogatov

Same issue here. This is a most basic feature not being addressed for almost a year now? Is this project still alive?

cellard0or avatar Jan 26 '21 15:01 cellard0or

Sorry, I didn't see this. It looks like something to do with tabs not being added correctly.

bwendling avatar Jan 26 '21 20:01 bwendling

Thanks for the quick reply! I do not have the capacity to address this personally right now, but if the issue is what you say it might be not too hard to fix. Thanks for looking into it!

cellard0or avatar Jan 27 '21 15:01 cellard0or

when using # yapf: disable inside visual studio code with yapf formatter activated, this settings is ignored for me too.

LaurentOngaro avatar May 08 '21 10:05 LaurentOngaro

reproduced with version 0.920+dev.8e82171a3e68a5180fab267cad4d2b7cfa1f5cd

sitnarf avatar Oct 13 '21 22:10 sitnarf