Skip to content

Enhancement: Transform to add (or remove) container (e.g. library name or resource name) prefix on the front of keyword calls #54

Open
@sparkymartin

Description

@sparkymartin

We feel it is a best practice to always include the library name or resource name on the front of every keyword call. For example, instead of just saying Click Element (from the SeleniumLibrary). We say SeleniumLibrary.Click Element. Or, even better, we create a resource file called Selenium.resource which has a keyword called Click that is a wrapper for the Click Element keyword from the SeleniumLibrary. So, to call that Click keyword, our convention is to always write Selenium.Click. It would be great if a transform could be created for robotidy that would check for this convention and ensure that all keyword calls are prefixed with the library name or resource name that they are being called from. Alternatively, there could be a transform to ensure that library or resource prefixes are NOT included on keyword calls (for people who like the inverse).

Activity

bhirsz

bhirsz commented on Jun 11, 2021

@bhirsz
Member

I apologise for leaving this issue without the answer for so long - somewhow it escaped me.

It's more difficult to implement because we need to know the source of given keyword - although we could at least load libraries defined in particular *** Settings *** section and try to match it from there. And it's hard to also find keywords from dynamically loaded libraries (with Import Library keyword for example). But it's definitetly possible - I could try to implement MVP for it and see how it works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @sparkymartin@bhirsz

        Issue actions

          Enhancement: Transform to add (or remove) container (e.g. library name or resource name) prefix on the front of keyword calls · Issue #54 · MarketSquare/robotframework-tidy