Skip to content

use of filename starting with "self" breaks sonar analysis #127

@ansghof

Description

@ansghof

In our project, we have a file called "self_service.rs" which is (obviously) a self service api for users to do stuff themselves. The file is called self_service and thus the import also calls it that. Unfortunately, the parser seems to break here, presumably because it thinks it encountered a "self" keyword at an unexpected position. The following code will break sonar analysis:

 1: use actix_web::web::Data;
 2: ... <redacted>
 3: 
 4: use crate::{
 5:     api::self_service::SomeStruct,
                 ^
...
 9: };
10: use std::fmt::Write;
11: 
12: pub fn function_at_the_start_of_the_source_file(
...
08:47:36.674 ERROR Unable to parse file: rust/api/src/service/failed_to_parse.rs
08:47:36.674 ERROR Parse error at line 5 column 14:

In theory, any import that starts with self will fail. Somehow the lexer seems to think that this is a self keyword.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions