Comments (1)
Things have changed since I opened the original issue in June.
The good news is that Packwerk::Node.constant_name
(née #const_name
) is now aware of fully-qualified constant names:
>> Packwerk::Node.constant_name(Parser::CurrentRuby.parse('::HELLO'))
=> "::HELLO"
>> Packwerk::Node.constant_name(Parser::CurrentRuby.parse('HELLO'))
=> "HELLO"
The bad news is that ParsedConstantDefinitions#collect_local_definitions
doesn’t know what to do with this:
>> definitions = Packwerk::ParsedConstantDefinitions.new(
root_node: Parser::CurrentRuby.parse('module Sales; ::HELLO = "World"; end')
)
=> #<Packwerk::ParsedConstantDefinitions
@local_definitions=
{"::Sales"=>#<struct Packwerk::Node::Location line=1, column=7>,
"::Sales::::HELLO"=>#<struct Packwerk::Node::Location line=1, column=16>}>
>> definitions.local_reference?('HELLO')
=> false # should be true
>> definitions.local_reference?('Sales::HELLO')
=> false # correct, but for the wrong reason
You can see that @local_definitions
now contains an erroneous entry for ::Sales::::HELLO
, formed by naively joining 'Sales'
and '::HELLO'
with '::'
. We still have no test coverage for this so it’s not affecting the build, but it’s obviously wrong behaviour that will bite anyone who tries to use fully-qualified constants.
from packwerk.
Related Issues (20)
- Error when parsing `Foo::Bar = -> {}` HOT 2
- How do you deal with specs? HOT 13
- [Bug Report] `Errno::ENOENT: No such file or directory @ rb_sysopen - tmp/cache/packwerk/inflections` (issue with cache) HOT 1
- Packwerk doesn't support custom root namespaces for root directories in the load path HOT 5
- Dependency violation not detected when using public folders for privacy boundary HOT 9
- Declare a specific constant as a Dependency HOT 3
- Any way of warning when extraneous dependencies exist in a package.yml file? HOT 1
- NameError errror after running packwerk validate HOT 3
- Make packwerk work with in-repo engines using load_path aliases HOT 13
- [Bug Report] `packwerk validate` fails with uninitialized constant <Class:Packwerk::PackageSet>::Bundler
- [Bug Report] Crash on ERB containing multiple CDATA blocks HOT 7
- [Feature Request] Dependency graph introspection HOT 3
- [Bug Report] Dependency on full Rails is too broad HOT 1
- Mounting an engine raises violations HOT 2
- [Bug Report] Incompatibility with latest `zeitwerk` version (2.6.4) - undefined method `root_dirs` HOT 5
- Transitive Dependencies
- [Packwerk 3.0] Update UPGRADING.md with directions to upgrade to 3.0 HOT 1
- [Packwerk 3.0] Ensure API boundaries are up-to-date HOT 1
- [Bug Report] Syntax error when rendering two partials HOT 1
- [Bug Report] Runtime Error after running packwerk check HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from packwerk.