Changeset - e6894c2b4693
[Not reviewed]
0 3 0
Brett Smith - 4 years ago 2020-03-29 23:39:09
brettcsmith@brettcsmith.org
setup: Enable stricter type checking.

This caught the "return instead of raise" bug in meta_project.
3 files changed with 16 insertions and 7 deletions:
0 comments (0 inline, 0 general)
conservancy_beancount/plugin/meta_project.py
Show inline comments
...
 
@@ -45,3 +45,3 @@ class MetaProject(core._NormalizePostingMetadataHook):
 
        if repo_path is None:
 
            return self._config_error("no repository configured")
 
            raise self._config_error("no repository configured")
 
        project_data_path = repo_path / source_path
conservancy_beancount/rtutil.py
Show inline comments
...
 
@@ -39,2 +39,3 @@ TicketAttachmentIds = Tuple[str, Optional[str]]
 
_LinkCache = MutableMapping[TicketAttachmentIds, Optional[str]]
 
_URLLookup = Callable[..., Optional[str]]
 

	
...
 
@@ -127,3 +128,4 @@ class RTLinkCache(_LinkCache):
 
        cursor = self._db.execute('SELECT COUNT(*) FROM RTLinkCache')
 
        return cursor.fetchone()[0] + len(self._nourls)
 
        count: int = cursor.fetchone()[0]
 
        return count + len(self._nourls)
 

	
...
 
@@ -136,7 +138,8 @@ class RTLinkCache(_LinkCache):
 
        )
 
        retval = cursor.fetchone()
 
        if retval is None:
 
        row = cursor.fetchone()
 
        if row is None:
 
            raise KeyError(key)
 
        else:
 
            return retval[0]
 
            retval: str = row[0]
 
            return retval
 

	
...
 
@@ -193,3 +196,3 @@ class RT:
 
    # to be a method, it's just an internal decrator.
 
    def _cache_method(func: Callable) -> Callable:  # type:ignore[misc]
 
    def _cache_method(func: _URLLookup) -> _URLLookup:  # type:ignore[misc]
 
        @functools.wraps(func)
...
 
@@ -198,4 +201,5 @@ class RT:
 
                            attachment_id: Optional[RTId]=None,
 
        ) -> str:
 
        ) -> Optional[str]:
 
            cache_key = (str(ticket_id), attachment_id and str(attachment_id))
 
            url: Optional[str]
 
            try:
setup.cfg
Show inline comments
...
 
@@ -5,3 +5,8 @@ typecheck=pytest --addopts="--mypy conservancy_beancount"
 
[mypy]
 
disallow_any_unimported = True
 
show_error_codes = True
 
strict_equality = True
 
warn_redundant_casts = True
 
warn_return_any = True
 
warn_unreachable = True
 
warn_unused_configs = True
0 comments (0 inline, 0 general)