<feed xmlns='http://www.w3.org/2005/Atom'>
<title>godefererr/testdata, branch v0.0.2</title>
<subtitle>Analyser that reports incorrectly returned errors from defer closures</subtitle>
<link rel='alternate' type='text/html' href='https://git.teddywing.com/godefererr/'/>
<entry>
<title>Add license (GNU GPLv3+)</title>
<updated>2023-05-26T19:35:59+00:00</updated>
<author>
<name>Teddy Wing</name>
</author>
<published>2023-05-26T19:35:59+00:00</published>
<link rel='alternate' type='text/html' href='https://git.teddywing.com/godefererr/commit/?id=73574b844ef08e52940c16f4bf8f18f06a2796fe'/>
<id>73574b844ef08e52940c16f4bf8f18f06a2796fe</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>shouldDeclareErrInSignature: Add note about variable declaration line</title>
<updated>2023-05-25T18:47:05+00:00</updated>
<author>
<name>Teddy Wing</name>
</author>
<published>2023-05-25T18:47:05+00:00</published>
<link rel='alternate' type='text/html' href='https://git.teddywing.com/godefererr/commit/?id=8102c9e6fe7e12d625718e362abb29bf1ecdb13c'/>
<id>8102c9e6fe7e12d625718e362abb29bf1ecdb13c</id>
<content type='text'>
When I was first coming up with ideas for the project, I thought that
this line is one I might need to report a diagnostic for, but since the
compiler will catch it, we don't need to bother.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When I was first coming up with ideas for the project, I thought that
this line is one I might need to report a diagnostic for, but since the
compiler will catch it, we don't need to bother.
</pre>
</div>
</content>
</entry>
<entry>
<title>Report missing signature declaration with multiple return values</title>
<updated>2023-05-25T18:40:08+00:00</updated>
<author>
<name>Teddy Wing</name>
</author>
<published>2023-05-25T18:40:08+00:00</published>
<link rel='alternate' type='text/html' href='https://git.teddywing.com/godefererr/commit/?id=8bcef611f794272203e05e207259ac8d45d558fb'/>
<id>8bcef611f794272203e05e207259ac8d45d558fb</id>
<content type='text'>
The previous message which reported when a function's return signature
didn't declare an error variable didn't work for functions with multiple
return values.

I thought about extending it and coming up with generated variable names
for the non-error types to be able to support automatic fixing, but this
idea ended up being too complicated. Also, I didn't like the idea of an
automated fixer coming up with generated variable names, because you'd
need to manually rename them anyway. That kind of defeats the purpose of
it being automated.

Instead, change the diagnostic message to only refer to the error
variable and recommend what the declared variable name should be based
on the identifier the error was assigned to in the defer.

Modify our multiple return value test functions according to this new
approach.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The previous message which reported when a function's return signature
didn't declare an error variable didn't work for functions with multiple
return values.

I thought about extending it and coming up with generated variable names
for the non-error types to be able to support automatic fixing, but this
idea ended up being too complicated. Also, I didn't like the idea of an
automated fixer coming up with generated variable names, because you'd
need to manually rename them anyway. That kind of defeats the purpose of
it being automated.

Instead, change the diagnostic message to only refer to the error
variable and recommend what the declared variable name should be based
on the identifier the error was assigned to in the defer.

