[codeface] Re: [PATCH 4/9] Fixed typo bugs in code (noticed by pycharm).

  • From: Wolfgang Mauerer <wm@xxxxxxxxxxxxxxxx>
  • To: codeface@xxxxxxxxxxxxx
  • Date: Tue, 18 Nov 2014 15:24:32 +0100


Am 18/11/2014 14:25, schrieb Matthias Dittrich:
> Hi Wolfgang,
> 
> On 17.11.2014 16:16, Wolfgang Mauerer wrote:
>>
>> Am 17/10/2014 15:14, schrieb Matthias Dittrich:
>>> Renamed undefined "logger" symbol to "log" and the undefined
>>> "reg_end" symbol to "rev_end".
>> good catches, thanks. Maybe (just as an idea, no need to change
>> the patch) it would also make sense to integrate a pycharm run
>> into the testing framework, or require it as a pre-commit hook
>> for python code. --Wolfgang
> Because python is a dynamic language pycharm can often only trigger
> warnings in such cases.
> However from my usage I can say that those warnings were always real
> errors.
> On the other hand pycharm also checks naming conventions (which are not
> followed by the main codebase) so there is a huge list of warnings.
yes -- we do have some naming conventions that are documented in the
wiki, but they are not applied very consistently throughout the project.
This has partly historic reasons.

> And finally I'm not sure if pycharm even supports running via command
> line, if it does integrating it into the commit or testing process would
> certainly make sense!

okay. We could also use pylint as a command line tool to perform
such checks. Should you ever find time to implement a respective
patch, you're very welcome to submit it :)

Thanks, Wolfgang
> 
> But you are right, besides CI, I would highly suggest using PyCharm (or
> any good python IDE for that matter) to prevent such errors.
> PyCharm also noticed some unused functions and some other minor things
> throughout the code which should be looked into (I only looked at things
> within my code-path).
> 
> Best regards, Matthias
>>> Signed-off-by: Matthias Dittrich <matthi.d@xxxxxxxxx>
>>> ---
>>>   codeface/VCS.py | 6 +++---
>>>   1 file changed, 3 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/codeface/VCS.py b/codeface/VCS.py
>>> index 3522de5..5229981 100644
>>> --- a/codeface/VCS.py
>>> +++ b/codeface/VCS.py
>>> @@ -226,7 +226,7 @@ class gitVCS (VCS):
>>>           project including all subsystems) is stored under "__main__".
>>>           """
>>>           if self.repo == None:
>>> -            logger.critical("Repository unset in Git VCS")
>>> +            log.critical("Repository unset in Git VCS")
>>>               raise Error("Can't do anything without repo")
>>>             ## Retrieve and store the commit timestamp for the
>>> revision range
>>> @@ -338,7 +338,7 @@ class gitVCS (VCS):
>>>           revrange = ""
>>>             if rev_start == None and rev_end != None:
>>> -            revrange += reg_end
>>> +            revrange += rev_end
>>>           else:
>>>               if rev_start:
>>>                   revrange += "{0}..".format(rev_start)
>>> @@ -1115,7 +1115,7 @@ class gitVCS (VCS):
>>>           rev_start = self.rev_start
>>>           rev_end = self.rev_end
>>>           if rev_start == None and rev_end != None:
>>> -            revrange += reg_end
>>> +            revrange += rev_end
>>>           else:
>>>               if rev_start:
>>>                   revrange += "{0}..".format(rev_start)
>>>
> 
> 

Other related posts: