This Phase again went on a lazy start as I discovered extra things about the
project that were not included in my Phase 1 Pull Request. Some of the things that included were,
that we can actually pass optioanl settings to dependent bears, and there
is this method for linter bears
generate_config() which is used to generate
config files for the linters used by the linter bears (two entirely different things). So I had to parse
too for optional and non-optional settings. Here is a link to the PR.
The second focus was on adding value checks through type annotaion but highly
unsuccesfull in achieving that. I believe the value checks are never done
unless the program is executed with the
mypy package activated. Atleast
that’s my belief and I was unable to recreate a scenario or a short example
in which case any class that is added as a type annotation, for eg.
def func(string fruit: delicious_fruits)
In this case I have a string argument fruit which accepts anything that has
delicious_fruit might be a class. This class
can accept values, check it against some acceptable values and then return
appropriate string if it is found in the list of delicious fruits which again can be
maintained inside the class. This way the list of delicious fruits can
act as metadata and can be extracted by quickstart to get the list of all
possible acceptable values for the parameter
fruit which can then be checked
by passing all these values and checking if it fits the project.
The problem was any checks that I perform in this class were no working accept
the program is run with the
mypy package, like
python3 -m mypy coala
In which case it only does the value checks and skips the actual execution of the program.
The second solution which I created, was a decorator for this function to perform the same task which can be viewed over: here. Unfortuanately this was termed as unacceptable by the mainatainers (I do not completely understand why) and I don’t think it will ever get merged.
The biggest thing that I contemplated about was about the issue about the scalability of my project.
Bears check for a wide variety of things in the code from indent size to the cyclomactic complexity of the project. And when these settings can attain an awful lot of values (like any integer values), it is a must for me to add specific checks to guess these settings. So newly added bears mean new checks have to be introduced in the
--green-mode. The entire thing is done by the
QuickstartBear[*] mentioned in my cEP.
It is one thing to look for something in the
file_dictbut when there are 100s of bears, having 10s of settings, it becomes a headache to do so much stuff just to guess a setting for the bear. (I mean thats what bears are for, to check for those settings in the
file_dict, and it is making less and less sense for me to perform the same checks over in
QuickstartBearextracts the values for these settings from the
file_dict, for each file and some times even for each and every line, there is a task to accumulate these and get an appropriate value of it for the entire project. Sometimes the appropriate value can be max of all these values, sometimes it can be max of min for each file and sometime god knows what.
So, I am scared due to all these reasons that all these factors that are limiting me and slowing down my project, that they don’t affect me so much which leads to me failing this phase. Anyways hanging in there, tackling one problem at a time.
[*] for newbies to the blog, more about what is a cEP over here