Skip to content

Commit 6520331

Browse files
authored
Revert "feat: add ruff linter with ci check (#1178)" (#1181)
This reverts commit a2c424a.
1 parent a2c424a commit 6520331

File tree

9 files changed

+74
-241
lines changed

9 files changed

+74
-241
lines changed

.github/workflows/ci.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@ jobs:
2727
2828
readarray -t changed_files <<<"$(jq -r '.[]' <<<'${{ steps.files.outputs.added_modified }}')"
2929
~/go/bin/editorconfig-checker ${changed_files[@]}
30-
- name: Lint and format Python with Ruff
31-
uses: astral-sh/ruff-action@v1
3230
3331
typo:
3432
runs-on: ubuntu-latest

tests/conftest.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,30 +4,26 @@
44
import pytest
55
from helper import TempRepository
66

7-
8-
def create_repo(dirname=None):
7+
def create_repo(dirname = None):
98
repo = TempRepository(dirname)
109
tmp_file_a = repo.create_tmp_file()
1110
tmp_file_b = repo.create_tmp_file()
1211
repo.switch_cwd_under_repo()
1312
return repo
1413

15-
1614
def init_repo_git_status(repo):
1715
git = repo.get_repo_git()
1816
git.add(".")
1917
git.config("--local", "user.name", "test")
2018
git.config("--local", "user.email", "[email protected]")
2119
git.commit("-m", "chore: initial commit")
2220

23-
2421
@pytest.fixture(scope="module")
2522
def temp_repo():
2623
repo = create_repo()
2724
init_repo_git_status(repo)
2825
return repo
2926

30-
3127
@pytest.fixture(scope="module")
3228
def named_temp_repo(request):
3329
dirname = request.param

tests/helper.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,15 @@
1010
GITLAB_ORIGIN = "https://gitlab.com/tj/git-extras.git"
1111
BITBUCKET_ORIGIN = "https://bitbucket.org/tj/git-extras.git"
1212

13-
1413
class TempRepository:
15-
def __init__(self, repo_work_dir=None):
14+
def __init__(self, repo_work_dir = None):
1615
self._system_tmpdir = tempfile.gettempdir()
1716
if repo_work_dir == None:
1817
repo_work_dir = tempfile.mkdtemp()
1918
else:
2019
repo_work_dir = os.path.join(self._system_tmpdir, repo_work_dir)
2120
self._cwd = repo_work_dir
22-
self._tempdirname = self._cwd[len(self._system_tmpdir) + 1 :]
21+
self._tempdirname = self._cwd[len(self._system_tmpdir) + 1:]
2322
self._git_repo = Repo.init(repo_work_dir, b="default")
2423
self._files = []
2524
self.change_origin_to_github()
@@ -51,7 +50,7 @@ def create_tmp_dir(self):
5150
tmp_dir = tempfile.mkdtemp()
5251
return tmp_dir
5352

54-
def create_tmp_file(self, temp_dir=None):
53+
def create_tmp_file(self, temp_dir = None):
5554
if temp_dir == None:
5655
temp_dir = self._cwd
5756

@@ -87,9 +86,8 @@ def invoke_installed_extras_command(self, name, *params):
8786
origin_extras_command = os.path.join(GIT_EXTRAS_BIN, command_name)
8887
temp_extras_command = os.path.join(self._cwd, command_name)
8988
helpers = [
90-
os.path.join(GIT_EXTRAS_HELPER, "git-extra-utility"),
91-
os.path.join(GIT_EXTRAS_HELPER, "is-git-repo"),
92-
]
89+
os.path.join(GIT_EXTRAS_HELPER, "git-extra-utility"),
90+
os.path.join(GIT_EXTRAS_HELPER, "is-git-repo")]
9391

9492
if not os.path.exists(temp_extras_command):
9593
whole = []
@@ -108,7 +106,7 @@ def invoke_installed_extras_command(self, name, *params):
108106
os.chmod(temp_extras_command, 0o775)
109107

110108
script = [temp_extras_command, *params]
111-
print(f'Run the script "{script}"')
109+
print(f"Run the script \"{script}\"")
112110
return subprocess.run(script, capture_output=True)
113111

114112
def change_origin(self, origin_url):

tests/pyproject.toml

Lines changed: 0 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -21,66 +21,3 @@ testpaths = ["."]
2121
[build-system]
2222
requires = ["poetry-core"]
2323
build-backend = "poetry.core.masonry.api"
24-
25-
[tool.ruff]
26-
# Exclude a variety of commonly ignored directories.
27-
exclude = [
28-
".bzr",
29-
".direnv",
30-
".eggs",
31-
".git",
32-
".git-rewrite",
33-
".hg",
34-
".ipynb_checkpoints",
35-
".mypy_cache",
36-
".nox",
37-
".pants.d",
38-
".pyenv",
39-
".pytest_cache",
40-
".pytype",
41-
".ruff_cache",
42-
".svn",
43-
".tox",
44-
".venv",
45-
".vscode",
46-
"__pypackages__",
47-
"_build",
48-
"buck-out",
49-
"build",
50-
"dist",
51-
"node_modules",
52-
"site-packages",
53-
"venv",
54-
]
55-
56-
# Same as Black.
57-
line-length = 88
58-
indent-width = 4
59-
60-
# Assume Python 3.9
61-
target-version = "py39"
62-
63-
[tool.ruff.lint]
64-
# Enable Pyflakes (`F`) and a subset of the pycodestyle (`E`) codes by default.
65-
select = ["E4", "E7", "E9", "F"]
66-
ignore = []
67-
68-
# Allow fix for all enabled rules (when `--fix`) is provided.
69-
fixable = ["ALL"]
70-
unfixable = []
71-
72-
# Allow unused variables when underscore-prefixed.
73-
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
74-
75-
[tool.ruff.format]
76-
# Like Black, use double quotes for strings.
77-
quote-style = "double"
78-
79-
# Like Black, indent with spaces, rather than tabs.
80-
indent-style = "space"
81-
82-
# Like Black, respect magic trailing commas.
83-
skip-magic-trailing-comma = false
84-
85-
# Like Black, automatically detect the appropriate line ending.
86-
line-ending = "auto"

