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

* fixed all warnings. tests are running in verbose mode now. #685

merged 3 commits into from May 5, 2020


Copy link

iliabylich commented May 5, 2020

  1. added if false; testEof; end at the bottom of Lexer#advance to prevent warnings about unused variable testEof. It has 0 runtime cost.
  2. fixed formatting in a few places
  3. changed test task definition to run tests in verbose mode (like ruby -w would do)
  4. For some reason "" % {} gives a warning (same with Kernel#sprintf, no idea why). Added a utility method to perform interpolation on messages only if there's something to interpolate.
  5. added parentheses to all m /regex/ calls
  6. added _ prefix to unused variables.

I'm getting 0 warnings locally when running rake test/rake test_cov

Closes #684

bbatsov approved these changes May 5, 2020
lib/parser/messages.rb Outdated Show resolved Hide resolved
@iliabylich iliabylich changed the title Fix all warnings, run tests in verbose mode (like ruby -w) * fixed all warnings. tests are running in verbose mode now. May 5, 2020
@iliabylich iliabylich merged commit 21581a2 into whitequark:master May 5, 2020
1 check passed
1 check passed
continuous-integration/travis-ci/pr The Travis CI build passed
@iliabylich iliabylich deleted the iliabylich:fix-all-warnings branch May 5, 2020
@@ -283,6 +283,13 @@ class Parser::Lexer
%% write exec;
# %

# Ragel creates a local variable called `testEof` but it doesn't use
# it in any assignment. This dead code is here to swallow the warning.
# It has no runtime cost because Ruby doesn't produce any instructions from it.

This comment has been minimized.

Copy link

mbj May 5, 2020


Until ruby starts warning about if false as a redundant construct ;)

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

Successfully merging this pull request may close these issues.

3 participants
You can’t perform that action at this time.