-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
## Summary Adds all `S4XX` rules to the [flake8-bandit](https://github.com/tylerwince/flake8-bandit) plugin port. There is a lot of documentation to write, some tests can be expanded and implementation can probably be refactored to be more compact. As there is some discussion on whether this is actually useful. (See: #1646 (comment)), wanted to check which rules we want to have before I go through the process of polishing this up. ## Test Plan Fixtures for all rules based on `flake8-bandit` [tests](https://github.com/tylerwince/flake8-bandit/tree/main/tests) ## Issue link Refers: #1646
- Loading branch information
Showing
34 changed files
with
1,079 additions
and
0 deletions.
There are no files selected for viewing
2 changes: 2 additions & 0 deletions
2
crates/ruff_linter/resources/test/fixtures/flake8_bandit/S401.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
import telnetlib # S401 | ||
from telnetlib import Telnet # S401 |
2 changes: 2 additions & 0 deletions
2
crates/ruff_linter/resources/test/fixtures/flake8_bandit/S402.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
import ftplib # S402 | ||
from ftplib import FTP # S402 |
8 changes: 8 additions & 0 deletions
8
crates/ruff_linter/resources/test/fixtures/flake8_bandit/S403.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import dill # S403 | ||
from dill import objects # S403 | ||
import shelve | ||
from shelve import open | ||
import cPickle | ||
from cPickle import load | ||
import pickle | ||
from pickle import load |
3 changes: 3 additions & 0 deletions
3
crates/ruff_linter/resources/test/fixtures/flake8_bandit/S404.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import subprocess # S404 | ||
from subprocess import Popen # S404 | ||
from subprocess import Popen as pop # S404 |
4 changes: 4 additions & 0 deletions
4
crates/ruff_linter/resources/test/fixtures/flake8_bandit/S405.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import xml.etree.cElementTree # S405 | ||
from xml.etree import cElementTree # S405 | ||
import xml.etree.ElementTree # S405 | ||
from xml.etree import ElementTree # S405 |
3 changes: 3 additions & 0 deletions
3
crates/ruff_linter/resources/test/fixtures/flake8_bandit/S406.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from xml import sax # S406 | ||
import xml.sax as xmls # S406 | ||
import xml.sax # S406 |
2 changes: 2 additions & 0 deletions
2
crates/ruff_linter/resources/test/fixtures/flake8_bandit/S407.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
from xml.dom import expatbuilder # S407 | ||
import xml.dom.expatbuilder # S407 |
2 changes: 2 additions & 0 deletions
2
crates/ruff_linter/resources/test/fixtures/flake8_bandit/S408.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
from xml.dom.minidom import parseString # S408 | ||
import xml.dom.minidom # S408 |
2 changes: 2 additions & 0 deletions
2
crates/ruff_linter/resources/test/fixtures/flake8_bandit/S409.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
from xml.dom.pulldom import parseString # S409 | ||
import xml.dom.pulldom # S409 |
2 changes: 2 additions & 0 deletions
2
crates/ruff_linter/resources/test/fixtures/flake8_bandit/S410.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
import lxml # S410 | ||
from lxml import etree # S410 |
2 changes: 2 additions & 0 deletions
2
crates/ruff_linter/resources/test/fixtures/flake8_bandit/S411.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
import xmlrpc # S411 | ||
from xmlrpc import server # S411 |
1 change: 1 addition & 0 deletions
1
crates/ruff_linter/resources/test/fixtures/flake8_bandit/S412.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from twisted.web.twcgi import CGIScript # S412 |
4 changes: 4 additions & 0 deletions
4
crates/ruff_linter/resources/test/fixtures/flake8_bandit/S413.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import Crypto.Hash # S413 | ||
from Crypto.Hash import MD2 # S413 | ||
import Crypto.PublicKey # S413 | ||
from Crypto.PublicKey import RSA # S413 |
3 changes: 3 additions & 0 deletions
3
crates/ruff_linter/resources/test/fixtures/flake8_bandit/S415.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import pyghmi # S415 | ||
from pyghmi import foo # S415 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.