Skip to content

Conversation

practicalswift
Copy link
Contributor

Make format string linter understand basic template parameter syntax.

Fixes issue described in #13705 (comment).

Thanks to @ken2812221 for reporting!

@laanwj
Copy link
Member

laanwj commented Aug 10, 2018

utACK 4441ad6
thanks for addressing this quickly !
need to be tested on @ken2812221's code

@laanwj laanwj added the Tests label Aug 10, 2018
@practicalswift
Copy link
Contributor Author

The first doctest testcase added is the issue @ken2812221 encountered.

@ken2812221
Copy link
Contributor

Tested ACK 4441ad6. But strprintf("%d %d", b<2, c); would fail, it would success if I add space either side of <. Maybe it's a good linter to telling people to format code.

@maflcko maflcko merged commit 4441ad6 into bitcoin:master Aug 13, 2018
@practicalswift practicalswift deleted the teach-format-string-linter-about-templates branch April 10, 2021 19:35
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jun 27, 2021
… template parameter syntax

4441ad6 Make format string linter understand basic template parameter syntax (practicalswift)

Pull request description:

  Make format string linter understand basic template parameter syntax.

  Fixes issue described in bitcoin#13705 (comment).

  Thanks to @ken2812221 for reporting!

Tree-SHA512: 8fb995bc6b29d8b9926ef5969e02cf71c494e829434fcdeb4ed5fabad5ab96e86e5b8eea705e8a416927757b4fa4e58abc0fd4f483daa58c94e2c6fdcb8ee822
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jun 28, 2021
… template parameter syntax

4441ad6 Make format string linter understand basic template parameter syntax (practicalswift)

Pull request description:

  Make format string linter understand basic template parameter syntax.

  Fixes issue described in bitcoin#13705 (comment).

  Thanks to @ken2812221 for reporting!

Tree-SHA512: 8fb995bc6b29d8b9926ef5969e02cf71c494e829434fcdeb4ed5fabad5ab96e86e5b8eea705e8a416927757b4fa4e58abc0fd4f483daa58c94e2c6fdcb8ee822
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jun 29, 2021
… template parameter syntax

4441ad6 Make format string linter understand basic template parameter syntax (practicalswift)

Pull request description:

  Make format string linter understand basic template parameter syntax.

  Fixes issue described in bitcoin#13705 (comment).

  Thanks to @ken2812221 for reporting!

Tree-SHA512: 8fb995bc6b29d8b9926ef5969e02cf71c494e829434fcdeb4ed5fabad5ab96e86e5b8eea705e8a416927757b4fa4e58abc0fd4f483daa58c94e2c6fdcb8ee822
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jun 29, 2021
… template parameter syntax

4441ad6 Make format string linter understand basic template parameter syntax (practicalswift)

Pull request description:

  Make format string linter understand basic template parameter syntax.

  Fixes issue described in bitcoin#13705 (comment).

  Thanks to @ken2812221 for reporting!

Tree-SHA512: 8fb995bc6b29d8b9926ef5969e02cf71c494e829434fcdeb4ed5fabad5ab96e86e5b8eea705e8a416927757b4fa4e58abc0fd4f483daa58c94e2c6fdcb8ee822
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jun 29, 2021
… template parameter syntax

4441ad6 Make format string linter understand basic template parameter syntax (practicalswift)

Pull request description:

  Make format string linter understand basic template parameter syntax.

  Fixes issue described in bitcoin#13705 (comment).

  Thanks to @ken2812221 for reporting!

Tree-SHA512: 8fb995bc6b29d8b9926ef5969e02cf71c494e829434fcdeb4ed5fabad5ab96e86e5b8eea705e8a416927757b4fa4e58abc0fd4f483daa58c94e2c6fdcb8ee822
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jun 29, 2021
… template parameter syntax

4441ad6 Make format string linter understand basic template parameter syntax (practicalswift)

Pull request description:

  Make format string linter understand basic template parameter syntax.

  Fixes issue described in bitcoin#13705 (comment).

  Thanks to @ken2812221 for reporting!

Tree-SHA512: 8fb995bc6b29d8b9926ef5969e02cf71c494e829434fcdeb4ed5fabad5ab96e86e5b8eea705e8a416927757b4fa4e58abc0fd4f483daa58c94e2c6fdcb8ee822
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jun 29, 2021
… template parameter syntax

4441ad6 Make format string linter understand basic template parameter syntax (practicalswift)

Pull request description:

  Make format string linter understand basic template parameter syntax.

  Fixes issue described in bitcoin#13705 (comment).

  Thanks to @ken2812221 for reporting!

Tree-SHA512: 8fb995bc6b29d8b9926ef5969e02cf71c494e829434fcdeb4ed5fabad5ab96e86e5b8eea705e8a416927757b4fa4e58abc0fd4f483daa58c94e2c6fdcb8ee822
Fabcien pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Jan 11, 2022
Summary:
While working on D10815, I got a false positive error from `arc lint`
```
Lint: String formatting function arguments mismatch
strprintf( "%s (%d)", std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>, wchar_t>() .to_bytes(buf), err)
Expected 2 argument(s) after format string but found 3 argument(s)
```

This is a backport of [[bitcoin/bitcoin#13939 | core#13939]]

Test Plan: run `arc lint` on D10815 and make sure it does not produce a false positive error

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Differential Revision: https://reviews.bitcoinabc.org/D10816
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Aug 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants