Skip to content

Commit af6b760

Browse files
committed
Add test project for ni-python-styleguide errors
1 parent 36f9be5 commit af6b760

File tree

8 files changed

+667
-2
lines changed

8 files changed

+667
-2
lines changed

.github/test_projects/minimal/pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[project]
2-
name = "test-project"
2+
name = "minimal"
33
version = "0.1.0"
4-
description = ""
4+
description = "Tests actions/analyze-project with a minimal project that has no errors"
55
authors = [
66
{name = "Joel Dixon",email = "[email protected]"}
77
]

.github/test_projects/ni-python-styleguide-errors/README.md

Whitespace-only changes.

.github/test_projects/ni-python-styleguide-errors/poetry.lock

Lines changed: 613 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
[project]
2+
name = "ni-python-styleguide-errors"
3+
version = "0.1.0"
4+
description = "Tests actions/analyze-project with a project that has ni-python-styleguide errors"
5+
authors = [
6+
{name = "Joel Dixon",email = "[email protected]"}
7+
]
8+
readme = "README.md"
9+
requires-python = ">=3.9,<4.0"
10+
dynamic = ["dependencies"]
11+
12+
[tool.poetry]
13+
packages = [{include = "test_project", from = "src"}]
14+
15+
[tool.poetry.group.lint.dependencies]
16+
ni-python-styleguide = ">=0.4.1"
17+
mypy = ">=1.0"
18+
pyright = { version = ">=1.1.400", extras = ["nodejs"] }
19+
20+
[tool.mypy]
21+
mypy_path = "."
22+
files = "."
23+
namespace_packages = true
24+
strict = true
25+
explicit_package_bases = true
26+
27+
[tool.pyright]
28+
include = ["src/", "tests/"]
29+
30+
[build-system]
31+
requires = ["poetry-core>=2.0.0,<3.0.0"]
32+
build-backend = "poetry.core.masonry.api"
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"""Docstring required."""
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import os, sys # Multiple imports on one line (E401)
2+
3+
def foo( x: int , y: int ) -> int: # Spaces around parameters (E211, E251)
4+
print( "Hello, world!" ) # Unnecessary spaces inside parentheses (E201, E202)
5+
return x+y # Missing whitespace around operator (E225)
6+
7+
foo(1,2)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"""Module docstring."""

.github/workflows/test_actions.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,8 +230,19 @@ jobs:
230230
uses: ./setup-poetry
231231
- name: Analyze Python Project
232232
uses: ./analyze-project
233+
id: minimal
233234
with:
234235
project-directory: ${{ github.workspace }}/.github/test_projects/minimal
236+
- name: Analyze Python Project
237+
uses: ./analyze-project
238+
id: ni-python-styleguide-errors
239+
with:
240+
project-directory: ${{ github.workspace }}/.github/test_projects/ni-python-styleguide-errors
241+
- name: Error if the previous step didn't fail
242+
if: steps.ni-python-styleguide-errors.outcome != 'failure'
243+
run: |
244+
echo "::error title=Test Failure::The previous step did not fail as expected."
245+
exit 1
235246
236247
# This job is intended to combine the test results so we don't have to list
237248
# each matrix combination in the required status check settings. There are a

0 commit comments

Comments
 (0)