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

"Black would make changes" (flake8-black?) #1769

Closed
boegel opened this issue Jan 9, 2020 · 13 comments
Closed

"Black would make changes" (flake8-black?) #1769

boegel opened this issue Jan 9, 2020 · 13 comments

Comments

@boegel
Copy link

boegel commented Jan 9, 2020

@houndci-bot posted a puzzling comment in a recent PR in our (Python) repo: https://github.com/easybuilders/easybuild-framework/pull/3156/files#r364740161

It looks like this is coming from flake8-black, but the comment is pretty useless (that's putting it mildly).

Is there a way to make the comment more meaningful?
Is flake8-black now enabled by default in Hound CI? Can it be disabled?

@gylaz
Copy link
Member

gylaz commented Jan 9, 2020

Yes, we recently added flake8-black due to numerous requests, and unfortunately it is enabled by default. However, you can choose to ignore its "validation codes", like so...

Add a .flake8 file to your project if doesn't exist already and configure it to ignore the BLK codes:

[flake8]
ignore = BLK100

You can add other codes listed in https://pypi.org/project/flake8-black/ if you'd like.

Then you need to tell Hound about your Flake8 config by adding it to .hound.yml file:

flake8:
  enabled: true
  config_file: .flake8

as documented here http://help.houndci.com/en/articles/2138537-flake8

Hope this helps!

@boegel
Copy link
Author

boegel commented Jan 9, 2020

@gylaz Thanks for the info!

Do you know if there's a way to figure out what black would change, i.e. to make @houndci-bot report that?

@gylaz
Copy link
Member

gylaz commented Jan 9, 2020

I'm not sure if there's a way, but unfortunately, I don't have Python expertise and https://pypi.org/project/flake8-black/ is all I referenced for this issue.

@myfashionhub
Copy link

myfashionhub commented Jan 9, 2020

I end up just disabling it because it complains about a perfectly fine line of code

status_callback = config.get('services.relay.{}.callbackUrl'.format(provider_name), None)

It wants me to use double quotes?

@boegel
Copy link
Author

boegel commented Jan 14, 2020

Closing now since it's clear how to avoid that @houndci-bot posts these comments.

@boegel boegel closed this as completed Jan 14, 2020
@Flamefire
Copy link

Flamefire commented Jan 15, 2020

Black needs a separate config (see their docu) and most prominent issues are line length (doesn't pick up the flake8 param as it seems) and quote unification

@gylaz
Copy link
Member

gylaz commented Jan 16, 2020

@Flamefire It looks like at the time when Hound made that comment, your flake8 config did not ignore the Black rule yet: https://github.com/easybuilders/easybuild-easyblocks/blob/b08d137aeb2b02b4ddb9cd75beea0fa11bf6575c/setup.cfg

@Flamefire
Copy link

Flamefire commented Jan 16, 2020

I don't understand. The comment is from yesterday, easybuilders/easybuild-easyblocks#1923 which added the ignore was merged 2 days ago.

@boegel
Copy link
Author

boegel commented Jan 16, 2020

@Flamefire The branch used in easybuilders/easybuild-easyblocks#1901 was not synced with develop after easybuilders/easybuild-easyblocks#1923 was merged, Hound picks up the setup.cfg from the branch used for the PR (not the target branch).

@Flamefire
Copy link

Flamefire commented Jan 16, 2020

Ah ok, understood. Thanks!

@dliu-fn
Copy link

dliu-fn commented Jan 6, 2021

I had a breakpoint in my code. Took it out, and then a line-number showed up.

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

No branches or pull requests

6 participants