Re: Transformation of contrib/check_GNU_style.sh to a python script

2017-05-24 Thread Martin Liška
On 05/22/2017 09:08 AM, Tom de Vries wrote: On 05/19/2017 03:47 PM, Martin Liška wrote: +if __name__ == '__main__': +if len(sys.argv) > 1: +main() +else: +unittest.main() Hi, when specifying no arguments to the script, I see: ... $ ./contrib/check_GNU_style.py . --

Re: Transformation of contrib/check_GNU_style.sh to a python script

2017-05-22 Thread Tom de Vries
On 05/19/2017 03:47 PM, Martin Liška wrote: +if __name__ == '__main__': +if len(sys.argv) > 1: +main() +else: +unittest.main() Hi, when specifying no arguments to the script, I see: ... $ ./contrib/check_GNU_style.py . ---

Re: Transformation of contrib/check_GNU_style.sh to a python script

2017-05-19 Thread Martin Liška
On 05/19/2017 12:39 PM, Tom de Vries wrote: > On 05/19/2017 11:51 AM, Martin Liška wrote: >> Hello. >> >> I'm sending final (slightly updated) version of the script. I'm also adding >> Jakub, >> because I remember he's got another regex patterns he's using for review >> process? >> Would it be fi

Re: Transformation of contrib/check_GNU_style.sh to a python script

2017-05-19 Thread Tom de Vries
On 05/19/2017 11:51 AM, Martin Liška wrote: Hello. I'm sending final (slightly updated) version of the script. I'm also adding Jakub, because I remember he's got another regex patterns he's using for review process? Would it be fine to just remove the old *.sh script, or is it preferred to hav

Re: Transformation of contrib/check_GNU_style.sh to a python script

2017-05-19 Thread Martin Liška
Hello. I'm sending final (slightly updated) version of the script. I'm also adding Jakub, because I remember he's got another regex patterns he's using for review process? Would it be fine to just remove the old *.sh script, or is it preferred to have them both living next to each other for some

Re: Transformation of contrib/check_GNU_style.sh to a python script

2017-05-16 Thread Martin Liška
On 05/15/2017 09:31 PM, Florian Weimer wrote: > * Martin Liška: > >> validate(pfile.target_file.lstrip('b/'), >> line.target_line_no, line.value) > > Violates line length constraint. :) Yep, fixed in another email in this thread. > > My own egrep script also checks for/switch/

Re: Transformation of contrib/check_GNU_style.sh to a python script

2017-05-16 Thread Martin Liška
On 05/15/2017 10:35 PM, Martin Sebor wrote: > On 05/15/2017 07:55 AM, Martin Liška wrote: >> Hello. >> >> Recently I've been working on bigger changes to dump infrastructure and I >> had to >> fix tens of formatting issues reported by check_GNU_style.sh script. The >> script works >> quite fine,

Re: Transformation of contrib/check_GNU_style.sh to a python script

2017-05-15 Thread Martin Sebor
On 05/15/2017 07:55 AM, Martin Liška wrote: Hello. Recently I've been working on bigger changes to dump infrastructure and I had to fix tens of formatting issues reported by check_GNU_style.sh script. The script works quite fine, but it's very unpleasant that it reports problematic lines in the

Re: Transformation of contrib/check_GNU_style.sh to a python script

2017-05-15 Thread Florian Weimer
* Martin Liška: > validate(pfile.target_file.lstrip('b/'), line.target_line_no, > line.value) Violates line length constraint. :) My own egrep script also checks for/switch/if/while/do on the same line as "{", and "(" not preceded by whitespace (currently has false positves with

Re: Transformation of contrib/check_GNU_style.sh to a python script

2017-05-15 Thread Tom de Vries
On 05/15/2017 03:55 PM, Martin Liška wrote: ... check_GNU_style.sh script. The script works quite fine, but it's very unpleasant that it reports problematic lines in the patch, not in original patches. Agreed. I decided to substitute part of functionality by Python script that uses a library

Re: Transformation of contrib/check_GNU_style.sh to a python script

2017-05-15 Thread Martin Liška
Sorry, wrong file. Martin #!/usr/bin/env python3 import sys import re from unidiff import PatchSet def report_error(filename, line_no, error): print('%s:%d:%s' % (filename, line_no, error)) def validate(filename, line_no, line): # 1: validate line length line_expanded = line.replac