-
Notifications
You must be signed in to change notification settings - Fork 17
feat(#107): wrong-sprintf-arguments lint #206
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
Merged
Merged
Changes from 25 commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
3fb11b6
feat(#107): decode ascii to string
h1alexbel 455bcd3
feat(#107): sprintf args
h1alexbel fcba685
feat(#107): nested-args
h1alexbel 06cf2f5
feat(#107): cases
h1alexbel 245c6fb
feat(#107): passes
h1alexbel 0907ec0
feat(#107): more tests
h1alexbel 16bfa10
feat(#107): tests
h1alexbel b258f13
feat(#107): wrong-sprintf-arguments, fqn
h1alexbel ba66bb5
feat(#107): clean for qulice
h1alexbel b9b4612
Merge branch 'master' into 107-sprintf
h1alexbel 8f3af6c
chore: timeouts
h1alexbel 35f38a5
chore: timeouts 2x
h1alexbel d3ed3d6
chore: default timeout puzzle
h1alexbel 14404b0
chore: unused
h1alexbel 7169d59
feat(#107): allows more formatters
h1alexbel 303aef2
feat(#107): path to fqn
h1alexbel 061ac56
chore: move to separate bug
h1alexbel 1d2f6a6
feat(#107): trigger
h1alexbel b2bf44a
feat(#107): back
h1alexbel 61ed732
feat(#107): sprintf-text
h1alexbel 374f92c
feat(#107): empty tuple
h1alexbel ad82171
feat(#107): iterates all sprintfs
h1alexbel 4f13f86
feat(#107): indents
h1alexbel 2466b0a
Merge branch 'master' into 107-sprintf
h1alexbel 97c111e
feat(#107): clean grammar
h1alexbel 3a06fc0
feat(#107): allows percentage sign
h1alexbel bee758f
feat(#107): clean grammar
h1alexbel File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
93 changes: 93 additions & 0 deletions
93
src/main/resources/org/eolang/lints/misc/wrong-sprintf-arguments.xsl
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,93 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <!-- | ||
| The MIT License (MIT) | ||
|
|
||
| Copyright (c) 2016-2024 Objectionary.com | ||
|
|
||
| Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| of this software and associated documentation files (the "Software"), to deal | ||
| in the Software without restriction, including without limitation the rights | ||
| to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
| copies of the Software, and to permit persons to whom the Software is | ||
| furnished to do so, subject to the following conditions: | ||
|
|
||
| The above copyright notice and this permission notice shall be included | ||
| in all copies or substantial portions of the Software. | ||
|
|
||
| THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE | ||
| AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
| SOFTWARE. | ||
| --> | ||
| <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:math="http://www.w3.org/2005/xpath-functions/math" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:eo="https://www.eolang.org" version="2.0" id="wrong-sprintf-arguments"> | ||
| <xsl:import href="/org/eolang/funcs/lineno.xsl"/> | ||
| <xsl:output encoding="UTF-8" method="xml"/> | ||
| <xsl:function name="eo:hex-to-placeholder" as="xs:integer"> | ||
| <xsl:param name="hex" as="xs:string"/> | ||
| <xsl:variable name="hex-upper" select="upper-case($hex)"/> | ||
| <xsl:variable name="length" select="string-length($hex-upper)"/> | ||
| <xsl:variable name="decimal" select="sum(for $i in 1 to $length return (index-of(string-to-codepoints('0123456789ABCDEF'), string-to-codepoints(substring($hex-upper, $i, 1))) - 1) * xs:integer(math:pow(16, $length - $i)))"/> | ||
| <xsl:sequence select="$decimal"/> | ||
| </xsl:function> | ||
| <xsl:variable name="sprintf" select="//o[@base='.sprintf'][o[@base='.txt']/o[@base='.eolang']/o[@base='org']] | //o[@base='.sprintf'][o[@base='.txt']/o[@base='.eolang']/o[@base='org']/o[@base='Q']]"/> | ||
| <xsl:template name="nested-args"> | ||
| <xsl:param name="node"/> | ||
| <xsl:for-each select="$node/o[not(@base='tuple') and not(@base='.empty')]"> | ||
| <xsl:value-of select="@base"/> | ||
| <xsl:text> </xsl:text> | ||
| </xsl:for-each> | ||
| <xsl:for-each select="$node/o[@base='tuple']"> | ||
| <xsl:call-template name="nested-args"> | ||
| <xsl:with-param name="node" select="."/> | ||
| </xsl:call-template> | ||
| </xsl:for-each> | ||
| </xsl:template> | ||
| <xsl:template match="/"> | ||
| <defects> | ||
| <xsl:for-each select="$sprintf"> | ||
| <xsl:variable name="sprintf-text" select="o[@base='string'][1]/text()"/> | ||
| <xsl:variable name="tokens" select="tokenize($sprintf-text, '-')"/> | ||
| <xsl:variable name="placeholder"> | ||
| <xsl:for-each select="$tokens"> | ||
| <xsl:value-of select="codepoints-to-string(eo:hex-to-placeholder(.))"/> | ||
| </xsl:for-each> | ||
| </xsl:variable> | ||
| <xsl:variable name="allowed"> | ||
| <xsl:analyze-string select="$placeholder" regex="%[sdfxb]"> | ||
| <xsl:matching-substring> | ||
| <match/> | ||
| </xsl:matching-substring> | ||
| </xsl:analyze-string> | ||
| </xsl:variable> | ||
| <xsl:variable name="declared" select="count($allowed/match)"/> | ||
| <xsl:variable name="tupled" select="o[@base='tuple']/o[not(@base='.empty')]"/> | ||
| <xsl:variable name="nested"> | ||
| <xsl:for-each select="$tupled"> | ||
| <xsl:call-template name="nested-args"> | ||
| <xsl:with-param name="node" select="."/> | ||
| </xsl:call-template> | ||
| </xsl:for-each> | ||
| </xsl:variable> | ||
| <xsl:variable name="used" select="count($tupled[not(@base='tuple')]/@base) + count(tokenize(substring($nested, 1, string-length($nested) - 1), '\s+'))"/> | ||
| <xsl:if test="$sprintf-text != '' and $declared != $used"> | ||
| <defect> | ||
| <xsl:attribute name="line"> | ||
| <xsl:value-of select="eo:lineno(@line)"/> | ||
| </xsl:attribute> | ||
| <xsl:attribute name="severity"> | ||
| <xsl:text>warning</xsl:text> | ||
| </xsl:attribute> | ||
| <xsl:text>The sprintf object has the wrong number of arguments: </xsl:text> | ||
| <xsl:value-of select="$declared"/> | ||
| <xsl:text> in the placeholder, but </xsl:text> | ||
| <xsl:value-of select="$used"/> | ||
| <xsl:text> are passed</xsl:text> | ||
| </defect> | ||
| </xsl:if> | ||
| </xsl:for-each> | ||
| </defects> | ||
| </xsl:template> | ||
| </xsl:stylesheet> |
24 changes: 24 additions & 0 deletions
24
src/main/resources/org/eolang/motives/misc/wrong-sprintf-arguments.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| # Wrong `QQ.txt.sprintf` Arguments | ||
|
|
||
| The `QQ.txt.sprintf` object must have a match between its placeholder variables | ||
| and passed arguments. | ||
|
|
||
| Incorrect: | ||
|
|
||
| ```eo | ||
| [] > app | ||
| QQ.io.stdout > @ | ||
| QQ.txt.sprintf | ||
| "Hello, %s! Your account is %d." | ||
| * name | ||
| ``` | ||
|
|
||
| Correct: | ||
|
|
||
| ```eo | ||
| [] > app | ||
| QQ.io.stdout > @ | ||
| QQ.txt.sprintf | ||
| "Hello, %s! Your account is %d." | ||
| * name acc | ||
| ``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
...urces/org/eolang/lints/packs/wrong-sprintf-arguments/allows-correct-arguments-number.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| # The MIT License (MIT) | ||
| # | ||
| # Copyright (c) 2016-2024 Objectionary.com | ||
| # | ||
| # Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| # of this software and associated documentation files (the "Software"), to deal | ||
| # in the Software without restriction, including without limitation the rights | ||
| # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
| # copies of the Software, and to permit persons to whom the Software is | ||
| # furnished to do so, subject to the following conditions: | ||
| # | ||
| # The above copyright notice and this permission notice shall be included | ||
| # in all copies or substantial portions of the Software. | ||
| # | ||
| # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| # FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE | ||
| # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
| # SOFTWARE. | ||
| --- | ||
| sheets: | ||
| - /org/eolang/lints/misc/wrong-sprintf-arguments.xsl | ||
| asserts: | ||
| - /defects[count(defect[@severity='warning'])=0] | ||
| input: | | ||
| # App. | ||
| [] > app | ||
| QQ.io.stdout > @ | ||
| org.eolang.txt.sprintf | ||
| "Hello, %s! Your account is %d." | ||
| * name acc |
33 changes: 33 additions & 0 deletions
33
.../resources/org/eolang/lints/packs/wrong-sprintf-arguments/allows-many-good-arguments.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| # The MIT License (MIT) | ||
| # | ||
| # Copyright (c) 2016-2024 Objectionary.com | ||
| # | ||
| # Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| # of this software and associated documentation files (the "Software"), to deal | ||
| # in the Software without restriction, including without limitation the rights | ||
| # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
| # copies of the Software, and to permit persons to whom the Software is | ||
| # furnished to do so, subject to the following conditions: | ||
| # | ||
| # The above copyright notice and this permission notice shall be included | ||
| # in all copies or substantial portions of the Software. | ||
| # | ||
| # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| # FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE | ||
| # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
| # SOFTWARE. | ||
| --- | ||
| sheets: | ||
| - /org/eolang/lints/misc/wrong-sprintf-arguments.xsl | ||
| asserts: | ||
| - /defects[count(defect[@severity='warning'])=0] | ||
| input: | | ||
| # App. | ||
| [] > app | ||
| QQ.io.stdout > @ | ||
| org.eolang.txt.sprintf | ||
| "Hello, %s (%x, match: %b)! Your account is %d, your temperature %f." | ||
| * name name.as-bytes true acc t |
33 changes: 33 additions & 0 deletions
33
...lang/lints/packs/wrong-sprintf-arguments/allows-sprintf-containing-tuple-with-number.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| # The MIT License (MIT) | ||
| # | ||
| # Copyright (c) 2016-2024 Objectionary.com | ||
| # | ||
| # Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| # of this software and associated documentation files (the "Software"), to deal | ||
| # in the Software without restriction, including without limitation the rights | ||
| # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
| # copies of the Software, and to permit persons to whom the Software is | ||
| # furnished to do so, subject to the following conditions: | ||
| # | ||
| # The above copyright notice and this permission notice shall be included | ||
| # in all copies or substantial portions of the Software. | ||
| # | ||
| # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| # FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE | ||
| # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
| # SOFTWARE. | ||
| --- | ||
| sheets: | ||
| - /org/eolang/lints/misc/wrong-sprintf-arguments.xsl | ||
| asserts: | ||
| - /defects[count(defect[@severity='warning'])=0] | ||
| input: | | ||
| # App. | ||
| [] > app | ||
| QQ.io.stdout > @ | ||
| org.eolang.txt.sprintf | ||
| "Привет, %d" | ||
| * 52 |
33 changes: 33 additions & 0 deletions
33
...lang/lints/packs/wrong-sprintf-arguments/allows-sprintf-containing-tuple-with-string.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| # The MIT License (MIT) | ||
| # | ||
| # Copyright (c) 2016-2024 Objectionary.com | ||
| # | ||
| # Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| # of this software and associated documentation files (the "Software"), to deal | ||
| # in the Software without restriction, including without limitation the rights | ||
| # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
| # copies of the Software, and to permit persons to whom the Software is | ||
| # furnished to do so, subject to the following conditions: | ||
| # | ||
| # The above copyright notice and this permission notice shall be included | ||
| # in all copies or substantial portions of the Software. | ||
| # | ||
| # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| # FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE | ||
| # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
| # SOFTWARE. | ||
| --- | ||
| sheets: | ||
| - /org/eolang/lints/misc/wrong-sprintf-arguments.xsl | ||
| asserts: | ||
| - /defects[count(defect[@severity='warning'])=0] | ||
| input: | | ||
| # App. | ||
| [] > app | ||
| QQ.io.stdout > @ | ||
| org.eolang.txt.sprintf | ||
| "Hello, %s" | ||
| * "Jeff" |
34 changes: 34 additions & 0 deletions
34
...t/resources/org/eolang/lints/packs/wrong-sprintf-arguments/catches-arguments-absence.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| # The MIT License (MIT) | ||
| # | ||
| # Copyright (c) 2016-2024 Objectionary.com | ||
| # | ||
| # Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| # of this software and associated documentation files (the "Software"), to deal | ||
| # in the Software without restriction, including without limitation the rights | ||
| # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
| # copies of the Software, and to permit persons to whom the Software is | ||
| # furnished to do so, subject to the following conditions: | ||
| # | ||
| # The above copyright notice and this permission notice shall be included | ||
| # in all copies or substantial portions of the Software. | ||
| # | ||
| # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| # FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE | ||
| # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
| # SOFTWARE. | ||
| --- | ||
| sheets: | ||
| - /org/eolang/lints/misc/wrong-sprintf-arguments.xsl | ||
| asserts: | ||
| - /defects[count(defect[@severity='warning'])=1] | ||
| - /defects/defect[@line='4'] | ||
| input: | | ||
| # App. | ||
| [] > app | ||
| QQ.io.stdout > @ | ||
| org.eolang.txt.sprintf | ||
| "Hello, %s! Your account is %d." | ||
| * |
34 changes: 34 additions & 0 deletions
34
...es/org/eolang/lints/packs/wrong-sprintf-arguments/catches-more-arguments-than-needed.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| # The MIT License (MIT) | ||
| # | ||
| # Copyright (c) 2016-2024 Objectionary.com | ||
| # | ||
| # Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| # of this software and associated documentation files (the "Software"), to deal | ||
| # in the Software without restriction, including without limitation the rights | ||
| # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
| # copies of the Software, and to permit persons to whom the Software is | ||
| # furnished to do so, subject to the following conditions: | ||
| # | ||
| # The above copyright notice and this permission notice shall be included | ||
| # in all copies or substantial portions of the Software. | ||
| # | ||
| # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| # FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE | ||
| # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
| # SOFTWARE. | ||
| --- | ||
| sheets: | ||
| - /org/eolang/lints/misc/wrong-sprintf-arguments.xsl | ||
| asserts: | ||
| - /defects[count(defect[@severity='warning'])=1] | ||
| - /defects/defect[@line='4'] | ||
| input: | | ||
| # App. | ||
| [] > app | ||
| QQ.io.stdout > @ | ||
| org.eolang.txt.sprintf | ||
| "Hello, %s! Your account is %d." | ||
| * name acc foo bar |
37 changes: 37 additions & 0 deletions
37
...t/resources/org/eolang/lints/packs/wrong-sprintf-arguments/catches-multiple-sprintfs.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| # The MIT License (MIT) | ||
| # | ||
| # Copyright (c) 2016-2024 Objectionary.com | ||
| # | ||
| # Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| # of this software and associated documentation files (the "Software"), to deal | ||
| # in the Software without restriction, including without limitation the rights | ||
| # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
| # copies of the Software, and to permit persons to whom the Software is | ||
| # furnished to do so, subject to the following conditions: | ||
| # | ||
| # The above copyright notice and this permission notice shall be included | ||
| # in all copies or substantial portions of the Software. | ||
| # | ||
| # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| # FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE | ||
| # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
| # SOFTWARE. | ||
| --- | ||
| sheets: | ||
| - /org/eolang/lints/misc/wrong-sprintf-arguments.xsl | ||
| asserts: | ||
| - /defects[count(defect[@severity='warning'])=1] | ||
| - /defects/defect[@line='7'] | ||
| input: | | ||
| # App. | ||
| [] > app | ||
| QQ.io.stdout > @ | ||
| org.eolang.txt.sprintf | ||
| "Hello, %s! Your account is %d." | ||
| * name acc | ||
| org.eolang.txt.sprintf | ||
| "Hello, %s! Your account is %f." | ||
| * f |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@h1alexbel better enquote the string inside the error message, to make it look like this: