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

docs/Syntax.md is missing #1291

Closed
x3qt opened this issue Jan 10, 2018 · 19 comments
Closed

docs/Syntax.md is missing #1291

x3qt opened this issue Jan 10, 2018 · 19 comments
Labels

Comments

@x3qt
Copy link

x3qt commented Jan 10, 2018

Description:

Usage of do/end blocks with ensure/rescue/else throws syntax error which points to non existent page.

[14]:Syntax: This file has unexpected token kENSURE
[https://github.com/troessner/reek/blob/master/docs/Syntax.md]

Environment:

  • ruby 2.5.0
  • reek 4.7.3
@x3qt
Copy link
Author

x3qt commented Jan 10, 2018

It seems that bug was introduced in #1220

@mvz mvz added the defect label Jan 10, 2018
@mvz
Copy link
Collaborator

mvz commented Jan 10, 2018

Thanks, @x3qt, we'll look into this.

@chastell
Copy link
Collaborator

I think this is not as much a missing docs file as a case that shouldn’t get to the point of reporting smells, but rather blow up with a syntax error.

(In this particular case we’re using a Ruby 2.4 parser to parse a Ruby 2.5 source, and that’s the culprit, but in general I wouldn’t consider syntax errors as smells.)

@mvz
Copy link
Collaborator

mvz commented Jan 15, 2018

@chastell I think that makes sense since we handle encoding errors that way too.

@mvz
Copy link
Collaborator

mvz commented Jan 15, 2018

@troessner wdyt?

@troessner
Copy link
Owner

@mvz @chastell fully agree with you here.

@krasnoukhov
Copy link

FYI I'm seeing smells related to this check on codeclimate, but not locally. We're using the latest release version with Ruby 2.5

@troessner
Copy link
Owner

@krasnoukhov could you please c&p the offending code here so we can reproduce it?

@krasnoukhov
Copy link

@troessner Sure thing, I think a very minimal code that triggers the check could look like this:

[].each do |x|
  puts x
rescue
end

@troessner
Copy link
Owner

@krasnoukhov this should be fixed with Reek 5 which we'll also push on CodeClimate.

@mvz
Copy link
Collaborator

mvz commented Jun 20, 2018

@troessner Wait, what? We do the pushing to CodeClimate?

@troessner
Copy link
Owner

@mvz as discussed in the other thread recently we dont apparently :-/

@troessner
Copy link
Owner

@mvz wdyt about removing the syntax detector completely? Right now i cant even recall why we added that in the first place :)
I know its unrelated to the actual issue (that Reek blows up on innocuous code), but there's nothing keeping us from improving our error handling as well. As pointed out above, we probably should treat this like an EncodingError.

@troessner
Copy link
Owner

troessner commented Jun 21, 2018

To the actual problem, this code from above:

[].each do |x|
  puts x
rescue
end

works for me with Reek 4.8.1 and Ruby 2.3.1:

reek ~/Desktop/broken.rb
Inspecting 1 file(s):
.

Regarding:

(In this particular case we’re using a Ruby 2.4 parser to parse a Ruby 2.5 source, and that’s the culprit, but in general I wouldn’t consider syntax errors as smells.)

I just checked, we're using 2.5 at least now. @x3qt could you quickly check if that problem still exists for you with the latest Reek version?

@mvz
Copy link
Collaborator

mvz commented Jun 21, 2018

we probably should treat this like an EncodingError.

Yes, that makes more sense than treating it like an artificial code smell.

@mvz
Copy link
Collaborator

mvz commented Jun 24, 2018

See #1355 and #1356.

@mvz
Copy link
Collaborator

mvz commented Jun 24, 2018

@x3qt the syntax error should no longer occur in the latest Reek codeclimate engine. Removing the Syntax 'smell' is tracked in #1355.

@mvz mvz closed this as completed Jun 24, 2018
@troessner
Copy link
Owner

@mvz I'll probably be busy for quite a while with #1359 and #1362, if you'd like to take over #1355 feel free to do so, if not I'm fine with finishing this later ;)

@mvz
Copy link
Collaborator

mvz commented Jun 24, 2018

@troessner ok, I'll see about taking over #1355.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants