You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by GitBox <gi...@apache.org> on 2022/07/13 19:06:58 UTC

[GitHub] [couchdb] nickva commented on pull request #4103: Remove some left-over local endpoint clauses in replicator

nickva commented on PR #4103:
URL: https://github.com/apache/couchdb/pull/4103#issuecomment-1183578543

   I did diff with dialyzer with and without the change. Not sure if ran to completion (seems to have crashed before finishing).
   
   ```
   make dialyze apps=couch_replicator | tee ~/tmp/dialize_with_cleanup.txt
   ==> couch_replicator (build-plt)
   WARN:  ''build-plt'' command does not apply to directory /Users/nvatama/asf/rel
   WARN:  ''build-plt'' command does not apply to directory /Users/nvatama/asf
   ==> couch_replicator (dialyze)
   src/couch_replicator_api_wrap.erl:209: Function open_doc_revs/6 has no local return
   src/couch_replicator_api_wrap.erl:901: The pattern
            <Docs,
             {'ok', Results},
             'interactive_edit'> can never match the type
            <[any()],
             maybe_improper_list(),
             'remote'>
   src/couch_replicator_api_wrap.erl:923: The pattern
            <Docs,
             {'ok', Results},
             'replicated_changes'> can never match the type
            <[any()],
             maybe_improper_list(),
             'remote'>
   src/couch_replicator_api_wrap.erl:925: The pattern
            <_Docs,
             {'aborted', Results},
             'interactive_edit'> can never match the type
            <[any()],
             maybe_improper_list(),
             'remote'>
   src/couch_replicator_auth_session.erl:101: The pattern
             {'ok', HttpDb1, State} can never match the type
             'ignore' |
             {'error',
              'cookie_format_invalid' | 'cookie_not_found' |
              {'session_request_forbidden',
               string(),
               'undefined' | string()} |
              {'session_request_unauthorized',
               string(),
               'undefined' | string()} |
              {'session_requires_valid_user',
               string(),
               'undefined' | string()} |
              {'session_request_failed',
               string(),
               'undefined' | string(),
               _} |
              {'session_unexpected_result',
               string(),
               string(),
               'undefined' | string()}}
   src/couch_replicator_auth_session.erl:189: The pattern
             {'ok', State1} can never match the type
             {'error',
              'cookie_format_invalid' | 'cookie_not_found' |
              {'session_not_supported', string(), 'undefined' | string()} |
              {'session_request_forbidden',
               string(),
               'undefined' | string()} |
              {'session_request_unauthorized',
               string(),
               'undefined' | string()} |
              {'session_requires_valid_user',
               string(),
               'undefined' | string()} |
              {'session_request_failed',
               string(),
               'undefined' | string(),
               _} |
              {'session_unexpected_result',
               string(),
               string(),
               'undefined' | string()}}
   src/couch_replicator_auth_session.erl:199: The pattern
             {'ok', State1} can never match the type
             {'error',
              'cookie_format_invalid' | 'cookie_not_found' |
              {'session_not_supported', string(), 'undefined' | string()} |
              {'session_request_forbidden',
               string(),
               'undefined' | string()} |
              {'session_request_unauthorized',
               string(),
               'undefined' | string()} |
              {'session_requires_valid_user',
               string(),
               'undefined' | string()} |
              {'session_request_failed',
               string(),
               'undefined' | string(),
               _} |
              {'session_unexpected_result',
               string(),
               string(),
               'undefined' | string()}}
   src/couch_replicator_auth_session.erl:211: The pattern
             {'error', Error} can never match since previous clauses completely covered the type
             {'error', 'missing_credentials'} |
             {'ok', [byte()], [byte()], #httpdb{}}
   src/couch_replicator_auth_session.erl:243: The pattern
             {'ok', UpdatedState} can never match the type
             {'error', 'cookie_format_invalid' | 'cookie_not_found'}
   src/couch_replicator_doc_processor_worker.erl:43: The created fun has no local return
   src/couch_replicator_docs.erl:399: Invalid type specification for function couch_replicator_docs:parse_rep_db/3. The success typing is
             (<<_:56, _:_*8>> | {maybe_improper_list()},
             binary() | [any()],
             maybe_improper_list()) ->
                #httpdb{}
   src/couch_replicator_httpc.erl:325: Function maybe_retry/4 has no local return
   src/couch_replicator_scheduler.erl:813: Function job_ejson/1 has no local return
   src/couch_replicator_scheduler.erl:846: The call couch_replicator_utils:ejson_state_info
            ('_' | [{_, _}]) breaks the contract
             (binary() | 'nil') -> binary() | 'null'
   src/couch_replicator_scheduler.erl:854: The created fun has no local return
   src/couch_replicator_utils.erl:201: Invalid type specification for function couch_replicator_utils:remove_basic_auth_creds/1. The success typing is
             (#httpdb{auth_props :: maybe_improper_list()}) -> #httpdb{}
   src/couch_replicator_utils.erl:206: Invalid type specification for function couch_replicator_utils:set_basic_auth_creds/3. The success typing is
             ('undefined' |
             maybe_improper_list(binary() |
                                 maybe_improper_list(any(), binary() | []) |
                                 byte(),
                                 binary() | []),
             'undefined' |
             maybe_improper_list(binary() |
                                 maybe_improper_list(any(), binary() | []) |
                                 byte(),
                                 binary() | []),
             #httpdb{}) ->
                #httpdb{}
   src/couch_replicator_worker.erl:261: The created fun has no local return
   src/couch_replicator_worker.erl:267: Function fetch_doc/4 has no local return
   ERROR: dialyze failed while processing /Users/nvatama/asf/src/couch_replicator: rebar_abort
   make: *** [dialyze] Error 1
   ```
   
   It did find useful issues. Lots of stale dialyzer specs and missing non-local labels where we throw errors.


-- 
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: notifications-unsubscribe@couchdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org