eipw icon indicating copy to clipboard operation
eipw copied to clipboard

Fix regular expression for compactability

Open IjayAbby opened this issue 1 year ago • 11 comments

The expected issue was fixed using the explanation below

Error

  • Reports common mistakes when referencing other proposals, like omitting the hyphen (EIP1234), or replacing it with a space (EIP 1234).

The Fix

  • For consistency, all proposals should be referenced in the same way.
  • Interfaces and contract names should be enclosed in backticks to avoid this error: EIP-1234.
  • These are the backwards compatibility concerns for the EIP-1234.

IjayAbby avatar May 26 '24 15:05 IjayAbby

What issue is this associated with?

SamWilsn avatar May 26 '24 15:05 SamWilsn

This one https://github.com/ethereum/eipw/issues/91

IjayAbby avatar May 26 '24 15:05 IjayAbby

Ah. For this one, you'll want to make a change somewhere around here:

https://github.com/ethereum/eipw/blob/93266e615fcc32fef89d703aaad1357cbe229463/eipw-lint/src/lints/markdown/regex.rs#L136-L138

The easiest solution (and the one I'd recommend) is skipping the self.check(...) call if link.url == link.title.

SamWilsn avatar May 26 '24 16:05 SamWilsn

So when am pushing I should reverse the other files to their original state?

IjayAbby avatar May 26 '24 16:05 IjayAbby

Yep! If you can add a test with an autolink to show that your change works as expected, that'd be great too.

SamWilsn avatar May 26 '24 16:05 SamWilsn

Quick question: If I run npm install it should be able to set up my local environment? My test should be in this file https://github.com/ethereum/eipw/blob/93266e615fcc32fef89d703aaad1357cbe229463/eipw-lint/tests/lint_markdown_regex.rs ?

IjayAbby avatar May 26 '24 16:05 IjayAbby

You'll need to setup Rust, and use cargo (not npm.)

See https://doc.rust-lang.org/book/ch01-00-getting-started.html

SamWilsn avatar May 26 '24 17:05 SamWilsn

Hello @SamWilsn, I have set up my project on my local and I would love to mimic the error from the issue above but anytime I run cargo test on regex.rs file all the test are passing. Do you have any idea of where am going wrong. Rather any documentation I can use to replicate the tests?

IjayAbby avatar May 27 '24 08:05 IjayAbby

There is no test yet for this issue, so there's nothing to fail.

A test might look something like:

#[tokio::test]
async fn excludes_autolink() {
    let src = r#"---
header: value1
---

A link <https://example.com>.
"#;

    let reports = Linter::<Text<String>>::default()
        .clear_lints()
        .deny(
            "markdown-re",
            Regex {
                message: "boop",
                mode: Mode::Excludes,
                pattern: "example",
            },
        )
        .check_slice(None, src)
        .run()
        .await
        .unwrap()
        .into_inner();

    assert_eq!(
        reports,
        ""
    );
}

I haven't tried the above, so you might need to tweak it a bit. This should live in lint_markdown_regex.rs

SamWilsn avatar May 27 '24 13:05 SamWilsn

Thank you, will consider this.

IjayAbby avatar May 27 '24 14:05 IjayAbby

Ah. For this one, you'll want to make a change somewhere around here:

https://github.com/ethereum/eipw/blob/93266e615fcc32fef89d703aaad1357cbe229463/eipw-lint/src/lints/markdown/regex.rs#L136-L138

The easiest solution (and the one I'd recommend) is skipping the self.check(...) call if link.url == link.title.

Hello am trying to wrap my head around the meaning of this ast: &Ast

IjayAbby avatar May 28 '24 17:05 IjayAbby

Am having this error after pulling the recent changes Screenshot from 2024-10-18 16-10-51

IjayAbby avatar Oct 18 '24 13:10 IjayAbby