Re: [foreman-dev] Re: [POC] Automatic inspection of user-created provisioning templates

2017-10-02 Thread sshtein

Finally I have finished first stage of engine development - now there is a 
sinatra app that could be added to any rack app (although not tested) and 
can run as a standalone executable (for now using webrick).

Git repo is located here: https://github.com/ShimShtein/detective

Key files: 

   - lib/detective/web/endpoint.rb: Sinatra app that exposes the resources.
   - lib/detective/launcher.rb: Rubocop's CLI wrapper to make use of custom 
   cops.
   - bin/detective: Standalone mode executable.


I would really appreciate if you evaluate this code and see if it is 
something we want to work with.

One caveat though: I still didn't add the code responsible for erb 
handling, it will be added later.

Shim.



On Thursday, September 14, 2017 at 4:27:15 PM UTC+3, Shimon Shtein wrote:
>
> Ewoud:
>
> About rack endpoint: It should be created for use case 2, where the check 
> is running in "online"-ish mode. 
> I prefer creating it as a microservice for scalability reasons, so I 
> wouldn't want to tie it too tightly with foreman-templates. Besides that, 
> tying it into foreman-templates will mean the same life cycle that I would 
> prefer to avoid. 
> As I already wrote for case 1 and 3, we could use the underlying ruby 
> wrapper directly, hence avoid the usage of the API.
> As for additional dependencies, I probably would add passenger as an 
> optional (development) dependency, so you will have the full feature set on 
> development machines. In production it will check if if passenger is 
> available only if it runs in standalone mode. It will not ask for passenger 
> if someone has decided to use something else, like webrick (personally I 
> would recommend against webrick, it's not parallel at all which is 
> important here).
>
> About the command line tool, I have nothing against it, it should be 
> available in the gem.
>
>
>
>
>
> On Thu, Sep 14, 2017 at 2:06 PM, Ewoud Kohl van Wijngaarden <
> ew...@kohlvanwijngaarden.nl> wrote:
>
>> On Wed, Sep 13, 2017 at 12:05:49PM -0700, ssht...@redhat.com wrote:
>>
>>>
>>> First attempt to create a design. It's an open discussion, everyone who
>>> wants to chime in, please do.
>>>
>>> The engine: will be deployed as a separate gem. My name suggestion
>>> the-detective  
>>> (Sinatra
>>> plays a cop).
>>>
>>> It will wrap the invocation of rubocop with defaults and parameters 
>>> needed
>>> to support our use case:
>>> 1. Support for erb
>>> 2. Support for completely customized set of cops.
>>> 3. Parametrized list of folders containing cops to be added to the list.
>>>
>>> In addition it will add tooling to expose a rack endpoint for rubocop
>>> invocation:
>>> 1. List of all available cops (kind of metadata)
>>> 2. A POST method that receives a source file, list of cops, and output
>>> format that will return the result of rubocop's analysis.
>>> 3. Will be mountable to any Rails application
>>> 4. Will have an option to run as a standalone process (probably using
>>> passenger with sort-lived process retention settings, since its one 
>>> process
>>> per request nature)
>>>
>>
>> Why should it be a rack endpoint? My thinking was much more of a normal 
>> ruby API with a command line tool around it. There should be no passenger 
>> dependency to keep its dependencies small. foreman_templates can consume 
>> the ruby API and expose it to the user as it wants.
>>
>> Usage for foreman needs:
>>>
>>> Use case 1 (community templates CI):
>>> 1. Reference the detective gem from templates plugin.
>>> 2. Deploy foreman-core with templates plugin enabled.
>>> 3. Add rake task that will invoke rubocop on specified folder using
>>> detective's invocation wrapper.
>>>
>>
>> Ideally we'd have a light command line tool that does:
>>
>> detective \
>>  --cops /path/to/foreman/checkout/cops \
>>  --cops /path/to/katello/checkout/cops \
>>  --cops /path/to/other/plugin/with/cops \
>>  /path/to/some/template/dir \
>>  /path/to/another/template/dir
>>
>> That way we can do a simple git clone foreman in community-templates, 
>> bundle install and run it within Travis. This can indeed be wrapped in a 
>> rake task but given the paths can change on a developers workstation it is 
>> good to have an easy manual option.
>>
>> Use case 2 (Validate single template from templates UI)
>>> 1. Reference detective gem from templates plugin.
>>> 2. Add cops declaration ability to plugins in foreman core
>>> 3. Templates plugin is responsible for adding/maintaining detective's
>>> endpoint.
>>> 4. Foreman core exposes an option to add actions to template editing 
>>> screen.
>>> 5. Templates plugin uses extension point from 4 to add its own action 
>>> that
>>> will invoke detective's endpoint and modify template editor to show the
>>> result as linting (it's possible with ace and monaco).
>>>
>>> Use case 3 (upgrade scenario):
>>> As a first step, we can try and report broken templates after the 
>>> upgrade.
>>> It will be pretty 

Re: [foreman-dev] Form inputs and accessibility

2017-10-02 Thread Lukas Zapletal
I think there was a patch that added randomized IDs to all elements
which were missing it. I think it did not get it through review.

LZ

On Sat, Sep 30, 2017 at 6:33 PM, Ohad Levy  wrote:
>
>
> On Fri, Sep 29, 2017 at 7:16 PM, Walden Raines  wrote:
>>
>> Hey everyone,
>>
>> I would like to propose that we establish a requirement that all new form
>> inputs include both a unique ID attribute and a  like so:
>>
>> Name:
>> 
>>
>> For form fields where the is no label we should use bootstrap's .sr-only
>> class on the label to hide it like so:
>>
>> Name:
>> 
>>
>> This allows screen readers to relate a label field to an input in a
>> meaningful way making it easier for the visually impaired to use our
>> application (as an added bonus unique input IDs also allow for easier to
>> write and maintain QA automation).  It is important that the ID be unique to
>> the page so as not to confuse screen readers and also in order to produce
>> valid HTML.
>>
>> Please help this effort by keeping an eye out for new input fields that
>> on't have IDs and labels and if you happen to notice an input without an ID
>> and label please fix it.
>
> In foreman, its all going though a single code path, so a simple change to
>>
>>
>> https://github.com/theforeman/foreman/blob/develop/app/helpers/form_helper.rb#L326
>> will get what you are looking for.
>> See also [1].
>>
>> Thanks,
>> Walden
>>
>> [1] https://webaim.org/techniques/forms/controls#input
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "foreman-dev" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to foreman-dev+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "foreman-dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to foreman-dev+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



-- 
Later,
  Lukas @lzap Zapletal

-- 
You received this message because you are subscribed to the Google Groups 
"foreman-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to foreman-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.