Skip to content

Conversation

@quantimnot
Copy link
Contributor

@quantimnot quantimnot commented May 23, 2022

  • Symbols from foreign packages are now ignored.
  • Fixed styleCheck violations in compiler package.
  • Added symbol ownership to custom annotation pragmas.
  • Minor refactors to cleanup style check callsites.
  • Minor internal documentation of reasons why a symbol isn't checked.

Style violations were fixed in the compiler after thet were exposed by
the changes. The compiler wouldn't compile otherwise.

Symbol ownership for custom pragma annotations is needed for checking
the annotation's style. A NPE was raised otherwise.

Fixes #10201
See also nim-lang/RFCs#456

@quantimnot quantimnot marked this pull request as draft May 23, 2022 21:00
@quantimnot quantimnot force-pushed the pr_refactor_stylecheck branch from fb1ed5b to dc276eb Compare May 30, 2022 19:35
@quantimnot quantimnot marked this pull request as ready for review May 31, 2022 02:58
@quantimnot quantimnot force-pushed the pr_refactor_stylecheck branch from d5abd2d to 6ef9239 Compare June 4, 2022 05:38
@quantimnot quantimnot force-pushed the pr_refactor_stylecheck branch from 6ef9239 to c9cf925 Compare July 8, 2022 17:15
@quantimnot
Copy link
Contributor Author

This is ready for review.

* Symbols from foreign packages are now ignored.
* Fixed `styleCheck` violations in `compiler` package.
* Added symbol ownership to custom annotation pragmas.
* Minor refactors to cleanup style check callsites.
* Minor internal documentation of reasons why a symbol isn't checked.

Style violations were fixed in the compiler after thet were exposed by
the changes. The compiler wouldn't compile otherwise.

Symbol ownership for custom pragma annotations is needed for checking
the annotation's style. A NPE was raised otherwise.

Fixes nim-lang#10201
See also nim-lang/RFCs#456
I had refactored the callsites of `styleCheckUse` to apply the DRY
principle, but I misunderstood the field access handling in a template
as a general case. This corrects it.
The violations were exposed in CI when the compiler was built with
libffi.
@quantimnot quantimnot force-pushed the pr_refactor_stylecheck branch from a3f6458 to c5ad18e Compare July 13, 2022 17:35
@Araq
Copy link
Member

Araq commented Jul 14, 2022

Ping @arnetheduck. Does this need to be backported?

@Araq Araq merged commit 800cb00 into nim-lang:devel Jul 14, 2022
@github-actions
Copy link
Contributor

Thanks for your hard work on this PR!
The lines below are statistics of the Nim compiler built from 800cb00

Hint: mm: orc; threads: on; opt: speed; options: -d:release
163330 lines; 13.258s; 841.188MiB peakmem

@arnetheduck
Copy link
Contributor

Ping @arnetheduck. Does this need to be backported?

yes pls

@quantimnot quantimnot deleted the pr_refactor_stylecheck branch July 17, 2022 13:11
quantimnot added a commit to quantimnot/Nim that referenced this pull request Jul 26, 2022
refs nim-lang#19822

Fixes these bugs:

* Style check violations in generics defined in foreign packages are raised.
* Builtin pragma usage style check violations in foreign packages are raised.
* User pragma definition style check violations are not raised.
quantimnot added a commit to quantimnot/Nim that referenced this pull request Jul 26, 2022
refs nim-lang#19822

Fixes these bugs:

* Style check violations in generics defined in foreign packages are raised.
* Builtin pragma usage style check violations in foreign packages are raised.
* User pragma definition style check violations are not raised.
FedericoCeratto pushed a commit to FedericoCeratto/Nim that referenced this pull request Jul 30, 2022
* Change `styleCheck` to ignore foreign packages

* Symbols from foreign packages are now ignored.
* Fixed `styleCheck` violations in `compiler` package.
* Added symbol ownership to custom annotation pragmas.
* Minor refactors to cleanup style check callsites.
* Minor internal documentation of reasons why a symbol isn't checked.

