PyCQA / PyCQA/bandit

Run checks in threads to speed up execution and analysis

Open
#474 1 comment 1 reaction 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

Source blueprint: https://blueprints.launchpad.net/bandit/+spec/use-threading-when-running-checks

Many static analysis tools offer parallelization of execution to make checking large amounts of code faster. Flake8, for example, added the -j flag so that files would be checked in parallel. When running bandit against large amounts of code, e.g., openstack/glance, the checks take quite a while. For over 7500 files, the checks take several minutes.

I propose that we add a similar flag (to -j/--jobs) with similar behaviour to the flag in Flake8.

For example,

$ bandit -j 4 -r glance/

Would use 4 threads, while

$ bandit -j auto -r glance

Would use the number of CPUs present and could be the default.

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

Start with the linked Launchpad blueprint for the proposed threading design, then compare the requested -j/--jobs behavior with Flake8's parallelization. Confirm the expected behavior for an explicit thread count and for auto-detection of CPUs; done means the Bandit command can process large recursive scans in parallel with those options.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.