PyCQA / PyCQA/bandit

Add config via setup.cfg

Open
#736 4 comments 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Python
Stars
8.3k
Forks
835
Avg merge
5d 3h
Merged PRs (30d)
1

Description

Is your feature request related to a problem? Please describe.

I'd like to use single setup.cfg file for many different linters/plugins/style checkers. Currently bandit requires to have special config for it and is not able to read setup.cfg.

Describe the solution you'd like

  1. Check multiple different paths for config file by default
  2. Implement proper parsing of setup.cfg (which is not YAML but more like INI-like format)

Example:


[isort]
# https://github.com/timothycrosley/isort/wiki/isort-Settings
line_length=119
case_sensitive=True
multi_line_output=7
force_single_line=True
default_section=THIRDPARTY

[bandit]
# https://bandit.readthedocs.io/en/latest/blacklists/index.html#
tests: ['B603']

[flake8]
# https://flake8.pycqa.org/en/latest/user/configuration.html
show_source = True

per-file-ignores =
    python/pypi/*: WPS300, WPS442

Describe alternatives you've considered
Separating configs which works, but clutters the workspace with files

Additional context
Basically the same as https://github.com/PyCQA/bandit/issues/212 (which was probably closed by mistake)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue names no files or tests. Start by locating Bandit's existing configuration-loading entry point, then examine how it searches for configuration and parses the current format. Done means supporting default config discovery across the requested paths and correctly reading the INI-like setup.cfg sections and values shown in the examples.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
developer-experience, tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.