Skip to main content

Robot Framework Find Unused

Find unused parts of your Robot Framework project.

Robocop is great at finding unused parts in a single file. Find unused finds unused parts across all your project files.

Allows you to find unused:

  • Keywords
  • Keyword arguments
  • Keyword return statements
  • Global variables
  • Files

Installation

Install with pip

pip install robotframework-find-unused

How to use

This is a command-line tool.

  1. Open a command line in your Robot Framework project

  2. Run the following command to show available options:

    robotunused --help
    

Find unused keywords

Keywords command demo gif

Walk through your .robot, .resource, and .py files. In those files, count how often each keyword is used (called). Keywords with 0 uses are logged.

robotunused keywords

Please note that there are limitations. For an overview of current limitations, run the following command:

robotunused keywords --help

Available options

flag option default description
-c, --show-count Output usage count for all keywords instead of only unused keywords
-f, --filter Only output keywords who's name match the glob pattern. Match without library prefix
-d, --deprecated include / exclude / only include How to output deprecated keywords
-p, --private include / exclude / only include How to output private keywords
-l, --library include / exclude / only exclude How to output keywords from downloaded libraries
-u, --unused-library include / exclude exclude How to output unused keywords from downloaded libraries
-v, --verbose Show more log output. When provided twice: Show even more log output

Find unused keyword arguments

Arguments command demo gif

Walk through your .robot, .resource, and .py files. In those files, count how often each argument is used during a keyword call. Arguments with 0 uses are logged.

By default, will ignore arguments from unused keywords.

robotunused arguments

Please note that there are limitations. For an overview of current limitations, run the following command:

robotunused arguments --help

Available options

flag option default description
-c, --show-count Show usage count for all arguments instead of only unused arguments
-f, --filter Only output keywords who's name match the glob pattern. Match without library prefix
-d, --deprecated include / exclude / only include How to output deprecated keywords
-p, --private include / exclude / only include How to output private keywords
-l, --library include / exclude / only exclude How to output keywords from downloaded libraries
-u, --unused include / exclude / only exclude How to output unused keywords
-v, --verbose Show more log output. When provided twice: Show even more log output

Find unused keyword return statements

Returns command demo gif

Walk through your .robot, .resource, and .py files. In those files, count how often each keyword return value is used (assigned to a variable). Keywords whose return value is never useds are logged.

By default, will ignore arguments from unused keywords.

robotunused returns

Please note that there are limitations. For an overview of current limitations, run the following command:

robotunused returns --help

Available options

flag option default description
-c, --show-count Output usage count for all keywords instead of only keywords with unused returns
-f, --filter Only output keywords who's name match the glob pattern. Match without library prefix
-d, --deprecated include / exclude / only include How to output deprecated keywords
-p, --private include / exclude / only include How to output private keywords
-l, --library include / exclude / only exclude How to output keywords from downloaded libraries
-u, --unused include / exclude / only exclude How to output unused keywords
-v, --verbose Show more log output. When provided twice: Show even more log output

Find unused variables

Variables command demo gif

Walk through your .robot and .resource files. In those files, count how often each variable is used. Variables defined in a variables section or variable file with 0 uses are logged.

robotunused variables

Please note that there are limitations. For an overview of current limitations, run the following command:

robotunused variables --help

Available options

flag option default description
-c, --show-count Show usage count for all variables instead of only unused variables
-f, --filter Only show variables who's name match the glob pattern. Matching without {brackets} and $@&% prefixes
--pythonpath Same as --pythonpath in Robotframework: Additional locations (directories, ZIPs) where to search libraries and other extensions when they are imported. Multiple paths can be given by separating them with a colon (:) or by using this option several times. Given path can also be a glob pattern matching multiple paths.
-v, --verbose Show more log output. When provided twice: Show even more log output

Find unused files

Files command demo gif

For each of your .robot files, follow the full chain of imports. Files that are never (indirectly) imported by a .robot file are logged.

