Skip to content

New formatter suggestion: make keyword call use named parameters #1677

@Guekka

Description

@Guekka

Problem

In our code, we have some keywords with 15+ parameters (not my choice...)
Positional ordering is bound to fail, and I've already fixed many related issues

If we could instead force named arguments, errors would be much more obvious

Implementation

The main difficulty is that, as far as I know, robocop does not pass context to the formatters. For this formatter to work, a list of keyword definitions in the workspace would be needed. This could be done in a first pass, before running any formatter / check

Once we have the keyword definitions, the difficulty is the same as any standard formatter

Proof of concept

With Copilot, I wrote a quick PoC. It seems to work correctly. The main issue I had was that I need it to run before SplitTooLongLine, and the only way I found is to redefine the full list of formatters

Here's the code

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions