Repository navigation
Fix tests and add lint and test workflows #20
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 1 commit
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
256e808
Added urlopen version of safe_requests get
andrecsilva 4d097a5
Added test workflow and some linting
andrecsilva 3da62b4
Added pre-commit hooks + overall linting
andrecsilva 8fcdd88
Added test instructions for readme
andrecsilva 4cbc371
Removed nonexistent exclusions in pre-commit config
andrecsilva 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
Added test workflow and some linting
- Loading branch information
commit 4d097a509522669c496db8b45ceb66ded91617ea
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| name: Unit Tests | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - main | ||
| pull_request: | ||
| branches: | ||
| - main | ||
| merge-group: | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| build: | ||
| name: Build Package | ||
| runs-on: ubuntu-22.04 | ||
| timeout-minutes: 5 | ||
| steps: | ||
| - name: Check out code | ||
| uses: actions/checkout@v4 | ||
| - name: Set Up Python | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: '3.12' | ||
| cache: 'pip' | ||
| - name: Install build dependencies | ||
| run: pip install build twine | ||
| - name: Build package | ||
| run: python -m build . | ||
| - name: Twine Check | ||
| run: twine check dist/* | ||
| test: | ||
| name: Run pytest | ||
| runs-on: ubuntu-22.04 | ||
| timeout-minutes: 25 | ||
| strategy: | ||
| matrix: | ||
| python-version: ['3.10', '3.11', '3.12'] | ||
| steps: | ||
| - name: install netcat | ||
| run: apt update && apt install -y netcat | ||
| - name: make bash default shell | ||
| run: ln -sf /bin/bash /bin/sh | ||
| - name: Check out code | ||
| uses: actions/checkout@v4 | ||
| - name: Set Up Python | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: ${{ matrix.python-version }} | ||
| cache: 'pip' | ||
| - name: Install Codemodder Package | ||
| run: pip install . | ||
| - name: Install Dependencies | ||
| run: pip install -r dev_requirements.txt | ||
| - name: Run unit tests | ||
| run: pytest |
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 |
|---|---|---|
| @@ -1,13 +1,60 @@ | ||
| repos: | ||
| - repo: https://github.com/pre-commit/pre-commit-hooks | ||
| rev: v2.3.0 | ||
| rev: v4.6.0 | ||
| hooks: | ||
| - id: check-yaml | ||
| - id: check-json | ||
| - id: end-of-file-fixer | ||
| - id: trailing-whitespace | ||
| exclude: | | ||
| (?x)^( | ||
| src/core_codemods/docs/.*| | ||
| src/codemodder/dependency.py | | ||
| integration_tests/.*| | ||
| tests/.* | ||
| )$ | ||
| - id: check-added-large-files | ||
| exclude: | | ||
| (?x)^( | ||
| tests/samples/pygoat.semgrep.sarif.json | ||
| )$ | ||
| - repo: https://github.com/psf/black | ||
| rev: 23.3.0 | ||
| rev: 24.4.0 | ||
| hooks: | ||
| - id: black | ||
| exclude: | | ||
| (?x)^( | ||
| tests/samples/.*| | ||
| )$ | ||
| - repo: https://github.com/pre-commit/mirrors-mypy | ||
| rev: v1.9.0 | ||
| hooks: | ||
| - id: mypy | ||
| exclude: | | ||
| (?x)^( | ||
| tests/samples/.*| | ||
| integration_tests/.* | ||
| )$ | ||
| args: [--disable-error-code=has-type,--disable-error-code=import-not-found] | ||
| additional_dependencies: | ||
| [ | ||
| "types-jsonschema~=4.21.0", | ||
| "types-mock==5.0.*", | ||
| "types-PyYAML==6.0", | ||
| "types-toml~=0.10", | ||
| "types-requests~=2.13", | ||
| ] | ||
| - repo: https://github.com/astral-sh/ruff-pre-commit | ||
| rev: v0.3.7 | ||
| hooks: | ||
| - id: ruff | ||
| exclude: tests/samples/ | ||
| # todo: replace black with this? | ||
| # Run the formatter. | ||
| # - id: ruff-format | ||
| - repo: https://github.com/pycqa/isort | ||
| rev: 5.13.2 | ||
| hooks: | ||
| - id: isort | ||
| exclude: tests/samples/ | ||
| args: ["--profile", "black"] | ||
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you copied quite a bit of this and none of these locations exist in this repo, same for the other excludes, the mypy typing mocks that we may not be using