Repository: asottile/covdefaults (language: python)

Issue:
Class-level `if TYPE_CHECKING` is reported as uncovered
Example:

```python
from typing import TYPE_CHECKING

class Some:
   if TYPE_CHECKING:
      some_attr: str
```

Here `if TYPE_CHECKING:` is reported to be uncovered.

<img width="679" alt="Снимок экрана 2022-12-03 в 14 21 00" src="https://user-images.githubusercontent.com/4660275/205438416-b995b5a3-a8a1-4553-ba20-b4246650c26b.png">


While, other rules have `\s*` prefix. I have a PR ready.


Discussion / hints:

Fix patch:
diff --git a/README.md b/README.md
index 08a0078..2761af0 100644
--- a/README.md
+++ b/README.md
@@ -67,7 +67,7 @@ exclude_lines =
     ^\s*raise$
 
     # typing-related code
-    ^if (False|TYPE_CHECKING):
+    ^\s*if (False|TYPE_CHECKING):
     : \.\.\.(\s*#.*)?$
     ^ +\.\.\.$
     -> ['"]?NoReturn['"]?:
diff --git a/covdefaults.py b/covdefaults.py
index 55a5120..09b40a9 100644
--- a/covdefaults.py
+++ b/covdefaults.py
@@ -93,7 +93,7 @@ def _version_pragmas(
             r'^\s*return NotImplemented\b',
             r'^\s*raise$',
             # typing-related code
-            r'^if (False|TYPE_CHECKING):',
+            r'^\s*if (False|TYPE_CHECKING):',
             r': \.\.\.(\s*#.*)?$',
             r'^ +\.\.\.$',
             r'-> [\'"]?NoReturn[\'"]?:',


Test patch:
diff --git a/tests/covdefaults_test.py b/tests/covdefaults_test.py
index 7d124ba..bc3f1bc 100644
--- a/tests/covdefaults_test.py
+++ b/tests/covdefaults_test.py
@@ -167,7 +167,9 @@ def test_exclude_lines_does_not_include_defaults(configured):
         '    return NotImplemented\n',
         '    raise\n',
         'if False:\n',
+        '    if False:\n',
         'if TYPE_CHECKING:\n',
+        '    if TYPE_CHECKING:\n',
         'def f(x: int) -> int: ...\n',
         'def f(x: int) -> int:\n    ...\n',
         'def f(x: int) -> C: ...# noqa: F821\n',