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

Flag unused closure defined function / class definitions #392

Open
asottile opened this issue Nov 22, 2018 · 1 comment · May be fixed by #485
Open

Flag unused closure defined function / class definitions #392

asottile opened this issue Nov 22, 2018 · 1 comment · May be fixed by #485

Comments

@asottile
Copy link
Member

I expect this to flag two errors:

def f():
    class IAmUnused: pass
    def i_am_unused(): pass
@adamchainz
Copy link
Contributor

I mistakenly re-reported this on flake8 yesterday. The real world use case I saw was accidentally overly indented tests:

class MyTests(TestCase):
    def setUp(self):
        self.thing = Thing()
        
        def test_thing_1(self):
            self.assertEqual(self.thing.foo, "foo")

instead of:

class MyTests(TestCase):
    def setUp(self):
        self.thing = Thing()
        
    def test_thing_1(self):
        self.assertEqual(self.thing.foo, "foo")

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 a pull request may close this issue.

2 participants