Skip to main content

Find unused parts of your Robot Framework project

Project description

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 Glob pattern 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 Glob pattern 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 Glob pattern 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 global 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 Glob pattern Only show variables who's name match the glob pattern. Matching without {brackets} and $@&% prefixes
-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 Show usage count for all files instead of only unused variables
-t, --show-tree Also show full import tree for every .robot file
--tree-max-depth Positive integer None Only when --show-tree: Limit import tree depth
--tree-max-height Positive integer None Only when --show-tree: Limit import tree height
-f, --filter Glob pattern Only show files who's path matches the glob pattern. When used with --show-tree: Only show trees for suite files that 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
-v, --verbose Show more log output. When provided twice: Show even more log output

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

robotframework_find_unused-0.8.0.tar.gz (36.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

robotframework_find_unused-0.8.0-py3-none-any.whl (61.8 kB view details)

Uploaded Python 3

File details

Details for the file robotframework_find_unused-0.8.0.tar.gz.

File metadata

  • Download URL: robotframework_find_unused-0.8.0.tar.gz
  • Upload date:
  • Size: 36.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.22 {"installer":{"name":"uv","version":"0.9.22","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}

File hashes

Hashes for robotframework_find_unused-0.8.0.tar.gz
Algorithm Hash digest
SHA256 f37c66b0e613d982512ad205c9fead1d11fac905442aa4d929e0bac07ebc8f6a
MD5 1c321f42650c8bfb15941e6669461a8c
BLAKE2b-256 bb5a619a755720ef496e67ae3c2a025ec36cfeb28d14ec0f4c7985f91eaa297a

See more details on using hashes here.

File details

Details for the file robotframework_find_unused-0.8.0-py3-none-any.whl.

File metadata

  • Download URL: robotframework_find_unused-0.8.0-py3-none-any.whl
  • Upload date:
  • Size: 61.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.22 {"installer":{"name":"uv","version":"0.9.22","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}

File hashes

Hashes for robotframework_find_unused-0.8.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5552cf2c77751d507cffa53ca8ee8d6ae7e6ab9f01a7ce81480a60d02bcfb04f
MD5 26833bd3f912adc515ebab0987927cd7
BLAKE2b-256 1a929c40dead7d99dc397503a5fadb311914bfeeab5400a5b5b62297b7f2da83

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page