diff --git a/flake8_fancy_header/__init__.py b/flake8_fancy_header/__init__.py
index 4dc17be..d871073 100644
--- a/flake8_fancy_header/__init__.py
+++ b/flake8_fancy_header/__init__.py
@@ -1,9 +1,15 @@
+"""
+===================
+flake8_fancy_header
+===================
+"""
+
 import sys
 
 major, minor = sys.version_info[0], sys.version_info[1]
 PY_37_OR_GREATER = (major, minor) >= (3, 7)
 
 if PY_37_OR_GREATER:
-    from .checker import FancyHeaderChecker
+    from .checker import FancyHeaderChecker  # flake8: noqa
 else:
-    from .checker import FancyHeaderCheckerBefore37 as FancyHeaderChecker
+    from .checker import FancyHeaderCheckerBefore37 as FancyHeaderChecker  # flake8: noqa
diff --git a/flake8_fancy_header/checker.py b/flake8_fancy_header/checker.py
index 2261a33..eaa9baa 100644
--- a/flake8_fancy_header/checker.py
+++ b/flake8_fancy_header/checker.py
@@ -1,10 +1,22 @@
+"""
+===========================
+flake8_fancy_header.checker
+===========================
+"""
+
 __version__ = '0.1.0'
 
 
 import ast
 
 from os import getcwd
-from os.path import join, normpath, splitext
+from os.path import exists, dirname, join, normpath, splitext
+
+PROJECT_ROOT_MARKERS = [
+    '.git',
+    'setup.cfg',
+    'setup.py',
+]
 
 
 class BaseChecker(object):
@@ -18,12 +30,25 @@ class BaseChecker(object):
         self.tree = tree
         self.filename = filename
 
-    def get_header_value(self):
-        # Assume that python runs from project's root, so we can get its
-        # working directory and resolve from it.
-        cwd = getcwd() + '/'
-        filename = normpath(join(cwd, self.filename)).split(cwd, 1)[1]
+    def get_project_root_dir(self, current_dir=None):
+        if current_dir == '/':
+            # Reached fs root, fallback to cwd
+            return getcwd()
+
+        if current_dir is None:
+            current_dir = getcwd()
 
+        for marker in PROJECT_ROOT_MARKERS:
+            if exists(join(current_dir, marker)):
+                return current_dir
+
+        return self.get_project_root_dir(current_dir=dirname(current_dir))
+
+    def get_header_value(self):
+        filename = (
+            normpath(join(getcwd(), self.filename))
+            .split(self.get_project_root_dir() + '/', 1)[1]
+        )
         import_path = splitext(filename)[0].replace('/', '.')
         if import_path.endswith('__init__'):
             import_path = import_path.rsplit('.', 1)[0]
diff --git a/setup.py b/setup.py
index 1c7bc6d..777605d 100644
--- a/setup.py
+++ b/setup.py
@@ -1,3 +1,9 @@
+"""
+=====
+setup
+=====
+"""
+
 import setuptools
 
 install_requires = [

Checking filename in header
I think assumption you've made here is incorrect:
https://github.com/yevhen-m/flake8-fancy-header/blob/master/flake8_fancy_header/checker.py#L24

Path python started from have nothing to deal with name of the file it checks. For example, my checker runs from different directory. Can you just check that given path exist on given machine and stop. 
For example you have `fokker.hotels.sell` just check that relpath exist for give file. 
Other solution you can be search for first `setup.cfg` down in the path. 
diff --git a/tests/__init__.py b/tests/__init__.py
index e69de29..31cbc3e 100644
--- a/tests/__init__.py
+++ b/tests/__init__.py
@@ -0,0 +1,5 @@
+"""
+=====
+tests
+=====
+"""
diff --git a/tests/test_checker.py b/tests/test_checker.py
index d16f912..b229032 100644
--- a/tests/test_checker.py
+++ b/tests/test_checker.py
@@ -1,7 +1,13 @@
+"""
+==================
+tests.test_checker
+==================
+"""
+
 import ast
-import os
 import unittest
 
+from os.path import dirname
 from unittest.mock import patch, Mock
 
 from flake8_fancy_header import FancyHeaderChecker
@@ -11,6 +17,7 @@ from flake8_fancy_header import FancyHeaderChecker
     'flake8_fancy_header.checker.getcwd',
     Mock(return_value='/home/User/Project'),
 )
+@patch('flake8_fancy_header.checker.exists', Mock(return_value=False))
 class CheckerTestCase(unittest.TestCase):
 
     def test_empty_module(self):
@@ -138,3 +145,25 @@ package.spam
             filename='/home/User/Project/package/spam.py',
         )
         self.assertEqual(len(list(checker.run())), 0)
