Skip to content

Flag unused closure defined function / class definitions #392

Open

Description

@asottile

I expect this to flag two errors:

def f():
    class IAmUnused: pass
    def i_am_unused(): pass

Activity

  1. adamchainz commented on Oct 25, 2019

    @adamchainz
    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions