These are chat archives for coala/coala-bears

10th
Jan 2017
Robin Saleh-Jan
@robinsjdotcom
Jan 10 2017 00:18

I'm trying to create a unit test around a bear linter.

The bear is subclassing the GlobalBear class, but i'm getting this error when running:

__init__() takes from 1 to 2 positional arguments but 4 were given

I'm not overwriting the init method in my Bear class. This is how I create a instance of my class:

self.uut = CredoBear(file_dict, self.section, self.queue)

Where file_dict is a dictionary of files and the content of corresponding file, self.section is a instance of a Section class and self.queue is a empty Queue (per the documentation)

If I just pass the file_dict to the initialization of the Bear:

self.uut = CredoBear(file_dict)

I'm getting this error:

TypeError: getattr(): attribute name must be string

Any suggestions on what I'm missing? :)

Arjun Nemani
@nemaniarjun
Jan 10 2017 08:10
@robinsjdotcom why don't you see How's tests are written for other linters
Robin Saleh-Jan
@robinsjdotcom
Jan 10 2017 08:47

@nemaniarjun I am doing that, I'm using the CPDBear as a reference implementation.

Probably something I'm missing..

thanks

Lasse Schuirmann
@sils
Jan 10 2017 08:53
usually those things happen when self is involved to me
Adhityaa
@adtac
Jan 10 2017 11:40
bear proposal: identify python doctests that are probably not run
like
    This will print "Hi"
    >>> print("Not hi")
    Hi