Style violations were fixed in the compiler after thet were exposed by
the changes. The compiler wouldn't compile otherwise.

Symbol ownership for custom pragma annotations is needed for checking
the annotation's style. A NPE was raised otherwise.

Fixes nim-lang#10201
See also nim-lang/RFCs#456

* Fix a misunderstanding about excluding field style checks

I had refactored the callsites of `styleCheckUse` to apply the DRY
principle, but I misunderstood the field access handling in a template
as a general case. This corrects it.

* Fix some `styleCheck` violations in `compiler/evalffi`

The violations were exposed in CI when the compiler was built with
libffi.

* Removed some uneeded transitionary code

* Add changelog entry

Co-authored-by: quantimnot <[email protected]>
narimiran pushed a commit that referenced this pull request Aug 2, 2022
* Change `styleCheck` to ignore foreign packages

* Symbols from foreign packages are now ignored.
* Fixed `styleCheck` violations in `compiler` package.
* Added symbol ownership to custom annotation pragmas.
* Minor refactors to cleanup style check callsites.
* Minor internal documentation of reasons why a symbol isn't checked.

Style violations were fixed in the compiler after thet were exposed by
the changes. The compiler wouldn't compile otherwise.

Symbol ownership for custom pragma annotations is needed for checking
the annotation's style. A NPE was raised otherwise.

Fixes #10201
See also nim-lang/RFCs#456

* Fix a misunderstanding about excluding field style checks

I had refactored the callsites of `styleCheckUse` to apply the DRY
principle, but I misunderstood the field access handling in a template
as a general case. This corrects it.

* Fix some `styleCheck` violations in `compiler/evalffi`

The violations were exposed in CI when the compiler was built with
libffi.

* Removed some uneeded transitionary code

* Add changelog entry

Co-authored-by: quantimnot <[email protected]>
(cherry picked from commit 800cb00)
@omentic
Copy link
Contributor

omentic commented Aug 20, 2022

Sorry to necro this, but does "Symbols from foreign packages are now ignored" mean that inconsistent usages of imported symbols sneaks by? ex.

import std/os
discard fileExists("hello")
discard file_exists("hello") # inconsistency not noticed

@quantimnot
Copy link
Contributor Author

@J-James
You are correct. I hadn't considered that situation. I will make a new PR, or tack it onto #20095 since it hasn't been reviewed yet.

quantimnot added a commit to quantimnot/Nim that referenced this pull request Aug 25, 2022
refs nim-lang#19822

Fixes these bugs:

* Style check violations in generics defined in foreign packages are raised.
* Builtin pragma usage style check violations in foreign packages are raised.
* User pragma definition style check violations are not raised.
quantimnot added a commit to quantimnot/Nim that referenced this pull request Aug 25, 2022
Checking the style of foreign symbol usages was completely disabled by
PR nim-lang#19822. Now all style checks of a foreign symbol are checked against
the first time the symbol is used within a module.
quantimnot added a commit to quantimnot/Nim that referenced this pull request Sep 1, 2022
refs nim-lang#19822

Fixes these bugs:

* Style check violations in generics defined in foreign packages are raised.
* Builtin pragma usage style check violations in foreign packages are raised.
* User pragma definition style check violations are not raised.
quantimnot added a commit to quantimnot/Nim that referenced this pull request Sep 1, 2022
Checking the usage style of foreign symbols was completely disabled by
PR nim-lang#19822. Now, all usage styles of a foreign symbol are compared against
the style of its first use in the module.
quantimnot added a commit to quantimnot/Nim that referenced this pull request Sep 2, 2022
refs nim-lang#19822

Fixes these bugs:

* Style check violations in generics defined in foreign packages are raised.
* Builtin pragma usage style check violations in foreign packages are raised.
* User pragma definition style check violations are not raised.
quantimnot added a commit to quantimnot/Nim that referenced this pull request Sep 2, 2022
Checking the usage style of foreign symbols was completely disabled by
PR nim-lang#19822. Now, all usage styles of a foreign symbol are compared against
the style of its first use in the module.
capocasa pushed a commit to capocasa/Nim that referenced this pull request Mar 31, 2023
* Change `styleCheck` to ignore foreign packages

