[flake8]

# Print the total number of errors:
count = true

# Don't even try to analyze these:
extend-exclude =
  # Circle CI configs
  .circleci,
  # No need to traverse egg info dir
  *.egg-info,
  # GitHub configs
  .github,
  # Cache files of MyPy
  .mypy_cache,
  # Cache files of pytest
  .pytest_cache,
  # Temp dir of pytest-testmon
  .tmontmp,
  # Countless third-party libs in venvs
  .tox,
  # Occasional virtualenv dir
  .venv,
  # VS Code
  .vscode,
  # Temporary build dir
  build,
  # This contains sdists and wheels that we don't want to check
  dist,
  # Metadata of `pip wheel` cmd is autogenerated
  pip-wheel-metadata,

# IMPORTANT: avoid using ignore option, always use extend-ignore instead
# Completely and unconditionally ignore the following errors:
extend-ignore =
  # Legitimate cases, no need to "fix" these violations:
  # E501: "line too long", its function is replaced by `flake8-length`
  E501,
  # W505: "doc line too long", its function is replaced by `flake8-length`
  W505,
  # I: flake8-isort is drunk + we have isort integrated into pre-commit
  # I,
  # WPS300: "Found local folder import" -- nothing bad about this
  WPS300,
  # WPS305: "Found f string" -- nothing bad about this
  WPS305,
  # An opposite consistency expectation is currently enforced
  # by pylint via: useless-object-inheritance (R0205):
  # WPS306: "Found class without a base class: *" -- we have metaclass shims
  WPS306,
  # WPS326: "Found implicit string concatenation" -- nothing bad about this
  WPS326,
  # WPS422: "Found future import: *" -- we need these for multipython
  WPS422,

  # FIXME: These `flake8-annotations` errors need fixing and removal
  # ANN001: Missing type annotation for function argument 'argv'
  ANN001,
  # ANN002: Missing type annotation for *exceptions
  ANN002,
  # ANN003: Missing type annotation for **kwargs
  ANN003,
  # ANN101: Missing type annotation for self in method
  ANN101,
  # ANN102: Missing type annotation for cls in classmethod
  ANN102,
  # ANN201: Missing return type annotation for public function
  ANN201,
  # ANN202: Missing return type annotation for protected function
  ANN202,
  # ANN204: Missing return type annotation for special method
  ANN204,
  # ANN205: Missing return type annotation for staticmethod
  ANN205,
  # ANN206: Missing return type annotation for classmethod
  ANN206,

  # FIXME: These `flake8-spellcheck` errors need fixing and removal
  # SC100: Possibly misspelt word / comments
  SC100,
  # SC200: Possibly misspelt word / names
  SC200,

  # FIXME: Temporary WPS ignore
  WPS,
  # FIXME: DAR101 Missing parameter(s) in Docstring: - classifiers
  DAR101,
  # FIXME: DAR201 Missing "Returns" in Docstring: - return
  DAR201,
  # FIXME: DAR301 Missing "Yields" in Docstring: - yield
  DAR301,
  # FIXME: DAR401 Missing exception(s) in Raises section: -r LookupError
  DAR401,
  # FIXME: PT006: wrong name(s) type in @pytest.mark.parametrize, expected tuple
  # FIXME: PT022: no teardown in fixture tmp_git_repo, use return instead of yield
  PT006,
  PT022,
  # FIXME: LN002: doc/comment line is too long
  LN002,
  # FIXME: Temporary `flake8-logging` ignore
  G200,
  # FIXME: D401: First line should be in imperative mood; try rephrasing
  D401,


format = default

# Let's not overcomplicate the code:
max-complexity = 10

# Accessibility/large fonts and PEP8 friendly.
# This is being flexibly extended through the `flake8-length`:
max-line-length = 79

# Allow certain violations in certain files:
# Please keep both sections of this list sorted, as it will be easier for others to find and add entries in the future
per-file-ignores =
  # The following ignores have been researched and should be considered permanent
  # each should be preceded with an explanation of each of the error codes
  # If other ignores are added for a specific file in the section following this,
  # these will need to be added to that line as well.

  # Sphinx builds aren't supposed to be run under Python 2:
  # docs/conf.py: WPS305

  # The package has imports exposing private things to the public:
  # src/pylibsshext/__init__.py: WPS412

  # There are multiple `assert`s (S101)
  # and subprocesses (import – S404; call – S603) in tests;
  # also, using fixtures looks like shadowing the outer scope (WPS442);
  # furthermore, we should be able to import and test private attributes
  # (WPS450) and modules (WPS436), and finally it's impossible to
  # have <= members in tests (WPS202), including many local vars (WPS210):
  tests/**.py: S101, S404, S603, WPS202, WPS210, WPS436, WPS442, WPS450


# Count the number of occurrences of each error/warning code and print a report:
statistics = true

# ## Plugin-provided settings: ##

# flake8-eradicate
# E800:
eradicate-whitelist-extend = isort:\s+\w+

# flake8-pytest-style
# PT001:
pytest-fixture-no-parentheses = true
# PT006:
pytest-parametrize-names-type = tuple
# PT007:
pytest-parametrize-values-type = tuple
pytest-parametrize-values-row-type = tuple
# PT023:
pytest-mark-no-parentheses = true

# flake8-rst-docstrings
rst-directives =
  spelling
rst-roles =
  # Built-in Sphinx roles:
  class,
  data,
  file,
  exc,
  meth,
  mod,
  term,
  py:class,
  py:data,
  py:exc,
  py:meth,
  py:term,
  # Sphinx's internal role:
  event,

# wemake-python-styleguide
show-source = true
