[no-assignment-of-untracked-properties-used-in-tracking-contexts] False positive with constructors?
See original GitHub issueNot absolutely sure about that. I’m getting that warning for some assignments in a constructor. That is, I have a native JS class that uses @computed
in it and sets in the constructor some properties that are used in that @computed
… should this assignment be done via Ember.set
or is this a false-positive?
Issue Analytics
- State:
- Created 3 years ago
- Comments:9 (7 by maintainers)
Top Results From Across the Web
False positive S1172 for constructor parameter - Sonar
A false-positive is when an issue is raised unexpectedly on code that should not trigger an issue, or where the suggested action doesn't...
Read more >[no-useless-constructor] False positive on strictly-typed ...
constructors marked as protected / private (i.e. marking a constructor as non-public),. This rule is literally not working as expected ♂️ ...
Read more >1136086 - clang's - Monorail
Issue 1136086 : clang's -Wglobal-constructors has a lot of false-positives. Reported by schedule agrieve@chromium.org agrieve@chromium.org.
Read more >squid:S2221: False Positives for constructors - Google Groups
This works fine for methods, but it produces false-positives for constructors. Assume the following class: class ExceptionThrower {
Read more >Constructor Description | F-Secure Labs
Constructor, Virtools. Summary. A Constructor is a malware creation toolkit that allows users with little technical knowledge to ... (a False Positive)? ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I am assuming you are talking about this example:
Using
set
in the constructor seems like a good thing to do for consistency, given that we should be usingset
when modifying this property anywhere else in the file.But is it actually required to use
set
for this property in the constructor? Probably not? So I’d be open to any of these changes to the rule:ignoreConstructors
option (default true).ignoreConstructors
option (default false).@rwjblue @pzuraq @mongoose700 thoughts?
Hmm! I’m a big fan of the consistency argument. It’s confusing to use
set
in some places but assignment in other places for the same property. So perhaps enforcing consistency even ifset
isn’t needed in the constructor is actually a feature and not a bug.