Skip to content

Commit 4be3369

Browse files
Update to follow our code standards more closely (#4)
* Added editorconfig based on that in nvaccess/nvda * lf instead of crlf * Add initial ruff configuration, based on that of NVDA * remove explicit inheritance from `object` * Initial run ov monkeytype over the code base * Remove inheritance from object * Fix a couple of type annotations * Rename and improve ruff.toml * Fix up type annotations by removing Optional, Union, Dict, List etc * Read certificates as binary * Move type hints into server.py * Fix logging * Fix ambiguous name * Fix some typing issues * Docstrings for channel * Docstrings for Handler * Docstrings for User * Docstrings for ServerState * Add some comments * Enable pyright, with all failing tests disabled * Fix reportDeprecated * Fix unannotated functions * Resolved several type issues * Move to pyproject.toml for ruff config * Remove no longer needed type stubs * Update pre-commit config for CI * Pre-commit updates * Remove pyrightCI and remove pyrightLocal alias * Experimental pyright GHA * Try using uvx to run pyright * Update deps * Try running with uv run * Sync environment then use uvx * Include dev * Use uv run * Apply suggestions from code review Co-authored-by: Sean Budd <[email protected]> * Update .github/workflows/pyright.yml Co-authored-by: Sean Budd <[email protected]> * Fix pyright error in server.py * Fix typ annotations on test.TestGenerateKey._test * Silence pyright errors caused by incorrect types in ttwisted/Zope interfaces * Bring coverage back up to 100% * camelCase variables, methods and attributes in server.Channel * camelCase attributes, methods and variables in server.Handler * camelCase attributes, methods and variables in server.User * camelCase attributes, methods and variables in server.RemoteServerFactory * camelCase attributes, methods and variables in server.ServerState * Fix some straggling snake_case * Minor sweeks * Try using a composite setup action for coverage * Add default shell to actions/setup-environment * run -> runs * Move shell to steps with runs * Use setup-environment with pyright ci * Add pyright output to GHA summary * Test restricting perms * Test restricting perms * Restrict perms of pyright action --------- Co-authored-by: Sean Budd <[email protected]>
1 parent 48f4019 commit 4be3369

File tree

7 files changed

+359
-176
lines changed

7 files changed

+359
-176
lines changed

.editorconfig

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
root = true
2+
3+
[*]
4+
end_of_line = lf
5+
insert_final_newline = true
6+
7+
[*.py]
8+
charset = utf-8
9+
indent_style = tab
10+
tab_width = 4
11+
trim_trailing_whitespace = true
12+
max_line_length = 110
13+
14+
[*.{yml,yaml}]
15+
indent_style = space
16+
charset = utf-8
17+
indent_size = 2
18+
trim_trailing_whitespace = true
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
name: 'Setup CI Environment'
2+
description: 'Setup the environment in which CI scripts for the NVDA Remote Access server can be run'
3+
4+
runs:
5+
using: "composite"
6+
steps:
7+
- name: Install the latest version of uv
8+
uses: astral-sh/[email protected]
9+
- name: Setup environment
10+
shell: bash
11+
run: uv sync --dev

.github/workflows/coverage.yml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,10 @@ jobs:
66
coverage:
77
name: Check coverage with coverage.py
88
runs-on: ubuntu-latest
9-
permissions:
10-
pull-requests: write
9+
permissions: {}
1110
steps:
1211
- uses: actions/[email protected]
13-
- name: Install the latest version of uv
14-
uses: astral-sh/[email protected]
15-
- name: Setup environment
16-
run: uv sync --dev
12+
- uses: ./.github/actions/setup-environment
1713
- name: Run unit tests
1814
run: uv run coverage run
1915
- name: Report coverage

.github/workflows/pyright.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Check types with Pyright
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
pull_request:
9+
branches:
10+
- main
11+
12+
jobs:
13+
pyright:
14+
name: Check types with pyright
15+
runs-on: ubuntu-latest
16+
permissions: {}
17+
steps:
18+
- uses: actions/[email protected]
19+
- uses: ./.github/actions/setup-environment
20+
- name: Run pyright
21+
run: uv run pyright >> $GITHUB_STEP_SUMMARY

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ reportOptionalMemberAccess = false
4949
# The following option causes problems due to dynamic member access
5050
reportUnknownArgumentType = false
5151

52+
5253
[tool.ruff]
5354
line-length = 110
5455

0 commit comments

Comments
 (0)