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

Parse error on functions without return #5

Open
waeller opened this issue Mar 24, 2017 · 0 comments
Open

Parse error on functions without return #5

waeller opened this issue Mar 24, 2017 · 0 comments

Comments

@waeller
Copy link

waeller commented Mar 24, 2017

Hi!

I think I found a bug in this plugin. This test (I added it to LuaAstScannerTest)

@Test
public void noReturn() {
  SourceFile file = LuaAstScanner.scanSingleFile(new File("src/test/resources/bugs/noreturn.lua"));
  assertThat(file.getInt(LuaMetric.LINES)).isEqualTo(7);
}

executed with this Lua file:

function doNothing()
end

function noReturn()
  doNothing()

end

fails with this console output about a parse error:

[main] ERROR org.sonar.squidbridge.AstScanner - Parse error at line 7 column 1:
1: function doNothing()
2: end
3: 
4: function noReturn()
5:   doNothing()
6: end
7: 
   ^

It is sufficient to add a return to function noReturn() and the test will succeed:

function doNothing()
end

function noReturn()
  return doNothing()
end

Regards,
Juergen

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

No branches or pull requests

1 participant