Skip to content

Commit 35d78a1

Browse files
committed
lint clean again
1 parent 4605228 commit 35d78a1

4 files changed

Lines changed: 28 additions & 21 deletions

File tree

pyproject.toml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,11 +160,18 @@
160160
"ARG002","ARG001",
161161
"D107","D102","D101","D103","D100","D105","D104","D205","D203",
162162
"N812","N818","N806","N802","N815","N816","N803","N999",
163-
"PLR6201","PLR2004","PLR0917","PLR0913","PLR0911","PLR0912","PLR0914",
163+
"PLR2004",
164+
165+
"PLR0911", # Too many return statements
166+
"PLR0912", # Too many branches
167+
"PLR0914", # Too many local variables
168+
"PLR0913", # Too many arguments in function definition
164169
"PLW0603", # Using the global statement to update `xxx` is discouraged
165170
"PLW0602", # Using global for `xxx` but no assignment is done
171+
166172
"RUF001","RUF067", "RUF012",
167-
"S101","S602",
173+
"S101", # Use of `assert` detected
174+
# "S602",
168175

169176
#
170177
"COM812", # The following rule may cause conflicts when used with the formatter: `COM812`

whoisdomain/context/parameterContext.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,12 +213,12 @@ def __init__(
213213
self._validateAllMandatoryNowKnown(mandatory)
214214

215215
def __getattr__(self, name: str) -> Any:
216-
if name in ["params", "value"]:
216+
if name in {"params", "value"}:
217217
return self.name
218218
return self.get(name)
219219

220220
def __setattr__(self, name: str, value: Any) -> None:
221-
if name in ["params", "value"]:
221+
if name in {"params", "value"}:
222222
object.__setattr__(self, name, value)
223223
else:
224224
self.set(name, value)

whoisdomain/main.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -598,65 +598,65 @@ def main() -> None: # noqa: C901,PLR0915
598598
fileData: dict[str, Any] = {}
599599

600600
for opt, arg in opts:
601-
if opt in ("-S", "SupportedTld"):
601+
if opt in {"-S", "SupportedTld"}:
602602
for tld in sorted(whois.validTlds()):
603603
print(tld)
604604
sys.exit(0)
605605

606-
if opt in ("-V", "Version"):
606+
if opt in {"-V", "Version"}:
607607
print(whois.getVersion())
608608
sys.exit(0)
609609

610610
if opt == "-h":
611611
usage()
612612
sys.exit(0)
613613

614-
if opt in ("-a", "--all"):
614+
if opt in {"-a", "--all"}:
615615
TestAllTld = True
616616

617-
if opt in ("-H", "--having"):
617+
if opt in {"-H", "--having"}:
618618
TestAllTld = True
619619
allHaving = str(arg)
620620

621-
if opt in ("-r", "--reg"):
621+
if opt in {"-r", "--reg"}:
622622
TestAllTld = True
623623
allRegex = str(arg)
624624

625-
if opt in ("-v", "--verbose"):
625+
if opt in {"-v", "--verbose"}:
626626
Verbose = True
627627
logging.basicConfig(level="DEBUG")
628628

629-
if opt in ("-p", "--print"):
629+
if opt in {"-p", "--print"}:
630630
PrintGetRawWhoisResult = True
631631

632-
if opt in ("-j", "--json"):
632+
if opt in {"-j", "--json"}:
633633
PrintJson = True
634634

635-
if opt in ("-T", "--Testing"):
635+
if opt in {"-T", "--Testing"}:
636636
# print out all names of tld where we have _test
637637
TestAllTld = True
638638
rr = makeTestAllCurrentTld(None)
639639
for item in sorted(rr):
640640
print(item)
641641
sys.exit(0)
642642

643-
if opt in ("-t", "--test"):
643+
if opt in {"-t", "--test"}:
644644
# collect all _test entries defined and only run those,
645645
# o not run the default meta.tld
646646
TestAllTld = True
647647
TestRunOnly = True
648648

649-
if opt in ("-R", "--Ruleset"):
649+
if opt in {"-R", "--Ruleset"}:
650650
Ruleset = True
651651

652-
if opt in ("-D", "--Directory"):
652+
if opt in {"-D", "--Directory"}:
653653
directory = arg
654654
isDir = pathlib.Path(directory).is_dir()
655655
if isDir is False:
656656
print(f"{directory} cannot be found or is not a directory", file=sys.stderr)
657657
sys.exit(101)
658658

659-
if opt in ("-C", "--Cleanup"):
659+
if opt in {"-C", "--Cleanup"}:
660660
inFile = arg
661661
isFile = pathlib.Path(arg).is_file()
662662
if isFile is False:
@@ -668,7 +668,7 @@ def main() -> None: # noqa: C901,PLR0915
668668
rc.printMe()
669669
sys.exit(0)
670670

671-
if opt in ("-f", "--file"):
671+
if opt in {"-f", "--file"}: # a set
672672
filename = arg
673673
isFile = pathlib.Path(filename).is_file()
674674
if isFile is False:
@@ -679,7 +679,7 @@ def main() -> None: # noqa: C901,PLR0915
679679
files.append(filename)
680680
TestAllTld = False
681681

682-
if opt in ("-d", "--domain"):
682+
if opt in {"-d", "--domain"}: # set
683683
domain = arg
684684
if domain not in domains:
685685
domains.append(domain)

whoisdomain/whoisCliInterface.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def _tryInstallMissingWhoisOnWindows(cls) -> None:
4343
msg = f"downloading dependencies: {copy_command}"
4444
log.debug(msg)
4545

46-
subprocess.call(
46+
subprocess.call( # noqa: S602 # `subprocess` call with `shell=True` identified, security issue
4747
copy_command,
4848
stdout=subprocess.PIPE,
4949
stderr=subprocess.STDOUT,
@@ -100,7 +100,7 @@ def _postProcessingResult(self) -> str:
100100
msg = f"{self.rawWhoisResultString}"
101101
log.debug(msg)
102102

103-
if self.pc.ignore_returncode is False and self.processHandle.returncode not in [0, 1]:
103+
if self.pc.ignore_returncode is False and self.processHandle.returncode not in {0, 1}:
104104
if "fgets: Connection reset by peer" in self.rawWhoisResultString:
105105
return self.rawWhoisResultString.replace("fgets: Connection reset by peer", "")
106106

0 commit comments

Comments
 (0)