Modify our multiple return value test functions according to this new
approach.
</pre>
</div>
</content>
</entry>
<entry>
<title>checkFunctions: Keep `continue` in return value loop</title>
<updated>2023-05-25T17:00:26+00:00</updated>
<author>
<name>Teddy Wing</name>
</author>
<published>2023-05-25T17:00:26+00:00</published>
<link rel='alternate' type='text/html' href='https://git.teddywing.com/godefererr/commit/?id=c15e27166dfb8ef1c94cd8c87ab41edb4e98300f'/>
<id>c15e27166dfb8ef1c94cd8c87ab41edb4e98300f</id>
<content type='text'>
Looks like the return value type is always an `*ast.Ident`. Use
`continue` instead of `return true` to be more tolerant of unexpected
values.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Looks like the return value type is always an `*ast.Ident`. Use
`continue` instead of `return true` to be more tolerant of unexpected
values.
</pre>
</div>
</content>
</entry>
<entry>
<title>Idea about multiple return values</title>
<updated>2023-05-22T22:27:12+00:00</updated>
<author>
<name>Teddy Wing</name>
</author>
<published>2023-05-22T22:27:12+00:00</published>
<link rel='alternate' type='text/html' href='https://git.teddywing.com/godefererr/commit/?id=cfba6ff882313ccf1ffe5c6b368ec769e4cae9a1'/>
<id>cfba6ff882313ccf1ffe5c6b368ec769e4cae9a1</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Add tests with multiple return values</title>
<updated>2023-05-22T22:16:21+00:00</updated>
<author>
<name>Teddy Wing</name>
</author>
<published>2023-05-22T22:16:21+00:00</published>
<link rel='alternate' type='text/html' href='https://git.teddywing.com/godefererr/commit/?id=a32bf36f55f404f75f42fdc428d3b9e9d6fa8097'/>
<id>a32bf36f55f404f75f42fdc428d3b9e9d6fa8097</id>
<content type='text'>
Don't pass yet as we currently only suggest `(errorVar error)` as the
return signature.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Don't pass yet as we currently only suggest `(errorVar error)` as the
return signature.
</pre>
</div>
</content>
</entry>
<entry>
<title>Report function signature declaration using variable name other than err</title>
<updated>2023-05-21T19:39:48+00:00</updated>
<author>
<name>Teddy Wing</name>
</author>
<published>2023-05-21T19:39:48+00:00</published>
<link rel='alternate' type='text/html' href='https://git.teddywing.com/godefererr/commit/?id=8efe2cc2f9495b60b5a27f818af7d666651aee4d'/>
<id>8efe2cc2f9495b60b5a27f818af7d666651aee4d</id>
<content type='text'>
I had previously hard-coded the variable name "err" as the recommended
name declaration in the function signature for simplicity.

Now, use the name assigned in the `defer` instead, which is more
correct.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
I had previously hard-coded the variable name "err" as the recommended
name declaration in the function signature for simplicity.

Now, use the name assigned in the `defer` instead, which is more
correct.
</pre>
</div>
</content>
</entry>
<entry>
<title>Clarify name of `returnsOtherVariable` test</title>
<updated>2023-05-21T19:16:09+00:00</updated>
<author>
<name>Teddy Wing</name>
</author>
<published>2023-05-21T19:16:09+00:00</published>
<link rel='alternate' type='text/html' href='https://git.teddywing.com/godefererr/commit/?id=7ad57bcea66fe4c8eeff73b4087fcfd10dd5312f'/>
<id>7ad57bcea66fe4c8eeff73b4087fcfd10dd5312f</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Check whether returned name matches defer error name</title>
<updated>2023-05-21T19:12:19+00:00</updated>
<author>
<name>Teddy Wing</name>
</author>
<published>2023-05-21T19:12:19+00:00</published>
<link rel='alternate' type='text/html' href='https://git.teddywing.com/godefererr/commit/?id=5637c27b828e63fa459d3b124400bc135d1c95df'/>
<id>5637c27b828e63fa459d3b124400bc135d1c95df</id>
<content type='text'>
Ensure the name of the returned error variable matches the name of the
error variable assigned in the `defer` statement.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Ensure the name of the returned error variable matches the name of the
error variable assigned in the `defer` statement.
</pre>
</div>
</content>
</entry>
<entry>
<title>Inspect return value looking at type and name</title>
<updated>2023-05-21T16:21:06+00:00</updated>
<author>
<name>Teddy Wing</name>
</author>
<published>2023-05-21T16:21:06+00:00</published>
<link rel='alternate' type='text/html' href='https://git.teddywing.com/godefererr/commit/?id=63a5452af97b6173fb17f754ce7ca3bce8e9729d'/>
<id>63a5452af97b6173fb17f754ce7ca3bce8e9729d</id>
<content type='text'>
Want to check that the `return` statement uses the same variable used in
the `defer` closure. Start inspecting the values to figure out how we
can narrow that down.

Add a test case for a "good" assignment of a returned error in `defer`.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Want to check that the `return` statement uses the same variable used in
the `defer` closure. Start inspecting the values to figure out how we
can narrow that down.

Add a test case for a "good" assignment of a returned error in `defer`.
</pre>
</div>
</content>
</entry>
</feed>
