These are chat archives for coala/coala-bears

22nd
May 2016
Karan Sharma
@mr-karan
May 22 2016 12:40

Uhm, I need some help with goerrcheck bear. In the settings part, errcheck has optional arguments.
So, I added my arguments like


    @staticmethod
    def create_arguments(filename, file, config_file,
                         ignore: str='',
                         ignorepkg: str='',
                         ignoretests: str='',
                         tags: str='',
                         asserts: str='',
                         blank: str=''
                         ):


        args = ()
        if ignore:
            args += ("-ignore " +str(ignore),)
        if ignorepkg:
            args += ("-ignorepkg "+str(ignorepkg),)
        if blank:
            args += ("-blank",)
        if ignoretests:
            args += ("-ignoretests ",)
        if tags:
            args+= ("-tags "+str(tags),)
        if asserts:
            args+=("-asserts",)
        print(args)
        return args + (filename,)

When I check the log message, with

 coala --bears=GoErrCheckBear --files=simple.go -S 'ignore=hah' -L=DEBUG

I get:

 Running 'errcheck -ignore hah /home/karan/Work/gsoc/coala-bears/bears/go/simple.go'

which is basically correct, no? why doesn't the bear run at all?

Lasse Schuirmann
@sils
May 22 2016 12:47
@Makman2 ^ shouldn't he use your shell escape rather than manually supplying ' around?
Karan Sharma
@mr-karan
May 22 2016 12:47
hey, i edited the code. No need to use ' now, just checked
even errcheck -ignore hah <filename> would work
Lasse Schuirmann
@sils
May 22 2016 12:49
if you get Running ... then the bear is definitely running
otherwise you wouldn't get that log message right?
maybe something's wrong with your regex?
Karan Sharma
@mr-karan
May 22 2016 12:51
The bear works fine if no arguments are provided. And message are of the same format, so i think regex is fine
So, made some progress with debugging.
blank and asserts are 2 arguments which don't require any parameter
so doing
coala --bears=GoErrCheckBear --files=simple.go -S 'blank=''' -L=DEBUG
bear works
but not for -S 'ignore='hah''
Lasse Schuirmann
@sils
May 22 2016 12:55
'blank=''' looks really really wrong
Karan Sharma
@mr-karan
May 22 2016 12:56
well, yeah I meant
coala --bears=GoErrCheckBear --files=simple.go -S 'blank=""' -L=DEBUG
basically empty string
Mischa Krüger
@Makman2
May 22 2016 13:01
If you create argumentd
You need to split them manually like shell would do
e.g. you concat "--ignore "+ str(...)
These must be 2 elements
Btw you dont need str () the params are already strings
@mr-karan
Karan Sharma
@mr-karan
May 22 2016 13:03
oh. so,
args += ("-ignore " +(ignore),)
split this ?
yeah removed the str() params
Mischa Krüger
@Makman2
May 22 2016 13:04
Yes so ("ignore", ignore )
Cmdline tools assume they get everything splitted by the shell
if theres a space they try to take the arg completely with the space together
Karan Sharma
@mr-karan
May 22 2016 13:06
Got your point, thanks :)
Karan Sharma
@mr-karan
May 22 2016 13:11
Pushed, will make a new asciinema till then
cause that's the most fun part of developing a bear actually :P
Oh, I have to add docstrings also.
Alexandros Dimos
@Redridge
May 22 2016 14:30
This message was deleted
Alexandros Dimos
@Redridge
May 22 2016 21:01
can someone trigger a rebuild on appveyor for this pr
coala-analyzer/coala-bears#448
because I don't know how
Zatreanu Adrian-Gabriel
@Adrianzatreanu
May 22 2016 21:03
sure
done, restarted
@Redridge you simply need to login as coala instead of normal user :0
Alexandros Dimos
@Redridge
May 22 2016 21:04
thanks @Adrianzatreanu
how do I do that?
Zatreanu Adrian-Gabriel
@Adrianzatreanu
May 22 2016 21:04
logout
login with github
choose coala instead of normal user
Alexandros Dimos
@Redridge
May 22 2016 21:05
ah I got it