exercism / rust-analyzer

A static analyzer for Rust
GNU Affero General Public License v3.0
10 stars 9 forks source link

Automated Analysis showing up blank (for Rust) #36

Closed anall closed 2 years ago

anall commented 2 years ago

This is on a mentoring request, but I have also seen this when I am doing exercises myself.

image

The specific mentoring request is for gigasecond, and the code from the mentoring request is:

use time::PrimitiveDateTime as DateTime;
use time::Duration as Duration;

// Returns a DateTime one billion seconds after start.
pub fn after(start: DateTime) -> DateTime {
    start + Duration::seconds(1000000000)
}

Running this crate locally on that code gives:

{
  "status": "refer_to_mentor",
  "comments": [
    "The solution could not be parsed."
  ]
}

But I do not know if that is what the live site is giving.

anall commented 2 years ago

Correction, I had the file in the wrong place and also had a stray garbage byte at the end of the file -- the actual analysis.json is:

{
  "status": "refer_to_mentor",
  "comments": [
    "I like this solution directly adds `Duration` to `start` with the `+` operator.",
    "Did you know that rust number literals can have `_` in them to make them more readable? For example: `1_000`"
  ]
}
ErikSchierboom commented 2 years ago

I'm almost sure this is because the output format is the old analysis format. See https://github.com/exercism/docs/blob/main/building/tooling/analyzers/interface.md#output-format for a description of the new format. The comments should be keys into the https://github.com/exercism/website-copy/tree/main/analyzer-comments/rust directory.

iHiD commented 2 years ago

I'm almost sure this is because the output format is the old analysis format

FYI, I don't believe there's ever been a format where messages haven't gone via website-copy.

ErikSchierboom commented 2 years ago

No that's true. I should have rephrased that :)

ErikSchierboom commented 2 years ago

I found the issue and am working on a fix.

ErikSchierboom commented 2 years ago

@anall I've just pushed a fix for this. Could you try re-running the tests to see if the analysis now shows up properly?

anall commented 2 years ago

Looks great now. Thanks.