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

mlog: make mlog helper take once keyword argument #8003

Merged
merged 1 commit into from
Dec 16, 2020

Conversation

dcbaker
Copy link
Member

@dcbaker dcbaker commented Nov 19, 2020

We really want to have this in the log method as well.

Fixes: #8002

@lgtm-com
Copy link

lgtm-com bot commented Nov 19, 2020

This pull request introduces 1 alert when merging f5c6d4d into 9133748 - view on LGTM.com

new alerts:

  • 1 for Use of the return value of a procedure

We really want to have this in the log method as well.

Fixes: mesonbuild#8002
@dcbaker dcbaker force-pushed the submit/fix-log-once branch from f5c6d4d to 5095efd Compare November 20, 2020 18:25
@lgtm-com
Copy link

lgtm-com bot commented Nov 20, 2020

This pull request introduces 1 alert when merging 5095efd into cef406b - view on LGTM.com

new alerts:

  • 1 for Use of the return value of a procedure

@dcbaker
Copy link
Member Author

dcbaker commented Nov 20, 2020

the LGTM warning is stupid. It's complaining that I'm returning a function that returns None. but it looks like this:

def _fun1() -> None: ...
def _fun2() -> None: ...

def fun(thing: bool = true) -> None:
   if thing:
    return _fun1()
  return _fun2()

Not returning here is odd.

@dcbaker dcbaker added this to the 0.57 milestone Nov 20, 2020
@bonzini
Copy link
Collaborator

bonzini commented Nov 24, 2020

Why not use else as in the code you are moving? Or returning on a separate line would work too.

@dcbaker
Copy link
Member Author

dcbaker commented Nov 24, 2020

it's generally considered a code smell in python to use an else when you return from a single if, both because it creates unnecessary indentation, and also because there is a small cost to the else block.

@jpakkane jpakkane merged commit a9ff308 into mesonbuild:master Dec 16, 2020
@dcbaker dcbaker deleted the submit/fix-log-once branch December 16, 2020 23:13
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.

'once' is an invalid keyword argument for print()
3 participants