Comments (6)
Wow! Amazing catch!
I bet it has something to do with how ktn_dodger
parses that expression, but if it's treating that thing as an atom
that's super-weird.
from elvis_core.
Nope. ktn_dodger
correctly interprets that thing as a variable… there is something else going on 🤔
from elvis_core.
It's ktn_code:parse_tree/1
's fault… it turns Throw
into this weird thing…
[#{attrs =>
#{location => {9,5},text => "Throw",value => throw},
type => atom},
#{attrs =>
#{location => {9,5},name => 'Throw',text => "Throw"},
type => var},
#{attrs => #{location => {9,5},name => '_',text => "Throw"},
type => var}]
It's normalizing the rest of the pattern as throw:Throw:_
, but incorrectly using the text of the first element as the atom text.
Again… nice catch, @paulo-ferraz-oliveira!
from elvis_core.
This is where the bug appears:
elvis_core/src/elvis_style.erl
Line 751 in 19bfe9f
We should use value
instead of text
. But the change has to be done carefully because value
is an atom, not a string… and because we want to differentiate between enclosed and non-enclosed macros.
from elvis_core.
I'll try to look at it one of these days, if time allows.
from elvis_core.
Attempted fixing this with #216
Not sure if it's the best solution but it just handles these cases by using the value
attribute when it equals to throw
otherwise use text
attribute.
Found that just switching to use the text
attribute had issues as the values were dropping off the backslashes used to escape characters in the atom.
from elvis_core.
Related Issues (20)
- Unused Variable Names HOT 5
- no_match_in_condition reports a warning even when the condition includes a valid match
- Bug (?) in atom_naming_convention HOT 2
- Using ets:fun2ms without including ms_transform.hrl should be an error HOT 3
- New ruleset `gitignore`
- Propose `gen_server` et all "no-timeout" functions as `no_common_caveats`?
- Have a simple way to run `all` checks (even optional ones) HOT 8
- New rule: consistent file names HOT 2
- New Rule: No Import Type
- New Rule: Unsafe usage of application HOT 1
- Wildcards in no_call_functions MFA HOT 4
- Potential new rule: only call internal_export'ed functions from test code HOT 2
- No consecutive strings
- Rule: Do not use lists on start_link/3,4 and init/1 HOT 3
- no_successive_maps obsolete due to Erlang change?
- New rule: consistent deps applications HOT 3
- max_function_length counts multiple function clauses as a single function HOT 2
- Count `_to_atom` as common caveats? HOT 2
- Should `no_macros` consider `LOG_...` as allowed? HOT 3
- no_successive_maps doesn't work when nested
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 elvis_core.