community-rust icon indicating copy to clipboard operation
community-rust copied to clipboard

getting an error java.lang.IllegalArgumentException: line is not a valid line offset for pointer.

Open manku211 opened this issue 1 year ago • 8 comments

INFO Sensor RustSensor [communityrust]

11:44:14.895 ERROR Unable to parse file: src/service/crons/process_historical_event/client.rs

11:44:14.897 ERROR Parse error at line 554 column 25:

544: // transfer reward

545: let reward_fut = client.transfer_rewards(process_reward_rx);

546: let (_res1, _res2) = tokio::join!(process_event_fut, reward_fut);

547: if let Err(err) = super::state::del("quest", ".", redis_pool.clone()).await {

548: tracing::error!("fail to remove quest from queue due to {err}");

549: }

550: }

551:

552: tracing::info!("process event sleep for 15 sec");

553: tokio::time::sleep(std::time::Duration::from_secs(15)).await;

554: if !continue_processing {

                         ^

555: break 'outer;

556: }

557: }

558: }

559: }

560:

561: #[cfg(test)]

562: mod test {

563: use super::*;

564: use crate::config::configuration::build_setting;

11:44:20.149 INFO Sensor RustSensor [communityrust] (done) | time=8452ms

11:44:20.150 INFO Sensor Import of Clippy issues [communityrust]

11:44:20.153 INFO Importing /opt/atlassian/pipelines/agent/build/clippy-report.json

11:44:20.265 INFO [stdout] /opt/atlassian/pipelines/agent/build/src/lib.rs

11:44:20.296 ERROR Error during SonarScanner Engine execution

java.lang.IllegalArgumentException: 12 is not a valid line offset for pointer. File src/lib.rs has 11 character(s) at line 6

manku211 avatar Nov 25 '24 11:11 manku211

Can you share the contents of your clippy-report.json? I noticed my build is failing on clippy::missing_safety_doc, which identifies src/lib.rs as the source, but in reality the warning is caused in another file. When I disable the warning, I can import the file in SonarQube:

RUSTFLAGS="-Aclippy::missing_safety_doc" cargo clippy --message-format=json > target/clippy.json

bzhoek avatar Nov 25 '24 12:11 bzhoek

@bzhoek it was working previously , i use this command still does not work clippy-report.json

manku211 avatar Nov 25 '24 13:11 manku211

It looks like a regression that was introduced in v0.2.5. Can you revert to the previous version of the plug-in to see if that still works?

bzhoek avatar Nov 25 '24 15:11 bzhoek

@manku211 I just tried it with v0.2.4 of the plug-in and that works without a problem (even with SonarQube 10.7.

bzhoek avatar Nov 25 '24 15:11 bzhoek

@bzhoek I tried with v0.2.4 it still gives the parse error at some line but it does not break this time and does not give error of java.lang.IllegalArgumentException. Thanku very much .

manku211 avatar Nov 25 '24 17:11 manku211

@bzhoek, thank you for support and information about clippy::missing_safety_doc! I will double check the work of plugin for it

@manku211, can you share the parse errors, please?

C4tWithShell avatar Nov 30 '24 15:11 C4tWithShell

ERROR: Unable to parse file: src/service/crons/process_historical_event/client.rs

ERROR: Parse error at line 554 column 25:

544: // transfer reward

545: let reward_fut = client.transfer_rewards(process_reward_rx);

546: let (_res1, _res2) = tokio::join!(process_event_fut, reward_fut);

547: if let Err(err) = super::state::del("quest", ".", redis_pool.clone()).await {

548: tracing::error!("fail to remove quest from queue due to {err}");

549: }

550: }

551:

552: tracing::info!("process event sleep for 15 sec");

553: tokio::time::sleep(std::time::Duration::from_secs(15)).await;

554: if !continue_processing {

                         ^

555: break 'outer;

556: }

557: }

558: }

559: }

560:

561: #[cfg(test)]

562: mod test {

563: use super::*;

564: use crate::config::configuration::build_setting; this is just snippet of my rust code where it usually give parse error but not breaking pipeline because i'm using old version plugin now it points the error at line number 554

manku211 avatar Dec 02 '24 04:12 manku211

hii @C4tWithShell have you checked this for new version , actually I need to update my sonarqube it is necessary

manku211 avatar Jun 09 '25 15:06 manku211