robotunused files

Please note that there are limitations. For an overview of current limitations, run the following command:

robotunused files --help

Available options

flag option default description
-c, --show-count Output usage count for all files instead of only unused files
-t, --show-tree Output file import trees for every .robot file
--tree-max-depth Positive integer (x>=0) 0 Only applies when using --show-tree. Maximum tree depth.
--tree-max-height Positive integer (x>=0) 0 Only applies when using --show-tree. Maximum tree height.
-f, --filter Only output files who's path match the glob pattern
-r, --resource include / exclude / only include How to output resource file imports
-l, --library include / exclude / only include How to output (custom) library file imports
-V, --variable include / exclude / only include How to output variable file imports
-u, --unused include / exclude / only include How to output unused file imports
--pythonpath Same as --pythonpath in Robotframework: Additional locations (directories, ZIPs) where to search libraries and other extensions when they are imported. Multiple paths can be given by separating them with a colon (:) or by using this option several times. Given path can also be a glob pattern matching multiple paths.
-v, --verbose Show more log output. When provided twice: Show even more log output

Limitations

Every command has limitations. To see an up-to-date list of limitations for each command, use the --help flag. Every limitation also has a Github issue. If you find a limitation without issue, it's a bug or knowledge gap. Please open an issue so it can be addressed.

The following is a list of generic limitations. These limitations apply to all commands.

Generic limitation 1: Less used filetypes are ignored

Find Unused supports .robot, .resource, and .py files. It also supports .json, .yaml, and .py variables files.

Anything else is unsupported. This includes older filetypes (like .html and .tsv) and less used filetypes (like .rst and rbt).

Generic limitation 2: No localization

Robot Framework supports localization. Find unused does not support it. Any language other than English will produce unexpected results.

Contributing

I'm open to contributions. Please contact me in the issues.

When contributing, you'll need uv to manage dependencies.

Linting

You can't merge with lint issues. This is enforced by the pipeline.

To run the linter, use the following command:

uv run ruff check

Testing

You can't merge with failing tests. This is enforced by the pipeline.

To run all tests, use the following command:

uv run pytest -n auto

Tasks

To manage various things, we use Invoke as a task runner.

To get a full list of available tasks, run:

uv run invoke --list

To run a task, run:

uv run invoke build

Metadata

Release files for robotframework-find-unused 0.9.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for robotframework-find-unused 0.9.1
File Size Uploaded
robotframework_find_unused-0.9.1.tar.gz 43.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for robotframework-find-unused 0.9.1
File Interpreter ABI Platform
robotframework_find_unused-0.9.1-py3-none-any.whl Python 3 none any Details

Total release size: 125.6 kB

Release files / robotframework_find_unused-0.9.1.tar.gz

Download URL robotframework_find_unused-0.9.1.tar.gz
Size 43.7 kB
Tags Source
SHA-256 checksum
How to use checksums
28159dc4b2b533e7398961e3c7107864ed20d502986cf8ec5cc4d730822ae441
BLAKE2b-256 checksum
How to use checksums
33e9a4010336527ad8f90a3a33eec0283d108c171a088986c74192174a47e187
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.8 {"installer":{"name":"uv","version":"0.10.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / robotframework_find_unused-0.9.1-py3-none-any.whl

Download URL robotframework_find_unused-0.9.1-py3-none-any.whl
Size 81.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
27a6f33ee193fd6a6d35fe7030e7e557492fccd5e1ae1936770c0d1ef60ecd81
BLAKE2b-256 checksum
How to use checksums
ad16ab1b3cba8489ba7a34381e61c32c7aba4c1fe5d6d4fba239783900d1f058
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.8 {"installer":{"name":"uv","version":"0.10.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

This release

0.9.1 This release

2 release files

0.9.0

2 release files

0.8.0

2 release files

0.7.0

2 release files

0.6.0

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page