Skip to content

Parse error on functions without return #5

@waeller

Description

@waeller

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions