Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trim docs whitespaces for metadata #613

Merged
merged 1 commit into from
Dec 11, 2020
Merged

Conversation

cmichi
Copy link
Collaborator

@cmichi cmichi commented Dec 10, 2020

I noticed that our generated contract metadata for the message/constructor docs always contains a space as a prefix to the actual String. I suppose this is because of the parsing logic for /// Foobar.

$ cat flipper.contract | jq ".. | .docs?  | select(.)" | egrep -v "\[|\]"
  " Creates a new flipper smart contract initialized with the given value."
  " Creates a new flipper smart contract initialized to `false`."
  " Flips the current value of the Flipper's bool."
  " Returns the current value of the Flipper's bool."

@cmichi cmichi requested a review from ascjones December 10, 2020 20:16
@cmichi cmichi merged commit 45ee4ba into master Dec 11, 2020
@cmichi cmichi deleted the cmichi-trim-docs-in-metadata branch December 11, 2020 09:42
let name = "foo";
let cs = ConstructorSpec::from_name(name)
.selector(123_456_789u32.to_be_bytes())
.docs(vec![" foobar "])
Copy link
Collaborator

@ascjones ascjones Dec 11, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this would be better if there was an inner space e.g. " foo bar ", because this test would also pass with just removing all spaces.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good point, I'll include this change in another PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants