Skip to content

Commit 1cd55ef

Browse files
authored
Turn on pony-lint (#147)
Closes #145
1 parent a75d2d7 commit 1cd55ef

109 files changed

Lines changed: 4559 additions & 2473 deletions

File tree

Some content is hidden

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

.github/workflows/breakage-against-ponyc-latest.yml

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Test against ponyc nightly
1+
name: ponyc update breakage test
22

33
on:
44
repository_dispatch:
@@ -8,8 +8,29 @@ permissions:
88
packages: read
99

1010
jobs:
11-
vs-latest-ponyc:
12-
name: Verify main against the latest ponyc
11+
pony-lint:
12+
name: Lint against ponyc main
13+
runs-on: ubuntu-latest
14+
container:
15+
image: ghcr.io/ponylang/shared-docker-ci-standard-builder:nightly
16+
steps:
17+
- uses: actions/checkout@v6.0.2
18+
- name: Lint
19+
run: make lint
20+
- name: Send alert on failure
21+
if: ${{ failure() }}
22+
uses: zulip/github-actions-zulip/send-message@bd8ec52de371d139ae8313661b7d8318c19266aa
23+
with:
24+
api-key: ${{ secrets.ZULIP_SCHEDULED_JOB_FAILURE_API_KEY }}
25+
email: ${{ secrets.ZULIP_SCHEDULED_JOB_FAILURE_EMAIL }}
26+
organization-url: 'https://ponylang.zulipchat.com/'
27+
to: notifications
28+
type: stream
29+
topic: ${{ github.repository }} scheduled job failure
30+
content: ${{ github.server_url}}/${{ github.repository }}/actions/runs/${{ github.run_id }} failed.
31+
32+
vs-ponyc-latest:
33+
name: Test against ponyc main
1334
runs-on: ubuntu-latest
1435
container:
1536
image: ghcr.io/ponylang/shared-docker-ci-standard-builder-with-openssl-3.6.2:nightly

.github/workflows/pony-lint.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: pony-lint
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- '**/*.pony'
7+
8+
concurrency:
9+
group: pony-lint-${{ github.ref }}
10+
cancel-in-progress: true
11+
12+
permissions:
13+
packages: read
14+
15+
jobs:
16+
pony-lint:
17+
name: Lint Pony source
18+
runs-on: ubuntu-latest
19+
container:
20+
image: ghcr.io/ponylang/shared-docker-ci-standard-builder:release
21+
steps:
22+
- uses: actions/checkout@v6.0.2
23+
- name: Lint
24+
run: make lint

.release-notes/next-release.md

Lines changed: 46 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,48 @@
1-
## Update to work with Pony 0.69.1
1+
## Require Pony 0.69.1
22

3-
Pony 0.69.1 is the new minimum required version.
3+
Pony 0.69.1 is the new minimum required version. The `json` standard library package renamed its types from `Json*` to `JSON*` in this release, and all public types in this library have been updated to match.
4+
5+
## Rename Json to JSON in public type names
6+
7+
All public types that had `Json` in their name now use `JSON` to follow Pony's acronym casing convention. This affects every converter primitive, the two paginated converter classes, and `LinkedJSONRequester`.
8+
9+
Before:
10+
11+
```pony
12+
let converter = RepositoryJsonConverter
13+
```
14+
15+
After:
16+
17+
```pony
18+
let converter = RepositoryJSONConverter
19+
```
20+
21+
The full list of renamed types:
22+
23+
- `AssetJsonConverter``AssetJSONConverter`
24+
- `CommitJsonConverter``CommitJSONConverter`
25+
- `CommitFileJsonConverter``CommitFileJSONConverter`
26+
- `GistJsonConverter``GistJSONConverter`
27+
- `GistChangeStatusJsonConverter``GistChangeStatusJSONConverter`
28+
- `GistCommentJsonConverter``GistCommentJSONConverter`
29+
- `GistCommitJsonConverter``GistCommitJSONConverter`
30+
- `GistFileJsonConverter``GistFileJSONConverter`
31+
- `GitCommitJsonConverter``GitCommitJSONConverter`
32+
- `GitPersonJsonConverter``GitPersonJSONConverter`
33+
- `IssueJsonConverter``IssueJSONConverter`
34+
- `IssueCommentJsonConverter``IssueCommentJSONConverter`
35+
- `IssueCommentsJsonConverter``IssueCommentsJSONConverter`
36+
- `IssuePullRequestJsonConverter``IssuePullRequestJSONConverter`
37+
- `LabelJsonConverter``LabelJSONConverter`
38+
- `LicenseJsonConverter``LicenseJSONConverter`
39+
- `PullRequestJsonConverter``PullRequestJSONConverter`
40+
- `PullRequestBaseJsonConverter``PullRequestBaseJSONConverter`
41+
- `PullRequestFilesJsonConverter``PullRequestFilesJSONConverter`
42+
- `ReleaseJsonConverter``ReleaseJSONConverter`
43+
- `RepositoryJsonConverter``RepositoryJSONConverter`
44+
- `UserJsonConverter``UserJSONConverter`
45+
- `PaginatedListJsonConverter``PaginatedListJSONConverter`
46+
- `PaginatedSearchJsonConverter``PaginatedSearchJSONConverter`
47+
- `LinkedJsonRequester``LinkedJSONRequester`
448

AGENTS.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,15 @@ make unit-tests ssl=3.0.x # unit tests only
3636
make test-one t=TestName ssl=3.0.x # run a single test by name
3737
make examples ssl=3.0.x # build examples only
3838
make config=debug ssl=3.0.x # debug build
39+
make lint # run pony-lint (no ssl= needed)
3940
make clean # clean build artifacts + corral deps
4041
```
4142

4243
`ssl=` is required on every build and test target, set to your installed TLS library: `3.0.x` or `1.1.x`. `make` runs `corral fetch` before compiling.
4344

4445
## Architecture
4546

46-
Every API operation returns `Promise[(T | RequestError)]`. An operation primitive (for example `GetRepository`) builds the URL by RFC 6570 template expansion (`ponylang/uri`), then hands off to a short-lived request actor — `JsonRequester`, `NoContentRequester`, or `CheckRequester` in the `request/` subpackage — that owns a `courier` HTTP connection; the response is turned into a model by a `JsonConverter[T]`, and the promise is fulfilled with the model or a `RequestError`. Paginated results come back as `PaginatedList[A]`, whose `prev_page()`/`next_page()` fetch through `LinkedJsonRequester`, following the HTTP `Link` header (parsed by `ponylang/web_link`).
47+
Every API operation returns `Promise[(T | RequestError)]`. An operation primitive (for example `GetRepository`) builds the URL by RFC 6570 template expansion (`ponylang/uri`), then hands off to a short-lived request actor — `JSONRequester`, `NoContentRequester`, or `CheckRequester` in the `request/` subpackage — that owns a `courier` HTTP connection; the response is turned into a model by a `JSONConverter[T]`, and the promise is fulfilled with the model or a `RequestError`. Paginated results come back as `PaginatedList[A]`, whose `prev_page()`/`next_page()` fetch through `LinkedJSONRequester`, following the HTTP `Link` header (parsed by `ponylang/web_link`).
4748

4849
The `request/` subpackage is self-contained HTTP infrastructure — it imports nothing from the parent package.
4950

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ All notable changes to this project will be documented in this file. This projec
1212

1313
### Changed
1414

15-
- Update to work with Pony 0.69.1 ([PR #146](https://github.com/ponylang/github_rest_api/pull/146))
15+
- Require Pony 0.69.1 ([PR #146](https://github.com/ponylang/github_rest_api/pull/146))
16+
- Rename Json to JSON in public type names ([PR #147](https://github.com/ponylang/github_rest_api/pull/147))
1617

1718
## [0.8.0] - 2026-08-07
1819

Makefile

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ GET_DEPENDENCIES_WITH := corral fetch
55
CLEAN_DEPENDENCIES_WITH := corral clean
66
COMPILE_WITH := corral run -- ponyc
77
BUILD_DOCS_WITH := corral run -- pony-doc
8+
LINT_WITH := corral run -- pony-lint
89

910
BUILD_DIR ?= build/$(config)
1011
SRC_DIR := $(PACKAGE)
@@ -24,7 +25,7 @@ else
2425
PONYC = $(COMPILE_WITH) --debug
2526
endif
2627

27-
ifeq (,$(filter $(MAKECMDGOALS),clean docs realclean TAGS))
28+
ifeq (,$(filter $(MAKECMDGOALS),clean docs lint realclean TAGS))
2829
ifeq ($(ssl), 3.0.x)
2930
SSL = -Dopenssl_3.0.x
3031
else ifeq ($(ssl), 1.1.x)
@@ -66,6 +67,10 @@ _build_examples: $(EXAMPLES_BINARIES)
6667
$(EXAMPLES_BINARIES): $(BUILD_DIR)/%: $(SOURCE_FILES) $(EXAMPLES_SOURCE_FILES) | $(BUILD_DIR)
6768
BUILD_DIR=$(mkfile_path)$(BUILD_DIR) $(MAKE) -C $(EXAMPLES_DIR)/$*
6869

70+
lint:
71+
$(GET_DEPENDENCIES_WITH)
72+
$(LINT_WITH) .
73+
6974
clean:
7075
$(CLEAN_DEPENDENCIES_WITH)
7176
rm -rf $(BUILD_DIR)
@@ -85,4 +90,4 @@ all: test
8590
$(BUILD_DIR):
8691
mkdir -p $(BUILD_DIR)
8792

88-
.PHONY: all examples _build_examples clean fetch TAGS test test-one
93+
.PHONY: all examples _build_examples clean fetch lint TAGS test test-one

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,19 +23,19 @@ Additional API surface and functionality will be added as needed. If you need fu
2323
```pony
2424
use "github_rest_api"
2525
use "github_rest_api/request"
26-
use "net"
26+
use lori = "lori"
2727
2828
actor Main
2929
new create(env: Env) =>
30-
let auth = TCPConnectAuth(env.root)
30+
let auth = lori.TCPConnectAuth(env.root)
3131
let creds = Credentials(auth, "your-github-token")
3232
3333
GitHub(creds).get_repo("ponylang", "ponyc")
3434
.next[None](PrintRepository~apply(env.out))
3535
3636
primitive PrintRepository
3737
fun apply(out: OutStream, result: RepositoryOrError) =>
38-
match result
38+
match \exhaustive\ result
3939
| let repo: Repository =>
4040
out.print(repo.full_name)
4141
| let err: RequestError =>
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
"""
2+
Demonstrates creating a GitHub gist using the GitHub object convenience
3+
method.
4+
"""

examples/create-gist-oo/main.pony

Lines changed: 41 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -6,53 +6,66 @@ use lori = "lori"
66
actor Main
77
new create(env: Env) =>
88
try
9-
// ----- CLI setup
109
let cs =
11-
CommandSpec.leaf("create-gist-oo",
10+
CommandSpec.leaf(
11+
"create-gist-oo",
1212
"Create a new gist with a single file",
1313
[
14-
OptionSpec.string("filename", "Name of the file to create")
15-
OptionSpec.string("content", "Content of the file")
16-
OptionSpec.string("description",
14+
OptionSpec.string(
15+
"filename",
16+
"Name of the file to create")
17+
OptionSpec.string(
18+
"content",
19+
"Content of the file")
20+
OptionSpec.string(
21+
"description",
1722
"Description of the gist"
1823
where default' = "")
19-
OptionSpec.bool("public",
24+
OptionSpec.bool(
25+
"public",
2026
"Whether the gist should be public"
2127
where default' = false)
22-
OptionSpec.string("token", "GitHub personal access token")
28+
OptionSpec.string(
29+
"token",
30+
"GitHub personal access token")
2331
]
2432
)? .> add_help()?
2533

26-
let cmd = match \exhaustive\ CommandParser(cs).parse(env.args, env.vars)
27-
| let c: Command =>
28-
c
29-
| let ch: CommandHelp =>
30-
ch.print_help(env.out)
31-
return
32-
| let se: SyntaxError =>
33-
env.err.print(se.string())
34-
env.exitcode(1)
35-
return
36-
end
34+
let cmd =
35+
match \exhaustive\ CommandParser(cs).parse(
36+
env.args, env.vars)
37+
| let c: Command =>
38+
c
39+
| let ch: CommandHelp =>
40+
ch.print_help(env.out)
41+
return
42+
| let se: SyntaxError =>
43+
env.err.print(se.string())
44+
env.exitcode(1)
45+
return
46+
end
3747

3848
let filename = cmd.option("filename").string()
3949
let content = cmd.option("content").string()
4050
let description = cmd.option("description").string()
4151
let is_public = cmd.option("public").bool()
4252
let token = cmd.option("token").string()
4353

44-
// ----- Create gist
4554
let auth = lori.TCPConnectAuth(env.root)
4655
let creds = Credentials(auth, token)
4756

48-
let files = recover val
49-
let f = Array[(String, String)]
50-
f.push((filename, content))
51-
f
52-
end
57+
let files =
58+
recover val
59+
Array[(String, String)]
60+
.> push((filename, content))
61+
end
5362

5463
let desc: (String | None) =
55-
if description.size() > 0 then description else None end
64+
if description.size() > 0 then
65+
description
66+
else
67+
None
68+
end
5669

5770
GitHub(creds).create_gist(files, desc, is_public)
5871
.next[None](PrintGist~apply(env.out))
@@ -61,6 +74,9 @@ actor Main
6174
end
6275

6376
primitive PrintGist
77+
"""
78+
Prints gist details to the given output stream.
79+
"""
6480
fun apply(out: OutStream, g: GistOrError) =>
6581
match \exhaustive\ g
6682
| let gist: Gist =>
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
"""
2+
Demonstrates creating a GitHub gist using the CreateGist operation.
3+
"""

0 commit comments

Comments
 (0)