Skip to content

Commit 6842bff

Browse files
Merge branch 'develop' into fix-broken-links
2 parents 215c3cd + b89cf71 commit 6842bff

File tree

144 files changed

+48
-40
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

144 files changed

+48
-40
lines changed

.circleci/config.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,14 +75,14 @@ commands:
7575
steps:
7676
- restore_cache:
7777
keys:
78-
- v1-verified-codemod-repos-{{ checksum "tests/verified_codemods/codemod_data/repo_commits.json" }}-{{.Environment.CIRCLE_NODE_INDEX}}-{{.Environment.CIRCLE_NODE_TOTAL}}
78+
- v1-verified-codemod-repos-{{ checksum "tests/integration/verified_codemods/codemod_data/repo_commits.json" }}-{{.Environment.CIRCLE_NODE_INDEX}}-{{.Environment.CIRCLE_NODE_TOTAL}}
7979
- run:
8080
command: |
8181
uv run --frozen gs codemod clone-repos --verified-codemod-repos --token ${CODEGEN_BOT_GHE_TOKEN}
8282
- save_cache:
8383
paths:
8484
- $GITHUB_WORKSPACE
85-
key: v1-verified-codemod-repos-{{ checksum "tests/verified_codemods/codemod_data/repo_commits.json" }}-{{.Environment.CIRCLE_NODE_INDEX}}-{{.Environment.CIRCLE_NODE_TOTAL}}
85+
key: v1-verified-codemod-repos-{{ checksum "tests/integration/verified_codemods/codemod_data/repo_commits.json" }}-{{.Environment.CIRCLE_NODE_INDEX}}-{{.Environment.CIRCLE_NODE_TOTAL}}
8686
build-wheels:
8787
parameters:
8888
base_packages:
@@ -237,7 +237,7 @@ jobs:
237237
- fetch-verified-codemods
238238
- cache-verified-codemod-repos
239239
- run_ats:
240-
default_tests: "tests/codemod/test_verified_codemods.py"
240+
default_tests: "tests/integration/codemod/test_verified_codemods.py"
241241
codecov_flags: "smart-tests-codemod"
242242
collect_args: --cli-api-key ${PROD_CLI_API_KEY} --token ${CODEGEN_BOT_GHE_TOKEN}
243243
ats_collect_args: --cli-api-key=${PROD_CLI_API_KEY},--token=${CODEGEN_BOT_GHE_TOKEN},
@@ -264,7 +264,7 @@ jobs:
264264
- clone-repos:
265265
extra_repos: false
266266
- run_ats:
267-
default_tests: "tests/codemod/test_codemods.py"
267+
default_tests: "tests/integration/codemod/test_codemods.py"
268268
codecov_flags: "smart-tests-codemod-oss"
269269
collect_args: --size=<<parameters.size>> --sync-graph=<<parameters.sync_graph>> --token ${CODEGEN_BOT_GHE_TOKEN}
270270
ats_collect_args: --size=<<parameters.size>>,--sync-graph=<<parameters.sync_graph>>,--token=${CODEGEN_BOT_GHE_TOKEN},
@@ -297,7 +297,7 @@ jobs:
297297
if [ "<<parameters.extra_repos>>" = "true" ]; then
298298
EXTRA_REPOS_ARG="--extra-repos=true"
299299
fi
300-
PYTEST_ARGS="${EXTRA_REPOS_ARG} --token ${CODEGEN_BOT_GHE_TOKEN} -o junit_suite_name=\"${CIRCLE_JOB}\" tests/codemod/test_parse.py"
300+
PYTEST_ARGS="${EXTRA_REPOS_ARG} --token ${CODEGEN_BOT_GHE_TOKEN} -o junit_suite_name=\"${CIRCLE_JOB}\" tests/integration/codemod/test_parse.py"
301301
echo "Running tests with args: $PYTEST_ARGS"
302302
TESTS_TO_RUN=$(PYTEST_ARGS=${PYTEST_ARGS} ./.circleci/collect.sh)
303303
echo $TESTS_TO_RUN | circleci tests run --command "ulimit -s unlimited; xargs uv run --frozen pytest -n auto ${PYTEST_ARGS}"