* Symbols from foreign packages are now ignored.
* Fixed `styleCheck` violations in `compiler` package.
* Added symbol ownership to custom annotation pragmas.
* Minor refactors to cleanup style check callsites.
* Minor internal documentation of reasons why a symbol isn't checked.

Style violations were fixed in the compiler after thet were exposed by
the changes. The compiler wouldn't compile otherwise.

Symbol ownership for custom pragma annotations is needed for checking
the annotation's style. A NPE was raised otherwise.

Fixes nim-lang#10201
See also nim-lang/RFCs#456

* Fix a misunderstanding about excluding field style checks

I had refactored the callsites of `styleCheckUse` to apply the DRY
principle, but I misunderstood the field access handling in a template
as a general case. This corrects it.

* Fix some `styleCheck` violations in `compiler/evalffi`

The violations were exposed in CI when the compiler was built with
libffi.

* Removed some uneeded transitionary code

* Add changelog entry

Co-authored-by: quantimnot <[email protected]>
quantimnot added a commit to quantimnot/Nim that referenced this pull request May 5, 2023
refs nim-lang#19822

Fixes these bugs:

* Style check violations in generics defined in foreign packages are raised.
* Builtin pragma usage style check violations in foreign packages are raised.
* User pragma definition style check violations are not raised.
Araq pushed a commit that referenced this pull request May 6, 2023
refs #19822

Fixes these bugs:

* Style check violations in generics defined in foreign packages are raised.
* Builtin pragma usage style check violations in foreign packages are raised.
* User pragma definition style check violations are not raised.

Co-authored-by: quantimnot <[email protected]>
capocasa pushed a commit to capocasa/Nim that referenced this pull request May 15, 2023
refs nim-lang#19822

Fixes these bugs:

* Style check violations in generics defined in foreign packages are raised.
* Builtin pragma usage style check violations in foreign packages are raised.
* User pragma definition style check violations are not raised.

Co-authored-by: quantimnot <[email protected]>
capocasa pushed a commit to capocasa/Nim that referenced this pull request May 16, 2023
refs nim-lang#19822

Fixes these bugs:

* Style check violations in generics defined in foreign packages are raised.
* Builtin pragma usage style check violations in foreign packages are raised.
* User pragma definition style check violations are not raised.

Co-authored-by: quantimnot <[email protected]>
narimiran pushed a commit that referenced this pull request Jun 15, 2023
refs #19822

Fixes these bugs:

* Style check violations in generics defined in foreign packages are raised.
* Builtin pragma usage style check violations in foreign packages are raised.
* User pragma definition style check violations are not raised.

Co-authored-by: quantimnot <[email protected]>
(cherry picked from commit 365a753)
narimiran pushed a commit that referenced this pull request Jun 15, 2023
refs #19822

Fixes these bugs:

* Style check violations in generics defined in foreign packages are raised.
* Builtin pragma usage style check violations in foreign packages are raised.
* User pragma definition style check violations are not raised.

Co-authored-by: quantimnot <[email protected]>
(cherry picked from commit 365a753)
narimiran pushed a commit that referenced this pull request Jun 15, 2023
refs #19822

Fixes these bugs:

* Style check violations in generics defined in foreign packages are raised.
* Builtin pragma usage style check violations in foreign packages are raised.
* User pragma definition style check violations are not raised.

Co-authored-by: quantimnot <[email protected]>
(cherry picked from commit 365a753)
bung87 pushed a commit to bung87/Nim that referenced this pull request Jul 29, 2023
refs nim-lang#19822

Fixes these bugs:

* Style check violations in generics defined in foreign packages are raised.
* Builtin pragma usage style check violations in foreign packages are raised.
* User pragma definition style check violations are not raised.

Co-authored-by: quantimnot <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[styleCheck] --styleCheck:error inconsistent with --styleCheck:hint : doesn't respect package boundaries

4 participants