iilyak opened a new pull request, #5309:
URL: https://github.com/apache/couchdb/pull/5309
## Overview
This PR serves as a code documentation since we don't run type checks during
CI. It doesn't modify existing code just adding type specs.
## Testing recommendations
Since we don't run dyalizer during CI and given the fact that it fails on
main. There is no good way to test correctness of the spec other than comparing
the output of dilayzer on main and on the current branch.
on *main* branch
```
couchdb on *main*
❯ make
...
couchdb on *main*
❯ make dialyze apps=dreyfus
==> dreyfus (build-plt)
WARN: ''build-plt'' command does not apply to directory
/Users/iilyak/Code/couchdb/rel
WARN: ''build-plt'' command does not apply to directory
/Users/iilyak/Code/couchdb
==> dreyfus (dialyze)
src/dreyfus_bookmark.erl:61:29: Record construction
#shard{name :: '_', ref :: '_', opts :: '_'} violates the declared
type of field opts ::
'undefined' | [any()]
src/dreyfus_httpd.erl:59:21: The pattern
{'ok', Bookmark0, TotalHits, Hits0} can never match the type
{'error', _} | {'ok', _, _, _, _, _}
src/dreyfus_index.erl:110:1: The inferred return type of init/1
('ok') has nothing in common with
'ignore' |
{'ok', _} |
{'stop', _} |
{'ok', _,
'hibernate' | 'infinity' |
non_neg_integer() |
{'continue', _}}, which is the expected return type for the
callback of the gen_server behaviour
src/dreyfus_index.erl:152:36: The created fun has no local return
src/dreyfus_index.erl:231:36: The created fun has no local return
src/dreyfus_index_updater.erl:23:1: Function update/2 has no local return
ERROR: dialyze failed while processing
/Users/iilyak/Code/couchdb/src/dreyfus: rebar_abort
make: *** [dialyze] Error 1
```
on *add-specs-to-clouseau_rpc* branch
```
couchdb on *add-specs-to-clouseau_rpc*
❯ make
...
couchdb on *add-specs-to-clouseau_rpc*
❯ make dialyze apps=dreyfus
==> dreyfus (build-plt)
WARN: ''build-plt'' command does not apply to directory
/Users/iilyak/Code/couchdb/rel
WARN: ''build-plt'' command does not apply to directory
/Users/iilyak/Code/couchdb
==> dreyfus (dialyze)
src/dreyfus_bookmark.erl:61:29: Record construction
#shard{name :: '_', ref :: '_', opts :: '_'} violates the declared
type of field opts ::
'undefined' | [any()]
src/dreyfus_httpd.erl:59:21: The pattern
{'ok', Bookmark0, TotalHits, Hits0} can never match the type
{'error', _} | {'ok', _, _, _, _, _}
src/dreyfus_index.erl:110:1: The inferred return type of init/1
('ok') has nothing in common with
'ignore' |
{'ok', _} |
{'stop', _} |
{'ok', _,
'hibernate' | 'infinity' |
non_neg_integer() |
{'continue', _}}, which is the expected return type for the
callback of the gen_server behaviour
src/dreyfus_index.erl:152:36: The created fun has no local return
src/dreyfus_index.erl:231:36: The created fun has no local return
src/dreyfus_index.erl:297:17: The variable Error can never match since
previous clauses completely covered the type
{'ok', non_neg_integer()}
src/dreyfus_index_updater.erl:23:1: Function update/2 has no local return
ERROR: dialyze failed while processing
/Users/iilyak/Code/couchdb/src/dreyfus: rebar_abort
make: *** [dialyze] Error 1
```
## Related Issues or Pull Requests
<!-- If your changes affect multiple components in different
repositories please put links to those issues or pull requests here.
-->
## Checklist
- [ ] Code is written and works correctly
- [ ] Changes are covered by tests
- [ ] Any new configurable parameters are documented in
`rel/overlay/etc/default.ini`
- [ ] Documentation changes were made in the `src/docs` folder
- [ ] Documentation changes were backported (separated PR) to affected
branches
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]