Skip to content

Commit e9f3bf2

Browse files
committed
fix: SonarCloud issues - use constants, fix forgeable context
1 parent dbf4631 commit e9f3bf2

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

.github/workflows/automerge.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ permissions:
1111
jobs:
1212
automerge:
1313
runs-on: ubuntu-latest
14-
if: github.actor == 'dependabot[bot]'
14+
if: github.event.pull_request.user.login == 'dependabot[bot]'
1515
steps:
1616
- name: Enable auto-merge for Dependabot PRs
1717
run: gh pr merge --auto --squash "$PR_URL"

tests/conftest.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@
1111
PROJECT_ROOT = Path(__file__).parent.parent
1212
SRC_DIR = PROJECT_ROOT / "src"
1313

14+
# Constants for ignore file names
15+
GITIGNORE = ".gitignore"
16+
TREEMAPPERIGNORE = ".treemapperignore"
17+
1418

1519
# --- Фикстура для создания временного проекта ---
1620
@pytest.fixture
@@ -26,8 +30,8 @@ def temp_project(tmp_path):
2630
(temp_dir / "output").mkdir()
2731
(temp_dir / ".git").mkdir()
2832
(temp_dir / ".git" / "config").write_text("git config file", encoding="utf-8")
29-
(temp_dir / ".gitignore").write_text("*.pyc\n__pycache__/\n", encoding="utf-8")
30-
(temp_dir / ".treemapperignore").write_text("output/\n.git/\n", encoding="utf-8")
33+
(temp_dir / GITIGNORE).write_text("*.pyc\n__pycache__/\n", encoding="utf-8")
34+
(temp_dir / TREEMAPPERIGNORE).write_text("output/\n.git/\n", encoding="utf-8")
3135
yield temp_dir
3236

3337

@@ -181,13 +185,13 @@ def add_dir(self, path: str) -> Path:
181185
return dir_path
182186

183187
def add_gitignore(self, patterns: List[str], subdir: str = "") -> Path:
184-
path = self.root / subdir / ".gitignore" if subdir else self.root / ".gitignore"
188+
path = self.root / subdir / GITIGNORE if subdir else self.root / GITIGNORE
185189
path.parent.mkdir(parents=True, exist_ok=True)
186190
path.write_text("\n".join(patterns) + "\n", encoding="utf-8")
187191
return path
188192

189193
def add_treemapperignore(self, patterns: List[str]) -> Path:
190-
path = self.root / ".treemapperignore"
194+
path = self.root / TREEMAPPERIGNORE
191195
path.write_text("\n".join(patterns) + "\n", encoding="utf-8")
192196
return path
193197

0 commit comments

Comments
 (0)