[flake8] application-import-names = posthog import-order-style = pycharm max-complexity = 10 # Error / Violation code details are available at: # # - https://pep8.readthedocs.io/en/latest/intro.html#error-codes # - https://flake8.pycqa.org/en/latest/user/error-codes.html # ignore= B001, # Do not use bare `except:`. B006, # Do not use mutable data structures for argument defaults. B008, # Do not perform function calls in argument defaults. B009, # Do not call getattr with a constant attribute value, it is not any safer than normal property access. B007, # Loop control variable 'i' not used within the loop body. If this is intended, start the name with an underscore B011, # Do not call assert False since python -O removes these calls B010, # Do not call setattr with a constant attribute value, it is not any safer than normal property access. B017, # assertRaises(Exception): should be considered evil B019, # Use of `functools.lru_cache` or `functools.cache` on methods can lead to memory leaks. B024, # ClickhouseFunnelBase is an abstract base class, but it has no abstract methods. Remember to use @abstractmethod, @abstractclassmethod and/or @abstractproperty decorators. C400, # Unnecessary generator - rewrite as a list comprehension C401, # Unnecessary generator - rewrite as a set comprehension. C403, # Unnecessary list comprehension - rewrite as a set comprehension. C405, # Unnecessary list literal - rewrite as a set literal. C407, # Unnecessary list comprehension - 'any' can take a generator. C408, # Unnecessary dict call - rewrite as a literal. C413, # Unnecessary list call around sorted() C414, # Unnecessary list call within sorted(). C416, # Unnecessary list comprehension - rewrite using list(). C417, # Unnecessary use of map - use a generator expression instead. C901, # function complexity E203, # whitespace before ‘:’. -- Do not enable. We've disabled all formatting-related errors as 'black' takes care of them for us E231, # missing whitespace after ‘,’, ‘;’, or ‘:’. -- Do not enable. We've disabled all formatting-related errors as 'black' takes care of them for us E262, # inline comment should start with '# ' E302, # expected 2 blank lines, found 0. -- Do not enable. we've disabled all formatting-related errors as 'black' takes care of them for us E501, # line too long. -- Do not enable. We've disabled all formatting-related errors as 'black' takes care of them for us E722, # do not use bare except, specify exception instead E731, # do not assign a lambda expression, use a def F403, # ‘from module import *’ used; unable to detect undefined names F405, # name may be undefined, or defined from star imports: module F541, # f-string without any placeholders F601, # dictionary key name repeated with different values G001, # Logging statement uses string.format() G003, # Logging statement uses '+' G004, # Logging statement uses f-string G010, # Logging statement uses 'warn' instead of 'warning' G200, # Logging statement uses exception in arguments G201, # Logging: .exception(...) should be used instead of .error(..., exc_info=True) I100, # Import statements are in the wrong order. I101, # Imported names are in the wrong order I201, # Missing newline between import groups. I202, # Additional newline in a group of imports W503, # line break before binary operator exclude = .git, ./plugin-server/node_modules/ ./plugins/node_modules/ ./env per-file-ignores = __init__.py:F401 ./posthog/queries/column_optimizer/column_optimizer.py:F401 ./posthog/queries/cohort_query.py:F401 ./cypress/wait.py: T201 ./docker-compose-config.py: T201 ./posthog/client.py: T201 ./ee/clickhouse/generate_local.py: T201 ./posthog/management/commands/migrate_clickhouse.py: T201 ./posthog/management/commands/run_async_migrations.py: T201 ./posthog/management/commands/backfill_persons_and_groups_on_events.py: T201 ./gunicorn.config.py: T201 ./posthog/api/capture.py: T201 ./posthog/apps.py: T201 ./posthog/celery.py: T201 ./posthog/demo/matrix/manager.py: T201 ./posthog/demo/matrix/matrix.py: T201 ./posthog/email.py: T201 ./posthog/management/commands/api_keys.py: T201 ./posthog/management/commands/merge_distinct_emails.py: T201 ./posthog/management/commands/migrate_elementgroup.py: T201 ./posthog/management/commands/notify_helm_install.py: T201 T203 ./posthog/management/commands/partition.py: T201 ./posthog/management/commands/generate_demo_data.py: T201 ./posthog/management/commands/sync_feature_flags.py: T201 ./posthog/management/commands/test_migrations_are_safe.py: T201 ./posthog/migrations/0027_move_elements_to_group.py: T201 ./posthog/migrations/0038_migrate_actions_to_precalculate_events.py: T201 ./posthog/models/plugin.py: T201 ./posthog/settings/overrides.py: T201 ./posthog/utils.py: T201 ./posthog/async_migrations/test/test_migrations_not_required.py: T201