diff --git a/mccabe.py b/mccabe.py
index 305fb94..c604c1d 100644
--- a/mccabe.py
+++ b/mccabe.py
@@ -160,10 +160,11 @@ class PathGraphingAstVisitor(ASTVisitor):
         name = "Stmt %d" % lineno
         self.appendPathNode(name)
 
-    visitAssert = visitAssign = visitAugAssign = visitDelete = visitPrint = \
-        visitRaise = visitYield = visitImport = visitCall = visitSubscript = \
-        visitPass = visitContinue = visitBreak = visitGlobal = visitReturn = \
-        visitAwait = visitSimpleStatement
+    def default(self, node):
+        if isinstance(node, ast.stmt):
+            self.visitSimpleStatement(node)
+        else:
+            super(PathGraphingAstVisitor, self).default(node)
 
     def visitLoop(self, node):
         name = "Loop %d" % node.lineno

Trivial function with docstring reports complexity of 2
```python
def f():
    """hi"""
    x = 1


def g():
    """hi"""
```

```
$ python3.5 mccabe.py test.py
1:0: 'f' 1
6:0: 'g' 2
```

```
$ git rev-parse HEAD
682145a37fee41fe7b6640244faa0c3f58e3b496
```
diff --git a/test_mccabe.py b/test_mccabe.py
index 44fb565..3b8fcce 100644
--- a/test_mccabe.py
+++ b/test_mccabe.py
@@ -16,6 +16,12 @@ from mccabe import get_code_complexity
 trivial = 'def f(): pass'
 
 
+expr_as_statement = '''\
+def f():
+    """docstring"""
+'''
+
+
 sequential = """\
 def f(n):
     k = n + 4
@@ -176,6 +182,10 @@ class McCabeTestCase(unittest.TestCase):
         printed_message = self.strio.getvalue()
         self.assertEqual(printed_message, "")
 
+    def test_expr_as_statement(self):
+        complexity = get_complexity_number(expr_as_statement, self.strio)
+        self.assertEqual(complexity, 1)
+
     def test_try_else(self):
         self.assert_complexity(try_else, 4)
 

pip install -e .
parse_log_pytest
pytest
pytest
3.9
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
exceptiongroup @ file:///croot/exceptiongroup_1706031385326/work
iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work
-e git+https://github.com/PyCQA/mccabe.git@682145a37fee41fe7b6640244faa0c3f58e3b496#egg=mccabe
packaging @ file:///croot/packaging_1734472117206/work
pluggy @ file:///croot/pluggy_1733169602837/work
pytest @ file:///croot/pytest_1738938843180/work
tomli @ file:///opt/conda/conda-bld/tomli_1657175507142/work

name: mccabe
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - ca-certificates=2025.2.25=h06a4308_0
  - exceptiongroup=1.2.0=py39h06a4308_0
  - iniconfig=1.1.1=pyhd3eb1b0_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.4.4=h6a678d5_1
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - ncurses=6.4=h6a678d5_0
  - openssl=3.0.16=h5eee18b_0
  - packaging=24.2=py39h06a4308_0
  - pip=25.0=py39h06a4308_0
  - pluggy=1.5.0=py39h06a4308_0
  - pytest=8.3.4=py39h06a4308_0
  - python=3.9.21=he870216_1
  - readline=8.2=h5eee18b_0
  - setuptools=75.8.0=py39h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - tomli=2.0.1=py39h06a4308_0
  - tzdata=2025a=h04d1e81_0
  - wheel=0.45.1=py39h06a4308_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
prefix: /opt/conda/envs/mccabe

test_mccabe.py::McCabeTestCase::test_expr_as_statement
test_mccabe.py::McCabeTestCase::test_async_keywords test_mccabe.py::McCabeTestCase::test_for_else_snippet test_mccabe.py::McCabeTestCase::test_for_loop_snippet test_mccabe.py::McCabeTestCase::test_if_elif_else_dead_path_snippet test_mccabe.py::McCabeTestCase::test_nested_functions_snippet test_mccabe.py::McCabeTestCase::test_print_message test_mccabe.py::McCabeTestCase::test_recursive_snippet test_mccabe.py::McCabeTestCase::test_sequential_snippet test_mccabe.py::McCabeTestCase::test_sequential_unencapsulated_snippet test_mccabe.py::McCabeTestCase::test_trivial test_mccabe.py::McCabeTestCase::test_try_else test_mccabe.py::RegressionTests::test_max_complexity_is_always_an_int
mccabe.py
mccabe.py