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

Adding last line class with one-liner check #67

Closed
wants to merge 1 commit into from

Conversation

prpetten
Copy link

@prpetten prpetten commented Sep 18, 2016

This commit fixes #66

  • Wrote failing test under describe 'analyzing 1 line methods' do ... block
  • Fixed one line method definition counts, by fixing the underlying issue in the SandiMeter::Analyzer#last_line method.
  • Refactored internals of SandiMeter::Analyzer#last_line into its own class with corresponding specs and documentation.
  • Added attr_reader for file_lines instance variable
  • Added .idea/ to .gitignore for Rubymine usage during development
  • Added 2.2, 2.3, and gem install bundler -v 1.13.1 to .travis.yml for completeness and to fix issue with TravisCI and jruby-head not having bundler installed
  • Added minor version dependency to json gem at ~> 1.8.3 as 2.0.0 and higher require ruby to be at 2.0 or higher, which was causing build at 1.9.3 to fail.

@prpetten prpetten force-pushed the one-line-method-fix branch 4 times, most recently from 133c753 to 471a0a1 Compare September 18, 2016 08:26
@prpetten
Copy link
Author

Not sure why TravisCI didn't update status, but here is the latest build.

@roooodcastro
Copy link

I'm having the same issue, and this PR seems to fix it. @makaroni4 please review this

@roooodcastro
Copy link

I created a fork for me of your branch, but I noticed that there's still an issue:

At line 26 of the last_line.rb file, the method determine_last_line returns nil if the method is a oneliner. This causes sandi_meter to think that the method is misindented because it has no end, and thus cause the method to be counted as an invalid method. This caused my rule 2 percentage to be much lower than it should (no difference between original and your fork).

The fix was making determine_last_line return start_line_number if the method is a oneliner.

@makaroni4 makaroni4 deleted the branch makaroni4:master January 6, 2024 11:43
@makaroni4 makaroni4 closed this Jan 6, 2024
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.

One line methods counted incorrectly
3 participants