+
+
+class CheckerTestCase1(unittest.TestCase):
+
+    @patch('flake8_fancy_header.checker.exists')
+    @patch('flake8_fancy_header.checker.getcwd')
+    def test_checker_not_from_project_root(self, getcwd, exists):
+        getcwd.return_value = '/home/User/Project/package/subpackage'
+        # Pretend that project root marker was found in /home/User/Project
+        exists.side_effect = lambda path: dirname(path) == '/home/User/Project'
+        module = ast.parse('''\
+"""
+=========================
+package.subpackage.module
+=========================
+"""
+        ''')
+        checker = FancyHeaderChecker(
+            tree=module,
+            filename='module.py',
+        )
+        self.assertEqual(len(list(checker.run())), 0)

pip install -e .
parse_log_pytest
pytest
pytest
3.6
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
attrs @ file:///opt/conda/conda-bld/attrs_1642510447205/work
certifi==2021.5.30
flake8==5.0.4
-e git+https://github.com/yevhen-m/flake8-fancy-header.git@54f4b80e65995b1163365bc1c1a6aa0fed159109#egg=flake8_fancy_header
importlib-metadata==4.2.0
iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work
mccabe==0.7.0
more-itertools @ file:///tmp/build/80754af9/more-itertools_1637733554872/work
packaging @ file:///tmp/build/80754af9/packaging_1637314298585/work
pluggy @ file:///tmp/build/80754af9/pluggy_1615976315926/work
py @ file:///opt/conda/conda-bld/py_1644396412707/work
pycodestyle==2.9.1
pyflakes==2.5.0
pyparsing @ file:///tmp/build/80754af9/pyparsing_1635766073266/work
pytest==6.2.4
toml @ file:///tmp/build/80754af9/toml_1616166611790/work
typing_extensions @ file:///opt/conda/conda-bld/typing_extensions_1647553014482/work
zipp @ file:///tmp/build/80754af9/zipp_1633618647012/work

name: flake8-fancy-header
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
  - attrs=21.4.0=pyhd3eb1b0_0
  - ca-certificates=2025.2.25=h06a4308_0
  - certifi=2021.5.30=py36h06a4308_0
  - importlib_metadata=4.8.1=hd3eb1b0_0
  - iniconfig=1.1.1=pyhd3eb1b0_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.3=he6710b0_2
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - more-itertools=8.12.0=pyhd3eb1b0_0
  - ncurses=6.4=h6a678d5_0
  - openssl=1.1.1w=h7f8727e_0
  - packaging=21.3=pyhd3eb1b0_0
  - pip=21.2.2=py36h06a4308_0
  - pluggy=0.13.1=py36h06a4308_0
  - py=1.11.0=pyhd3eb1b0_0
  - pyparsing=3.0.4=pyhd3eb1b0_0
  - pytest=6.2.4=py36h06a4308_2
  - python=3.6.13=h12debd9_1
  - readline=8.2=h5eee18b_0
  - setuptools=58.0.4=py36h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - toml=0.10.2=pyhd3eb1b0_0
  - typing_extensions=4.1.1=pyh06a4308_0
  - wheel=0.37.1=pyhd3eb1b0_0
  - xz=5.6.4=h5eee18b_1
  - zipp=3.6.0=pyhd3eb1b0_0
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - flake8==5.0.4
      - importlib-metadata==4.2.0
      - mccabe==0.7.0
      - pycodestyle==2.9.1
      - pyflakes==2.5.0
prefix: /opt/conda/envs/flake8-fancy-header

tests/test_checker.py::CheckerTestCase::test_checker_with_absolute_filename tests/test_checker.py::CheckerTestCase::test_checker_with_absolute_filename_and_submodule tests/test_checker.py::CheckerTestCase::test_empty_module tests/test_checker.py::CheckerTestCase::test_module_with_docstring tests/test_checker.py::CheckerTestCase::test_module_with_invalid_header tests/test_checker.py::CheckerTestCase::test_module_with_relative_filename tests/test_checker.py::CheckerTestCase::test_module_with_valid_header tests/test_checker.py::CheckerTestCase::test_module_with_valid_header_2 tests/test_checker.py::CheckerTestCase::test_module_with_valid_header_and_leading_comment tests/test_checker.py::CheckerTestCase::test_module_with_valid_header_for_init_module tests/test_checker.py::CheckerTestCase::test_module_without_docstring tests/test_checker.py::CheckerTestCase::test_valid_header_in_submodule tests/test_checker.py::CheckerTestCase1::test_checker_not_from_project_root
flake8_fancy_header/__init__.py flake8_fancy_header/checker.py setup.py
flake8_fancy_header/__init__.py flake8_fancy_header/checker.py setup.py