Merge pull request #110 from Mic92/ci

switch to ruff from flake8
This commit is contained in:
Jörg Thalheim 2022-12-11 19:01:54 +00:00 committed by GitHub
commit a5b4db5610
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 31 additions and 41 deletions

View File

@ -11,8 +11,7 @@ python3.pkgs.buildPythonApplication rec {
checkInputs = [
python3.pkgs.pytest
python3.pkgs.black
python3.pkgs.flake8
python3.pkgs.isort
ruff
glibcLocales
mypy
# technically not a test input, but we need it for development in PATH
@ -21,13 +20,10 @@ python3.pkgs.buildPythonApplication rec {
checkPhase = ''
echo -e "\x1b[32m## run black\x1b[0m"
LC_ALL=en_US.utf-8 black --check . bin/nix-update
echo -e "\x1b[32m## run flake8\x1b[0m"
flake8 nix_update
echo -e "\x1b[32m## run ruff\x1b[0m"
ruff . bin/nix-update
echo -e "\x1b[32m## run mypy\x1b[0m"
mypy --no-warn-unused-ignores --strict nix_update tests
echo -e "\x1b[32m## run isort\x1b[0m"
isort . --check-only
'';
makeWrapperArgs = [
"--prefix PATH" ":" (lib.makeBinPath [ pkgs.nixVersions.stable or nix_2_4 nixpkgs-fmt nixpkgs-review ])

View File

@ -17,11 +17,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1670242877,
"narHash": "sha256-jBLh7dRHnbfvPPA9znOC6oQfKrCPJ0El8Zoe0BqnCjQ=",
"lastModified": 1670597555,
"narHash": "sha256-/k939P2S2246G6K5fyvC0U2IWvULhb4ZJg9K7ZxsX+k=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "6e51c97f1c849efdfd4f3b78a4870e6aa2da4198",
"rev": "2dea0f4c2d6e4603f54b2c56c22367e77869490c",
"type": "github"
},
"original": {

View File

@ -37,15 +37,15 @@ def replace_version(package: Package) -> bool:
def to_sri(hashstr: str) -> str:
if "-" in hashstr:
return hashstr
l = len(hashstr)
if l == 32:
length = len(hashstr)
if length == 32:
prefix = "md5:"
elif l == 40:
elif length == 40:
# could be also base32 == 32, but we ignore this case and hope no one is using it
prefix = "sha1:"
elif l == 64 or l == 52:
elif length == 64 or length == 52:
prefix = "sha256:"
elif l == 103 or l == 128:
elif length == 103 or length == 128:
prefix = "sha512:"
else:
return hashstr

20
pyproject.toml Normal file
View File

@ -0,0 +1,20 @@
[tool.ruff]
line-length = 88
select = ["E", "F", "I"]
ignore = [ "E501" ]
[tool.mypy]
python_version = "3.10"
warn_redundant_casts = true
disallow_untyped_calls = true
disallow_untyped_defs = true
no_implicit_optional = true
[[tool.mypy.overrides]]
module = "setuptools.*"
ignore_missing_imports = true
[[tool.mypy.overrides]]
module = "pytest.*"
ignore_missing_imports = true

View File

@ -40,29 +40,3 @@ metadata = true
restructuredtext = true
strict = true[wheel]
universal = 1
[isort]
profile=black
[pycodestyle]
max-line-length = 88
# E203 conflicts with black
ignore = E501,E741,W503,E203
[flake8]
max-line-length = 88
# E203 conflicts with black
ignore = E501,E741,W503,E203
exclude = .git,__pycache__,docs/source/conf.py,old,build,dist
[mypy]
warn_redundant_casts = true
disallow_untyped_calls = true
disallow_untyped_defs = true
no_implicit_optional = true
[mypy-setuptools.*]
ignore_missing_imports = True
[mypy-pytest.*]
ignore_missing_imports = True