.gitattributes

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
**/expected_diff.txt filter=lfs diff=lfs merge=lfs -text
2-
tests/codemod/repos/extra/*.json filter=lfs diff=lfs merge=lfs -text
2+
tests/integration/codemod/repos/extra/*.json filter=lfs diff=lfs merge=lfs -text
33
**/expected_diff.patch filter=lfs diff=lfs merge=lfs -text
4-
tests/codemod/repos/repos.json filter=lfs diff=lfs merge=lfs -text
5-
tests/verified_codemods/** filter=lfs diff=lfs merge=lfs -text
4+
tests/integration/codemod/repos/repos.json filter=lfs diff=lfs merge=lfs -text
5+
tests/integration/verified_codemods/** filter=lfs diff=lfs merge=lfs -text
66
.github/disallowed-words.txt filter=lfs diff=lfs merge=lfs -text

.github/disallowed-words.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
version https://git-lfs.github.com/spec/v1
2-
oid sha256:ac0b7be00533f882fb174c498c27372fa78d3ec2d65c0e885475bf92b43b7303
3-
size 337
2+
oid sha256:c47fe11113256de71968b186bd459732c5f29547b9a57275f671502e9ebd8327
3+
size 328

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,5 +63,5 @@ uv-*.tar.gz
6363
graph-sitter-types/out/**
6464
graph-sitter-types/typings/**
6565
coverage.json
66-
tests/verified_codemods/codemod_data/repo_commits.json
66+
tests/integration/verified_codemods/codemod_data/repo_commits.json
6767

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ repos:
1919
hooks:
2020
- id: biome-check
2121
additional_dependencies: ["@biomejs/[email protected]"]
22-
exclude: (src/codemods/eval)|(tests/unit/codegen/sdk/skills)|(tests/unit/output)|(tests/verified_codemods)|(docs/samples)
22+
exclude: (src/codemods/eval)|(tests/unit/codegen/sdk/skills)|(tests/unit/codegen/sdk/output)|(tests/integration/verified_codemods)|(docs/samples)
2323

2424
- repo: https://github.com/MarcoGorelli/cython-lint
2525
rev: v0.16.6

CLA.md

Lines changed: 16 additions & 16 deletions

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,7 @@ pythonVersion = "3.12"
196196
enableExperimentalFeatures = true
197197
[tool.pytest.ini_options]
198198
# addopts = -v
199+
pythonpath = "."
199200
norecursedirs = "repos expected"
200201
# addopts = -v --cov=app --cov-report=term
201202

src/codegen/git/clients/github_client.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ class GithubClient:
2525
@classmethod
2626
def from_repo_config(cls, repo_config: RepoConfig) -> Self:
2727
gh_wrapper = cls()
28-
gh_wrapper.read_client = gh_wrapper._create_client_for_repo(repo_config)
29-
gh_wrapper._write_client = gh_wrapper._create_client_for_repo(repo_config)
28+
gh_wrapper.read_client = gh_wrapper._create_client_for_repo(repo_config, github_scope=GithubScope.READ)
29+
gh_wrapper._write_client = gh_wrapper._create_client_for_repo(repo_config, github_scope=GithubScope.WRITE)
3030
return gh_wrapper
3131

3232
@classmethod
@@ -37,8 +37,8 @@ def from_token(cls, token: str | None = None) -> Self:
3737
gh_wrapper._write_client = Github(token, base_url=cls.base_url)
3838
return gh_wrapper
3939

40-
def _create_client_for_repo(self, repo_config: RepoConfig) -> Github:
41-
token = get_token_for_repo_config(repo_config=repo_config, github_type=self.type)
40+
def _create_client_for_repo(self, repo_config: RepoConfig, github_scope: GithubScope = GithubScope.READ) -> Github:
41+
token = get_token_for_repo_config(repo_config=repo_config, github_type=self.type, github_scope=github_scope)
4242
return Github(token, base_url=self.base_url)
4343

4444
def _get_client_for_scope(self, github_scope: GithubScope) -> Github:

src/codegen/git/configs/token.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
11
import logging
22

33
from codegen.git.configs.config import config
4-
from codegen.git.schemas.github import GithubType
4+
from codegen.git.schemas.github import GithubScope, GithubType
55
from codegen.git.schemas.repo_config import RepoConfig
66

77
logger = logging.getLogger(__name__)
88

99

10-
def get_token_for_repo_config(repo_config: RepoConfig, github_type: GithubType = GithubType.GithubEnterprise) -> str:
11-
# TODO: implement config such that we can retrieve tokens for different repos
10+
def get_token_for_repo_config(
11+
repo_config: RepoConfig,
12+
github_type: GithubType = GithubType.GithubEnterprise,
13+
github_scope: GithubScope = GithubScope.READ,
14+
) -> str:
15+
# TODO: implement config such that we can retrieve tokens for different repos + read/write scopes
1216
if github_type == GithubType.GithubEnterprise:
1317
return config.LOWSIDE_TOKEN
1418
elif github_type == GithubType.Github:

0 commit comments

Comments
 (0)