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

[Merged by Bors] - Restructure lint lists in boa_ast #2433

Closed
wants to merge 2 commits into from
Closed

Conversation

raskad
Copy link
Member

@raskad raskad commented Nov 14, 2022

This Pull Request restructures the lint deny/warn/allow lists in boa_ast and fixes some clippy lints in the crate.
The most relevant change should be in boa_ast/src/lib.rs. I went trough all the lints that are available in rustc/rustdoc/clippy with the goal to have most in the deny list, either trough groups or individually. Some clippy lints remain allowed, because they trigger false positives (I fixed them as far as possible).

I'm interested in how everyone feels about denying most lints, as it may impact individual development workflows. If we agree on how we want to structure this, I will apply the restructured lists to all other creates aswell.

@raskad raskad added the Internal Category for changelog label Nov 14, 2022
@raskad raskad added this to the v0.17.0 milestone Nov 14, 2022
@github-actions
Copy link

github-actions bot commented Nov 14, 2022

Test262 conformance changes

Test result main count PR count difference
Total 93,811 93,811 0
Passed 69,562 69,562 0
Ignored 18,414 18,414 0
Failed 5,835 5,835 0
Panics 0 0 0
Conformance 74.15% 74.15% 0.00%

@codecov
Copy link

codecov bot commented Nov 14, 2022

Codecov Report

Merging #2433 (9b793d6) into main (98e6dd3) will decrease coverage by 13.54%.
The diff coverage is 13.87%.

❗ Current head 9b793d6 differs from pull request most recent head 9ca70b1. Consider uploading reports for the commit 9ca70b1 to get more accurate results

@@             Coverage Diff             @@
##             main    #2433       +/-   ##
===========================================
- Coverage   52.41%   38.86%   -13.55%     
===========================================
  Files         329      316       -13     
  Lines       34945    24099    -10846     
===========================================
- Hits        18315     9367     -8948     
+ Misses      16630    14732     -1898     
Impacted Files Coverage Δ
boa_ast/src/expression/await.rs 36.36% <0.00%> (-30.31%) ⬇️
boa_ast/src/expression/call.rs 33.33% <0.00%> (-11.41%) ⬇️
boa_ast/src/expression/identifier.rs 11.76% <0.00%> (-77.13%) ⬇️
boa_ast/src/expression/literal/array.rs 19.44% <0.00%> (-16.04%) ⬇️
boa_ast/src/expression/literal/object.rs 18.18% <0.00%> (-6.53%) ⬇️
boa_ast/src/expression/literal/template.rs 9.67% <0.00%> (-29.72%) ⬇️
boa_ast/src/expression/operator/assign/mod.rs 42.55% <0.00%> (-28.88%) ⬇️
boa_ast/src/expression/operator/assign/op.rs 75.00% <0.00%> (-25.00%) ⬇️
boa_ast/src/expression/operator/binary/mod.rs 66.66% <0.00%> (-19.70%) ⬇️
boa_ast/src/expression/operator/conditional.rs 54.16% <0.00%> (-29.84%) ⬇️
... and 364 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@jedel1043
Copy link
Member

jedel1043 commented Nov 14, 2022

The one lint I'd argue that should be warn is missing_docs. It is very tedious having to add documentation for a prototype that could very well be deleted in the next prototype iteration. (Though, I'm guilty of adding it to the ast crate on the full documentation PR I did and forgetting to move it to warn after the fact haha)

The other lints I don't have a problem with, but let's see what the others say :)

Copy link
Member

@HalidOdat HalidOdat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, I agree with @jedel1043 about missing_docs being warn, I't can be quite bothersome.

Besides that this looks good :)

EDIT: Having a CI task that checks this (and other annoying to prototype lints) would be nice, that way we enforce only documented code to be pushed to main branch, what do you think?

@Razican
Copy link
Member

Razican commented Nov 14, 2022

I'm OK to put missing_docs as a warning, but then we should forbid warnings in the CI.

Copy link
Member

@Razican Razican left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the change :) this looks very good. We should probably apply it to all the crates in the engine.

Also, as I mentioned, I would deny warnings in the CI.

boa_ast/src/function/class.rs Show resolved Hide resolved
boa_ast/src/function/class.rs Show resolved Hide resolved
@RageKnify
Copy link
Member

To deny warnings in CI I think we just need to add the RUSTFLAGS environment variable.
Can look at rust-analyzer's setup and copy it:
https://github.com/rust-lang/rust-analyzer/blob/45ec315e01dc8dd1146dfeb65f0ef6e5c2efed78/.github/workflows/ci.yaml#L12-L17

I definitely feel that this should be simplified, having 50 lines selecting which lints to allow or deny copied among all our crates isn't very clean. Looking at the clippy documentation it says that configuring clippy through a clippy.toml file is unstable, so I'm not sure that there is a way to have the same config be available to all crates.

@Razican
Copy link
Member

Razican commented Nov 14, 2022

We would need to copy the same configuration for now, and add the RUSTFLAGS, yes

@raskad
Copy link
Member Author

raskad commented Nov 14, 2022

I think coppying the lint list is okay for now. I will add missing_docs to RUSTFLAGS as soon as I am done with all the other crates, as it will be enforced for all crates in the ci.

@jasonwilliams
Copy link
Member

I'm OK to put missing_docs as a warning, but then we should forbid warnings in the CI.

+1 to this
And yeah it sounds like copying the lint list is the best option for today. Do we need to chase up on clippy.toml? Is there an alternative if they're getting rid of it?

@RageKnify
Copy link
Member

I don't believe there is any alternative @jasonwilliams and it's not that they are necessarily going to deprecate it but they say that they might do so in the future.

@raskad
Copy link
Member Author

raskad commented Nov 16, 2022

Do we want to merge this as is based on the discussion?

@Razican
Copy link
Member

Razican commented Nov 17, 2022

Bors r+

bors bot pushed a commit that referenced this pull request Nov 17, 2022
This Pull Request restructures the lint deny/warn/allow lists in `boa_ast` and fixes some clippy lints in the crate.
The most relevant change should be in `boa_ast/src/lib.rs`. I went trough all the lints that are available in rustc/rustdoc/clippy with the goal to have most in the deny list, either trough groups or individually. Some clippy lints remain allowed, because they trigger false positives (I fixed them as far as possible).

I'm interested in how everyone feels about denying most lints, as it may impact individual development workflows. If we agree on how we want to structure this, I will apply the restructured lists to all other creates aswell.
@bors
Copy link

bors bot commented Nov 17, 2022

Pull request successfully merged into main.

Build succeeded:

@bors bors bot changed the title Restructure lint lists in boa_ast [Merged by Bors] - Restructure lint lists in boa_ast Nov 17, 2022
@bors bors bot closed this Nov 17, 2022
@bors bors bot deleted the ast_clippy branch November 17, 2022 07:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Internal Category for changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants