Repository navigation
Exclude lock files #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
234571f
Exclude lock and install files
EChebelyon 1149b0e
Exclude lock and install files in workflow
EChebelyon b137248
Update documentation and template
EChebelyon a99f39b
quoted paths were being skipped
EChebelyon 8331e82
Add terraform lock file to excluded files
EChebelyon cbfb8a4
replace handwrittedn decoder with regex plus codecs
EChebelyon d5bd91a
remove _paths_from_git_line() for brevity
EChebelyon b0c6a6d
propoer tests packaging
EChebelyon 8b0e620
use uv instead of pip
EChebelyon File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 was deleted.
Oops, something went wrong.
This file contains hidden or 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 hidden or 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,17 @@ | ||
| [project] | ||
| name = "fraymio-github" | ||
| version = "0.1.0" | ||
| description = "Org-wide GitHub tooling for fraymio (AI PR review, stale PR report)" | ||
| requires-python = ">=3.12" | ||
| dependencies = [ | ||
| "requests>=2.31", | ||
| ] | ||
|
|
||
| [dependency-groups] | ||
| dev = [ | ||
| "pytest>=8", | ||
| ] | ||
|
|
||
| [tool.uv] | ||
| # Scripts, not an installable package. | ||
| package = false |
This file contains hidden or 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,13 @@ | ||
| [pytest] | ||
| markers = | ||
| int: integration tests skipped by default, (only evaluate with 'pytest --int') | ||
| e2e: end to end tests skipped by default, (only evaluate with 'pytest --e2e') | ||
|
|
||
| testpaths = | ||
| tests | ||
|
|
||
| # Lets tests `import review` without packaging pr_review/. | ||
| pythonpath = | ||
| pr_review | ||
|
|
||
| addopts = -ra --strict-markers --strict-config |
This file contains hidden or 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,71 @@ | ||
| import os | ||
| import shutil | ||
| import subprocess | ||
| from pathlib import Path | ||
|
|
||
| import pytest | ||
|
|
||
|
|
||
| def pytest_addoption(parser): | ||
| parser.addoption( | ||
| "--e2e", | ||
| action="store_true", | ||
| help="also run end to end tests (marked @pytest.mark.e2e)", | ||
| ) | ||
| parser.addoption( | ||
| "--int", | ||
| action="store_true", | ||
| help="also run integration tests (marked @pytest.mark.int)", | ||
| ) | ||
|
|
||
|
|
||
| def pytest_runtest_setup(item): | ||
| if "e2e" in item.keywords and not item.config.getoption("--e2e"): | ||
| pytest.skip("need --e2e option to run this test") | ||
| if "int" in item.keywords and not item.config.getoption("--int"): | ||
| pytest.skip("need --int option to run this test") | ||
|
|
||
|
|
||
| @pytest.fixture(autouse=True) | ||
| def _clean_env(monkeypatch): | ||
| """Keep the developer's shell env from leaking into review.py config.""" | ||
| for name in ("EXTRA_EXCLUDE", "OPENAI_MODEL", "REASONING_EFFORT", "DRY_RUN"): | ||
| monkeypatch.delenv(name, raising=False) | ||
|
|
||
|
|
||
| @pytest.fixture | ||
| def lock_patterns() -> list[str]: | ||
| return ["*.lock", "package-lock.json", "go.sum"] | ||
|
|
||
|
|
||
| class GitRepo: | ||
| def __init__(self, path: Path): | ||
| self.path = path | ||
|
|
||
| def git(self, *args: str) -> str: | ||
| return subprocess.run( | ||
| ["git", "-C", str(self.path), "-c", "core.quotePath=true", *args], | ||
| check=True, | ||
| capture_output=True, | ||
| text=True, | ||
| ).stdout | ||
|
|
||
| def write(self, rel: str, data: bytes = b"a\n") -> None: | ||
| p = self.path / rel | ||
| p.parent.mkdir(parents=True, exist_ok=True) | ||
| p.write_bytes(data) | ||
|
|
||
|
|
||
| @pytest.fixture | ||
| def git_repo(tmp_path, monkeypatch) -> GitRepo: | ||
| """An empty git repo, isolated from the user's global/system git config | ||
| (e.g. diff.noprefix or diff.mnemonicPrefix would change the headers).""" | ||
| if not shutil.which("git"): | ||
| pytest.skip("git not installed") | ||
| monkeypatch.setenv("GIT_CONFIG_GLOBAL", os.devnull) | ||
| monkeypatch.setenv("GIT_CONFIG_NOSYSTEM", "1") | ||
| repo = GitRepo(tmp_path) | ||
| repo.git("init", "-q") | ||
| repo.git("config", "user.email", "test@example.com") | ||
| repo.git("config", "user.name", "test") | ||
| return repo |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.