coala / coala-quickstart

A tool that generates an initial coala config file for you!
GNU Affero General Public License v3.0
47 stars 76 forks source link

Running modes in coala-quickstart #90

Open hemangsk opened 7 years ago

hemangsk commented 7 years ago

webServices Status

webServices doesn't support all the bears presently. It doesn't support the bears which have nonoptional settings. As a solution, what we can do is run coala-quickstart on the project and get relevant bears, by running quickstart in a --relevant-bears mode

relevant_bears = ["PEP8Bear", "PyLintBear", "SpaceConsistencyBear"]

Then ask users for the optional/non-optional settings of those bears, and send this to the backend saving it in a settings.json file.

bears_settings = {
"PEP8Bear" : {},
"PyLintBear" : {}.
"SpaceConsistencyBear" : { "use_spaces" : true }
}

Then coala-quickstart would run in --get-bears-settings = settings.json mode, and return the frontend a coafile, with bear settings.

Users will now click a "Run coala" button (or we can do that without asking user ?) and then we run coala on the project with the generated coafile, which has optional/non optional settings for bears and thus doesn't break the module.

screen shot 2017-05-08 at 11 31 27 am

Essentialy, frontend will send flags to the backend which will then decide the running mode of coala-quickstart.

cc @adtac @satwikkansal Thoughts?

satwikkansal commented 7 years ago

Then ask users for the optional/non-optional settings of those bears, and send this to the backend saving it in a settings.json file.

How are we going to ask users for the non-optional setting values :sweat_smile:

hemangsk commented 7 years ago

input fields, text boxies or radio buttons

On May 8, 2017 2:18 PM, "Satwik Kansal" notifications@github.com wrote:

Then ask users for the optional/non-optional settings of those bears, and send this to the backend saving it in a settings.json file.

How are we going to ask users for the non-optional setting values 😅

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/coala/coala-quickstart/issues/90#issuecomment-299809467, or mute the thread https://github.com/notifications/unsubscribe-auth/AMalylXJDpWPIRQb7SuPE7RbgOk0zXbQks5r3tbkgaJpZM4NThya .

hemangsk commented 7 years ago

coala.io already has the name of settings of all the bears (coala.io/languages), we can hence attach input fields to setting name,

For eg, suppose the backend returns,

relevant_bears = ['SpaceConsistencyBear']

Then we show the user a form and take inputs,

 allow_trailing_whitespace ____
 indent_size enforce_newline_at_EOF ___
 tab_width use_spaces ____

And then send these to the backend.

satwikkansal commented 7 years ago

I see, approach seems good to me one last doubt though, "What happens after the input values are taken in and ".coafile" is generated?" (do we run coala in non-interactive mode or do we display interactive results on the web like we do in the CLI)

satwikkansal commented 7 years ago

Also not sure if it's relevant but here's what I had in my GSoC proposal

Integrating coala-quickstart into coala’s try online feature: This would allow users to use the capabilities of coala-quickstart without having to install it. User inputs the github repository URL and a “placeholder_coafile” gets automatically committed to the repository. While performing analysis locally, coala will detect the placeholder_coafile and prompt the user for the non-optional settings and finally generate the complete coafile. The placeholder_coafile is generated after bypassing all the prompts for non-optional setting values in the characters and filling them with a sentinel value. Another add-on to this feature can be to commit the shell script to install the bear-dependencies as well.

hemangsk commented 7 years ago

Let me know what do you think of this, Presently acquire_settings function is passed as a parameter to coalib's fill_setting() by coala-quickstart to get input for settings (https://github.com/coala/coala-quickstart/blob/master/coala_quickstart/generation/Settings.py#L109). Then acquire_settings() calls the require_settings() function which keeps prompting on the coala-quickstart's console for bear settings input.

We can make a function in ConsoleInteraction acquire_settings_from_json() , on the lines of acquire_settings, which will take such json as parameter, and instead of calling require_settings, acquire_settings_from_json() will take the values from this json

bears_settings = {
"PEP8Bear" : {},
"PyLintBear" : {}.
"SpaceConsistencyBear" : { "use_spaces" : true }
}
sils commented 7 years ago

Sorry why do you want to ask the user for settings and pass them to coala-incremental? This doesn't make sense at all; quockstart is a tool to auto generate settings and not to run coala, where's the point in giving it settings? And it already has a ci mode.

hemangsk commented 7 years ago

Revamped Approach after Discussion


![screen shot 2017-05-29 at 4 24 01 pm](https://cloud.githubusercontent.com/assets/13018570/26547162/473e8118-448b-11e7-8ba5-ae2dd9f50458.png)
hemangsk commented 7 years ago

The plan is to add two options in quickstart, a --dir option to receive current project directory as command line argument, and --sections_only option to generate a coafile with useable as well as unusable bears in CI mode. Presently it only generates one with useable bears in --ci mode, ie, bears not having non optional settings)

sils commented 7 years ago

agree but we'll have to find a better name for sections_only, maybe like allow-incpmplete-sections or so

satwikkansal commented 7 years ago

Sounds nice :) Just couple of doubts :P

--sections_only option to generate a coafile with useable as well as unusable bears in CI mode

How would you differentiate between a usable and unusable bears in the coafile? I think we'll have to come up with a syntactical representation in "intermediate-coafile" to mark and identify the sections with unusable bears while parsing.

Also, what is the difference between "coala online" and "webservices" :P (to me it seems like one is "frontend" and other one is "backend")

hemangsk commented 7 years ago

Right now it removes the unusable bears with a function that specifically does this tasks. Unusable bears here implies those bears which will ask for setting, so that is why they are unuseable in normal CI mode. But with --ci + --allow-incomplete-sections mode (sections-only), no bears will be removed, that is why we will get unusable + usable bears. We don't need to differentiate then right? we will just send all the bears to user and ask for their settings. did I understood the question correctly?

Actually webServices has an endpoint editor, which we use to trigger coala, this endpoint + the frontend required for this endpoint is 'coala Online'.

satwikkansal commented 7 years ago

We don't need to differentiate then right? we will just send all the bears to user and ask for their settings. did I understood the question correctly?

Ah, okay... So the interaction is very similar to CLI interaction in quickstart.

The intermediate coafile only has sections with bear names and then we can ask for non-optional settings in the web interface, right?

hemangsk commented 7 years ago

Yeah exactly

On May 31, 2017 10:12 PM, "Satwik Kansal" notifications@github.com wrote:

We don't need to differentiate then right? we will just send all the bears to user and ask for their settings. did I understood the question correctly?

Ah, okay... So the interaction is very similar to CLI interaction in quickstart.

The intermediate coafile only has sections with bear names and then we can ask for non-optional settings in the web interface, right?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/coala/coala-quickstart/issues/90#issuecomment-305245936, or mute the thread https://github.com/notifications/unsubscribe-auth/AMalyg6tiixsdE89aULZ7gml9FN8oFJnks5r_ZhggaJpZM4NThya .