typst / typst/package-check

Flag to return Exit Code 0 on Warnings (Nice to Have)

Open
#29 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
36
Forks
9
Avg merge
1h 46m
Merged PRs (30d)
1

Description

What

It would be nice to have a --ignore-warnings flag, or even better, something like python's ruff linter config file

Why

My clickworthy-resume dev repo has Test flow that runs using tytanic

[abdullah@abdullahs clickworthy-resume]$ tree -L 3
.
├── LICENSE
├── Makefile
├── README.md
├── src
│   ├── cover-letter.typ
│   ├── lib.typ
│   └── resume-cv.typ
├── template
│   ├── assets
│   │   └── publications.bib
│   ├── cover-letter.typ
│   ├── cv.typ
│   └── resume.typ
├── tests
│   ├── cover-letter
│   │   ├── diff
│   │   ├── out
│   │   ├── ref
│   │   └── test.typ
│   ├── cv
│   │   ├── diff
│   │   ├── out
│   │   ├── ref
│   │   └── test.typ
│   └── resume
│       ├── diff
│       ├── out
│       ├── ref
│       └── test.typ
├── thumbnail.png
└── typst.toml

17 directories, 15 files

In each test.typ, I am importing my source code using relative paths to make it easier to test without having to install the package locally every time a change is introduced. It makes sense to me for the test to import using relative paths.

Now running typst-package-check check returns a exit code (2) warning not an exit code (1) error (which is nice) but still fails

[abdullah@abdullahs clickworthy-resume]$ typst-package-check check
warning: This import should use the package specification, not a relative path.
  ┌─ tests/resume/test.typ:1:1
  │
1 │ #import "../../src/lib.typ": *
  │  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: This import should use the package specification, not a relative path.
  ┌─ tests/cv/test.typ:1:1
  │
1 │ #import "../../src/lib.typ": *
  │  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: This import should use the package specification, not a relative path.
  ┌─ tests/cover-letter/test.typ:1:1
  │
1 │ #import "../../src/lib.typ": *
  │  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

[abdullah@abdullahs clickworthy-resume]$ echo $?
2

It would be nice to have --ignore-warnings or such to return exit code 0 for no error results.

Work Around

For now, since warning only outputs result in an exit code 2, i do typst-package-check check || [ $? -eq 2 ] which results in exit code 0

[abdullah@abdullahs clickworthy-resume]$ typst-package-check check || [ $? -eq 2 ]
warning: This import should use the package specification, not a relative path.
  ┌─ tests/resume/test.typ:1:1
  │
1 │ #import "../../src/lib.typ": *
  │  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: This import should use the package specification, not a relative path.
  ┌─ tests/cv/test.typ:1:1
  │
1 │ #import "../../src/lib.typ": *
  │  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: This import should use the package specification, not a relative path.
  ┌─ tests/cover-letter/test.typ:1:1
  │
1 │ #import "../../src/lib.typ": *
  │  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

[abdullah@abdullahs clickworthy-resume]$ echo $?
0

Discussion/Opinion

Please feel free to share

  • if my intuition to import relative paths in tests/ is not the best way.
  • if there are better ways to go about this whole thing

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start from the typst-package-check check command and trace how warning-only results are converted into exit code 2. Decide whether the completed behavior should be an --ignore-warnings flag or configuration support, then add coverage showing warnings can return 0 while errors remain nonzero.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.