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

New Check: Warning for breakpoint calls. no-breakpoint #3692

Closed
SalomonSmeke opened this issue Jun 15, 2020 · 1 comment · Fixed by #4771
Closed

New Check: Warning for breakpoint calls. no-breakpoint #3692

SalomonSmeke opened this issue Jun 15, 2020 · 1 comment · Fixed by #4771
Labels
Enhancement ✨ Improvement to a component Good first issue Friendly and approachable by new contributors Help wanted 🙏 Outside help would be appreciated, good for new contributors
Milestone

Comments

@SalomonSmeke
Copy link

SalomonSmeke commented Jun 15, 2020

Is your feature request related to a problem? Please describe

Since python 3.7 there is a new builtin breakpoint(). Although there are environment variables you can set in production to make breakpoint() a no-op, the default behavior (unset) is to allow breakpoint(). Further, setting this flag makes it circuitous to use a breakpoint when you need one in a shell, or doing some debugging.

How often do you intentionally commit breakpoints into your packages? Projects? Production? Even in test environments its unusual.

Describe the solution you'd like

A new warning :)

Additional context

From PEP 553 re: breakpoints:

Completely disabling all accidental breakpoint() calls pushed to production. This could be accomplished by setting PYTHONBREAKPOINT=0 in the execution environment. Another suggestion by reviewers of the PEP was to set PYTHONBREAKPOINT=sys.exit in this case.

Uncertain

Should sys.breakpointhook() also be disallowed?

@PCManticore PCManticore added Good first issue Friendly and approachable by new contributors Enhancement ✨ Improvement to a component labels Jun 16, 2020
@SalomonSmeke
Copy link
Author

@PCManticore do those tags mean that the idea/concept outlined in the above sound like a good plan? I started to implement this but I didn't want to get too far only to find out that the concept itself was unpalatable/misaligned to/with pylint!

Or rather is there still a discussion stage or something like that.

@Pierre-Sassoulas Pierre-Sassoulas added the Help wanted 🙏 Outside help would be appreciated, good for new contributors label Mar 2, 2021
DanielNoord added a commit to DanielNoord/pylint that referenced this issue Jul 29, 2021
This adds a checker for calls to breakpoint() or sys.breakpointhook().
This closes pylint-dev#3692
DanielNoord added a commit to DanielNoord/pylint that referenced this issue Jul 29, 2021
This adds a checker for calls to ``breakpoint()``
or ``sys.breakpointhook()``.
This closes pylint-dev#3692
DanielNoord added a commit to DanielNoord/pylint that referenced this issue Jul 29, 2021
This adds a checker for calls to ``breakpoint()``
or ``sys.breakpointhook()``.
This closes pylint-dev#3692
@Pierre-Sassoulas Pierre-Sassoulas added this to the 2.10.0 milestone Jul 29, 2021
Pierre-Sassoulas added a commit that referenced this issue Jul 29, 2021
* Add ``no-breakpoint`` checker this adds a checker for calls to ``breakpoint()``, ``pdb.set_trace()``, or ``sys.breakpointhook()``.

Closes #3692

Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
cdce8p added a commit to cdce8p/pylint that referenced this issue Aug 1, 2021
Squashed commit of the following:

commit 49c4bba
Author: Yu Shao, Pang <p.yushao2@gmail.com>
Date:   Sun Aug 1 19:56:51 2021 +0800

    Fix crash for `unused-private-member` when there are nested attributes

commit 2ad8247
Merge: 8ceb26d 1d09bc8
Author: yushao2 <36848472+yushao2@users.noreply.github.com>
Date:   Sun Aug 1 20:13:05 2021 +0800

    Merge pull request pylint-dev#4709 from yushao2/fix-unused-private-member-4673

    [unused-private-member] add logic for checking nested functions

commit 1d09bc8
Author: Yu Shao, Pang <p.yushao2@gmail.com>
Date:   Sun Aug 1 20:03:42 2021 +0800

    update pr based on review

commit a4198cd
Author: Yu Shao, Pang <p.yushao2@gmail.com>
Date:   Sun Aug 1 19:21:36 2021 +0800

    Update pr based on review

commit c8b2cbb
Author: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Date:   Sun Jul 25 05:20:42 2021 +0000

    [pre-commit.ci] auto fixes from pre-commit.com hooks

    for more information, see https://pre-commit.ci

commit 4ffea0b
Author: Yu Shao, Pang <p.yushao2@gmail.com>
Date:   Sun Jul 25 13:12:29 2021 +0800

    Update pr based on review

commit e4d6243
Author: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
Date:   Sun Jul 18 17:23:31 2021 +0200

    Remove empty line

commit cce5833
Author: Yu Shao, Pang <p.yushao2@gmail.com>
Date:   Sun Jul 18 22:40:54 2021 +0800

    update PR based on comments

commit 712dc2b
Author: Yu Shao, Pang <p.yushao2@gmail.com>
Date:   Wed Jul 14 16:42:25 2021 +0800

    [unused-private-member] add logic for checking nested functions

    also, improve error message for nested functions

commit 8ceb26d
Author: Michal Vasilek <michal@vasilek.cz>
Date:   Sun Aug 1 08:14:58 2021 +0200

    Fix IsADirectoryError in tests/lint/unittest_lint (pylint-dev#4781)

    pylintd is a directory, so os.remove throws IsADirectoryError

commit a31e6bc
Author: Pierre Sassoulas <pierre.sassoulas@gmail.com>
Date:   Sat Jul 31 11:21:46 2021 +0200

    Add documentation for useless-suppression

    Closes pylint-dev#4757

commit b71be8a
Author: Mark Byrne <31762852+mbyrnepr2@users.noreply.github.com>
Date:   Fri Jul 30 20:21:02 2021 +0200

    Handle has-a relationships for type-hinted arguments in class diagrams (pylint-dev#4745)

    * Pyreverse - Show class has-a relationships inferred from type-hints

    Closes pylint-dev#4744

    Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>

commit 5e5f48d
Author: Daniël van Noord <13665637+DanielNoord@users.noreply.github.com>
Date:   Thu Jul 29 23:44:30 2021 +0200

    Add ``forgotten-debug-statement`` checker (pylint-dev#4771)

    * Add ``no-breakpoint`` checker this adds a checker for calls to ``breakpoint()``, ``pdb.set_trace()``, or ``sys.breakpointhook()``.

    Closes pylint-dev#3692

    Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
    Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement ✨ Improvement to a component Good first issue Friendly and approachable by new contributors Help wanted 🙏 Outside help would be appreciated, good for new contributors
Projects
None yet
3 participants