Skip to content

feat: add too-many-required-arguments and too-many-optional-arguments rules - #1933

Open
bhirsz wants to merge 1 commit into
mainfrom
feat/too-many-required-and-optional-arguments
Open

bhirsz wants to merge 1 commit into
mainfrom
feat/too-many-required-and-optional-arguments

Conversation

@bhirsz

@bhirsz bhirsz commented Sep 2, 2026

Copy link
Copy Markdown
Member

Adapts #1176 by @Lakitna to the current Robocop architecture (post robocop + robotidy merge) and re-opens it. Original authorship is preserved in the commit (authored by Sander van Beek).

Closes #1145

What changed

Adds two new lengths rules:

  • too-many-required-arguments (LEN34) - default limit max_args=5
  • too-many-optional-arguments (LEN35) - default limit max_args=10

These allow configuring separate limits for required vs optional keyword arguments. As discussed in #1145, the existing too-many-arguments (LEN07) rule is now disabled by default in favor of the two new rules.

Notes on adaptation

The original PR targeted the old rule/checker structure. In the new style:

  • Rules are declarative classes in src/robocop/linter/rules/lengths.py with a check() method; wiring lives in src/robocop/linter/checkers/test_case_keyword.py.
  • Rule IDs use the category prefix form (LEN34/LEN35) instead of the old numeric 0533/0534.
  • Acceptance tests moved to tests/linter/rules/lengths/too_many_{required,optional}_arguments/ and now also cover extended output.
  • docs/rules_list.md regenerated.

The main logic and test behavior mirror the original PR: required = arguments without a default, optional = arguments with a }= default; the [Arguments] setting is highlighted (already the behavior on too-many-arguments).

… rules

Adds two new lengths rules, LEN34 (too-many-required-arguments) and LEN35 (too-many-optional-arguments), which allow configuring separate limits for required and optional keyword arguments.

The existing too-many-arguments (LEN07) rule is disabled by default in favor of the new rules.

Co-authored-by: Bartlomiej Hirsz <bartek.hirsz@gmail.com>

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@Lakitna

Lakitna commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Looks good to me :) Thanks for pushing this across the finish line!

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Rule] Too many arguments without default

2 participants

Sponsor
SponsoredKunjungi sekarang
Promo