Skip to content

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

@AbdullahHendy

Description

@AbdullahHendy

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions