Skip to content
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

mycy / CI only #451

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 6 additions & 2 deletions .trunk/trunk.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: 0.1

Check failure on line 1 in .trunk/trunk.yaml

View check run for this annotation

Trunk-Staging.io / Trunk Check

prettier

Incorrect formatting, autoformat by running 'trunk fmt'

# version used for local trunk runs and testing
cli:
Expand All @@ -19,16 +19,20 @@

lint:
# enabled linters inherited from github.com/trunk-io/configs plugin
enabled: []

enabled:
- mypy@1.5.1
disabled:
- pylint # pylint diagnostics are too strict


ignore:
- linters: [ALL]
paths:
- "**/test_data" # required for golangci-lint, which runs on directories
- "**/test_data/**"
- linters: [mypy]
paths:
- "**/test_data/autopep8/**"

actions:
definitions:
Expand Down
43 changes: 41 additions & 2 deletions linters/mypy/plugin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,26 @@ lint:
- name: mypy
files: [python, python-interface]
commands:
- name: lint
# - name: lint
# # Custom parser type defined in the trunk cli to handle mypy's output.
# output: mypy
# run:
# mypy --ignore-missing-imports --follow-imports=silent --show-error-codes
# --show-column-numbers ${target}
# success_codes: [0, 1]
# stdin: false
- name: lint-ci
# Custom parser type defined in the trunk cli to handle mypy's output.
output: mypy
run:
mypy --ignore-missing-imports --follow-imports=silent --show-error-codes
--show-column-numbers ${target}
--show-column-numbers ${workspace}
success_codes: [0, 1]
stdin: false
target: ${root_or_parent_with(file_that_will_never_exist)}
run_when: [ci]
runtime: python
package: mypy
tools: [mypy]
direct_configs:
- mypy.ini
Expand All @@ -32,3 +44,30 @@ lint:
version_command:
parse_regex: ${semver}
run: mypy --version
# - name: mypy-all
# files: [python]
# commands:
# - name: lint
# # Custom parser type defined in the trunk cli to handle mypy's output.
# output: mypy
# run:
# mypy --ignore-missing-imports --follow-imports=silent --show-error-codes
# --show-column-numbers
# success_codes: [0, 1]
# stdin: false
# target: ${root_or_parent_with(file_that_will_never_exist)}
# runtime: python
# package: mypy
# run_when: [ci, cli]
# direct_configs:
# - mypy.ini
# - .mypy.ini
# affects_cache:
# - pyproject.toml
# - setup.cfg
# is_recommended: false
# issue_url_format: https://mypy.readthedocs.io/en/stable/error_code_list.html
# known_good_version: 0.931
# version_command:
# parse_regex: ${semver}
# run: mypy --version
2 changes: 2 additions & 0 deletions linters/mypy/test_data/a.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
def double(value: str) -> str:
return value + value
5 changes: 5 additions & 0 deletions linters/mypy/test_data/b.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from .a import double


def triple(value: int) -> int:
return double(value) + value