this will actually not raise an exception IIRC
because there needs to be a linebreak between the english paragraph and the doctest
Lasse Schuirmann
@sils
Jan 10 2017 11:44
yes yes yes
just thought about the same just an hour ago
Adhityaa
@adtac
Jan 10 2017 11:45
we already have the python doc comments with annotationbear I think
Lasse Schuirmann
@sils
Jan 10 2017 11:45
pushed an update, I had this committed already but forgot to push
better commit message
Adhityaa
@adtac
Jan 10 2017 11:54
coala/coala-bears#1283
PyUnrunDoctestsBear unless someone has a better name :P
Yogesh Gupta
@incorrectusername
Jan 10 2017 12:01
hi, i'm a newcomer and i'm not sure what exactly needs to be fixed in coala/bear-docs#26 issue. Please help.
Muhammad Kaisar Arkhan
@yukiisbored
Jan 10 2017 12:02
@incorrectusername This may help you: https://github.com/yegor256/rultor
Basically, create a configuration file for rultor
Niklas
@NiklasMM
Jan 10 2017 12:02
@adtac what about PyIgnoredDoctestsBear? Or Hidden?
Unrun sounds a bit weird imho :D
Adhityaa
@adtac
Jan 10 2017 12:02
Ignored sounds better :)
Yogesh Gupta
@incorrectusername
Jan 10 2017 12:03
@yukiisbored thank you again :smile:
Muhammad Kaisar Arkhan
@yukiisbored
Jan 10 2017 12:03
np
Adhityaa
@adtac
Jan 10 2017 12:03
@incorrectusername take a look at coala/coala's rultor config (or coala/coala-bears or anything else with a rultor file)
Arjun Nemani
@nemaniarjun
Jan 10 2017 13:27
@NiklasMM Did you get your tests right?
Niklas
@NiklasMM
Jan 10 2017 13:30
uhm... what do you mean?
Yogesh Gupta
@incorrectusername
Jan 10 2017 13:49
i reffered .rultor.yml file in coala as well as coala-bears repo and the former has .misc and latter has .ci directory. there is no such directory in bear-docs. I need rultor to fetch those files but in bear-docs repo there is only docs directory.
Arjun Nemani
@nemaniarjun
Jan 10 2017 13:49
@NiklasMM Oops
I confused you with @robinsjdotcom
@robinsjdotcom Got you tests right?
Niklas
@NiklasMM
Jan 10 2017 13:49
^^ nvm
Naveen Kumar Sangi
@nkprince007
Jan 10 2017 13:53
How do we ignore long lines for URLs?
PyCodeStyle seems to be conflicting with it.
Muhammad Kaisar Arkhan
@yukiisbored
Jan 10 2017 13:54
@nkprince007 Add an ignore
Naveen Kumar Sangi
@nkprince007
Jan 10 2017 13:54
We already have a regex for LineLengthBear.
But PyCodeStyleBear seems to be conflicting with it.
Muhammad Kaisar Arkhan
@yukiisbored
Jan 10 2017 13:54
probably because PyCodeStyleBear has it's own line length rule
Naveen Kumar Sangi
@nkprince007
Jan 10 2017 13:55
Any probable way to avoid clashing?
Niklas
@NiklasMM
Jan 10 2017 13:55
or you can make max-line-length bigger
Muhammad Kaisar Arkhan
@yukiisbored
Jan 10 2017 13:55
@nkprince007 Make it into it's own section for the settings
Niklas
@NiklasMM
Jan 10 2017 13:55
for pycodestyle
Naveen Kumar Sangi
@nkprince007
Jan 10 2017 13:55
coala/coala-bears#1115 Anyway to resolve the errors here?
Naveen Kumar Sangi
@nkprince007
Jan 10 2017 14:09
Is there anyway to make PycodestyleBear to stop checking for the lines excluded by ignore_length_regex as stated by LineLengthBear?
Niklas
@NiklasMM
Jan 10 2017 14:12
no, since the underlying tool pycodestyle does not support this
Naveen Kumar Sangi
@nkprince007
Jan 10 2017 14:13
But isn't that what ignore_length_regex is used for?
Niklas
@NiklasMM
Jan 10 2017 14:13
no, that setting is for LineLenghtBear
Naveen Kumar Sangi
@nkprince007
Jan 10 2017 14:15
But, generally a user intends to use LineLengthBear's settings for line lengths, right? Why have another Bear setup to conflict with the original setting?
Niklas
@NiklasMM
Jan 10 2017 14:17
well, Pycodestyle checks for PEP8 compliance
a line length of <=79 is a requirement of PEP8
Naveen Kumar Sangi
@nkprince007
Jan 10 2017 14:18
Then, I don't think we need to have ignore_length_regexwhich exactly opposes PEP8 compliance on coala-bears.
Or we should go a little easy on PEP8 compliance.
Niklas
@NiklasMM
Jan 10 2017 14:19
did you check for other instances?
Naveen Kumar Sangi
@nkprince007
Jan 10 2017 14:20
Every other usage in .py files seems to have a line length <= 79
So, autopep8 doesn't seem to have issues elsewhere.
that's what this is about, yes?
Naveen Kumar Sangi
@nkprince007
Jan 10 2017 14:23
Yeah.
Niklas
@NiklasMM
Jan 10 2017 14:24
hmm, yeah I don't know what to do about this.
only thing I can come up with is have PycodestyleBear ignore the whole docstring
Robin Saleh-Jan
@robinsjdotcom
Jan 10 2017 14:25
@nemaniarjun Reading docs and looking at some other linters, will see if I can get it working. If not I'll just push it to my fork and ask for help here :)
Naveen Kumar Sangi
@nkprince007
Jan 10 2017 14:27
@NiklasMM But that just works here, I think.
What about making it generic?
Niklas
@NiklasMM
Jan 10 2017 14:28
I don't understand
making what generic?
Naveen Kumar Sangi
@nkprince007
Jan 10 2017 14:31
I mean like, we shouldn't be reporting line length errors when we explicitly asked coala not to.
I know that the bears don't work that way. But isn't that exactly what a user expects?
Niklas
@NiklasMM
Jan 10 2017 14:32
I agree that it can be confusing
but there is no easy way of achieving what you want
Naveen Kumar Sangi
@nkprince007
Jan 10 2017 14:33
How about just refusing the line length check from autopep8 when we specify ignore_length_regex?
Niklas
@NiklasMM
Jan 10 2017 14:36
we could add E501 (line too long) to the list of ignored errors
that would solve the issue
Lasse Schuirmann
@sils
Jan 10 2017 14:36
at least for aspects we're gonna do that
Yogesh Gupta
@incorrectusername
Jan 10 2017 16:53
i reffered .rultor.yml file in coala as well as coala-bears repo and the former has .misc and latter has .ci directory. there is no such directory in bear-docs. I need rultor to fetch those files but in bear-docs repo there is only docs directory.
I'm stuck here.