tests/test_git_abort.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
from git import GitCommandError
22

3-
43
class TestGitAbort:
54
def test_init(self, temp_repo):
65
git = temp_repo.get_repo_git()

tests/test_git_archive_file.py

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import os, pytest
22

3-
43
class TestGitArchiveFile:
54
def test_init(self, temp_repo):
65
git = temp_repo.get_repo_git()
@@ -17,17 +16,14 @@ def test_archive_file_on_tags_branch(self, temp_repo):
1716
filename = "{0}.{1}.zip".format(temp_repo.get_repo_dirname(), git.describe())
1817
assert filename in os.listdir()
1918

20-
def test_archive_file_on_any_not_tags_branch_without_default_branch(
21-
self, temp_repo
22-
):
19+
def test_archive_file_on_any_not_tags_branch_without_default_branch(self, temp_repo):
2320
git = temp_repo.get_repo_git()
2421
git.checkout("-b", "not-tags-branch")
2522
temp_repo.invoke_installed_extras_command("archive-file")
2623
filename = "{0}.{1}.{2}.zip".format(
27-
temp_repo.get_repo_dirname(),
28-
git.describe("--always", "--long"),
29-
"not-tags-branch",
30-
)
24+
temp_repo.get_repo_dirname(),
25+
git.describe("--always", "--long"),
26+
"not-tags-branch")
3127
assert filename in os.listdir()
3228

3329
def test_archive_file_on_any_not_tags_branch_with_default_branch(self, temp_repo):
@@ -36,28 +32,28 @@ def test_archive_file_on_any_not_tags_branch_with_default_branch(self, temp_repo
3632
git.config("git-extras.default-branch", "default")
3733
temp_repo.invoke_installed_extras_command("archive-file")
3834
filename = "{0}.{1}.zip".format(
39-
temp_repo.get_repo_dirname(), git.describe("--always", "--long")
40-
)
35+
temp_repo.get_repo_dirname(),
36+
git.describe("--always", "--long"))
4137
assert filename in os.listdir()
4238

4339
def test_archive_file_on_branch_name_has_slash(self, temp_repo):
4440
git = temp_repo.get_repo_git()
4541
git.checkout("-b", "feature/slash")
4642
temp_repo.invoke_installed_extras_command("archive-file")
4743
filename = "{0}.{1}.{2}.zip".format(
48-
temp_repo.get_repo_dirname(),
49-
git.describe("--always", "--long"),
50-
"feature-slash",
51-
)
44+
temp_repo.get_repo_dirname(),
45+
git.describe("--always", "--long"),
46+
"feature-slash")
5247
assert filename in os.listdir()
5348

5449
@pytest.mark.parametrize("named_temp_repo", ["backslash\\dir"], indirect=True)
5550
def test_archive_file_on_dirname_has_backslash(self, named_temp_repo):
5651
named_temp_repo.invoke_installed_extras_command("archive-file")
5752
git = named_temp_repo.get_repo_git()
5853
filename = "{0}.{1}.{2}.zip".format(
59-
"backslash-dir", git.describe("--always", "--long"), "default"
60-
)
54+
"backslash-dir",
55+
git.describe("--always", "--long"),
56+
"default")
6157
assert filename in os.listdir()
6258

6359
def test_archive_file_on_tag_name_has_slash(self, temp_repo):
@@ -69,6 +65,6 @@ def test_archive_file_on_tag_name_has_slash(self, temp_repo):
6965
temp_repo.invoke_installed_extras_command("archive-file")
7066
description_include_version = git.describe("--always", "--long")
7167
filename = "{0}.{1}.zip".format(
72-
temp_repo.get_repo_dirname(), description_include_version.replace("/", "-")
73-
)
68+
temp_repo.get_repo_dirname(),
69+
description_include_version.replace("/", "-"))
7470
assert filename in os.listdir()

tests/test_git_authors.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
import os, subprocess
22

3-
expected_authors_list = (
4-
"test <[email protected]>\ntestagain <[email protected]>\n"
5-
)
3+
expected_authors_list = "test <[email protected]>\ntestagain <[email protected]>\n"
64
expected_authors_list_without_email = "test\ntestagain\n"
75
authors_file = "AUTHORS"
86

9-
107
class TestGitAuthors:
118
def test_init(self, temp_repo):
129
git = temp_repo.get_repo_git()

0 commit comments

Comments
 (0)