Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable/disable a linter for a subset of files in a project #8106

Closed
danvk opened this issue Jan 24, 2023 · 3 comments
Closed

Enable/disable a linter for a subset of files in a project #8106

danvk opened this issue Jan 24, 2023 · 3 comments
Labels
Duplicate 🐫 Duplicate of an already existing issue

Comments

@danvk
Copy link

danvk commented Jan 24, 2023

Current problem

I'd like to have the missing-function-docstring and missing-module-docstring warnings enabled for the main code of my project, but not for test files where they don't add much value:

"""Tests for foo.py"""

from foo import bar

def test_bar():
    """Tests for bar"""
    assert bar(1) == 2

There doesn't seem to be a way to do this at the moment, hence this feature request.

Desired solution

I'd like a way to disable these warnings for a subset of files.

There's already the --no-docstring-rgx option which I can use to disable missing-function-docstring for unit tests (which always start with test_ in my project). But there's no such option for missing-module-docstring.

Additional context

I asked about this on Stack Overflow and was referred here: How can I disable pylint's missing-module-docstring for unit tests?

A fix for #618 would also address my issue, but my issue could also be fixed more narrowly by adding a --no-docstring-file-rgx or some such.

@danvk danvk added the Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling label Jan 24, 2023
@DanielNoord
Copy link
Collaborator

Closing a duplicate of #3767

You can subscribe to that issue to get updates on this problem 😄

@DanielNoord DanielNoord closed this as not planned Won't fix, can't repro, duplicate, stale Jan 24, 2023
@DanielNoord DanielNoord added Duplicate 🐫 Duplicate of an already existing issue and removed Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling labels Jan 24, 2023
@danvk
Copy link
Author

danvk commented Jan 26, 2023

@DanielNoord thanks for the triage. Am I reading this correctly that a --no-docstring-file-rgx option would not be an acceptable (more targeted) solution to this specific issue?

@Pierre-Sassoulas
Copy link
Member

Pierre-Sassoulas commented Jan 28, 2023

I think this could be a substitute to having configuration per-directory which would solve the problem more generally. Maybe it's best if we focus on per-dir configuration instead. (#618)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Duplicate 🐫 Duplicate of an already existing issue
Projects
None yet
Development

No branches or pull requests

3 participants