Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a lint for missing no_main #1976

Closed
ascjones opened this issue Nov 7, 2023 · 0 comments · Fixed by #2001
Closed

Add a lint for missing no_main #1976

ascjones opened this issue Nov 7, 2023 · 0 comments · Fixed by #2001
Assignees
Labels
A-linter Issue regarding the ink! linter. B-feature-request A request for a new feature.

Comments

@ascjones
Copy link
Collaborator

ascjones commented Nov 7, 2023

Since use-ink/cargo-contract#1076 we require contracts to be annotated with a no_mainouter attribute. We added a feature in cargo_contract to check for the error use-ink/cargo-contract#1113, but it involves some brittle code to intercept and redirect the stderr output of cargo-contract in order to catch the specific error.

If it is possible to check for attributes, it would be preferable to do this as a lint.

@jubnzv jubnzv added B-feature-request A request for a new feature. A-linter Issue regarding the ink! linter. labels Nov 7, 2023
@jubnzv jubnzv self-assigned this Nov 10, 2023
jubnzv added a commit to jubnzv/ink that referenced this issue Nov 11, 2023
@jubnzv jubnzv mentioned this issue Nov 20, 2023
5 tasks
jubnzv added a commit to jubnzv/cargo-contract that referenced this issue Nov 28, 2023
dylint-based ink! linting rules become mandatory, because we can check
ink! compilation errors with them (see
use-ink/ink#1976)
jubnzv added a commit that referenced this issue Nov 28, 2023
* feat(linter): Add `no_main` lint

Closes #1976

* feat(lint): Run lint only for onchain compilation targets

Otherwise contracts could be built for e2e tests with the `std` feature.

* chore(lint): Linting message

* chore(lint): Remove the `fail` test

All the tests are built locally for the host architecture, therefore the
lint is not applied to them.

* chore: Add CHANGELOG entry

* fix: Remove fail test from Cargo.toml

* fix(lint): Comments, lint message

* fix(lint): Run `no_main` on e2e tests

* fix: fmt

* fix: bless tests after fmt fix
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-linter Issue regarding the ink! linter. B-feature-request A request for a new feature.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants