peterjc / flake8-black

flake8 plugin to run black for checking Python coding style
MIT License
165 stars 10 forks source link

flake8-black error 'BLK100 Black would make changes' when formatted with Black --line-length=120 #65

Closed jfo1925 closed 5 months ago

jfo1925 commented 2 years ago

Hello, Getting error 'BLK100 Black would make changes' while running flake8-black after formatting the code with black src --line-length=120.

Example: Code after black src --line-length=120 (getting BLK100 error from flake8-black) target_df_add_guid = df_writable.transform(self._addGuid_id).drop("IVV_ATV_GUID_NO_BKEY")

Code with default black line line length which is 88, flake8-black does not complain for below code. target_df_add_guid = df_writable.transform(self._addGuid_id).drop( "IVV_ATV_GUID_NO_BKEY" )

Please advise how can we proceed with black formatting with line-length as 120 and flake8 doesn't complain about it?

peterjc commented 2 years ago

If you want to use line length 120 with black and flake8-black, put this in your black configuration file.

You should also update the flake8 line length or ignore E501.

jfo1925 commented 2 years ago

I have used black src --line-length=120 and also updated .flake8 file with below content [flake8] max-line-length = 120 that means both black and flake8-black are referring to same length but flake8 throws some BLK100 errors

peterjc commented 2 years ago

OK, so you've configured flake8 via your .flake8 file to use 120 as the line length, that will stop E501 errors about long lines.

You still seem to be running black at the command line with argument --line-length=120, but in order to tell the flake8-black plugin to use line length 120, this has to go in the black settings within your pyproject.toml configuration file.