FWDekker / intellij-randomness

IntelliJ plugin for inserting random numbers, UUIDs, names, IP addresses, and much more
https://plugins.jetbrains.com/plugin/9836-randomness
MIT License
45 stars 7 forks source link
idea intellij intellij-platform intellij-plugin jetbrains random random-generation random-number-generator


Randomness

Downloads Rating Release
CI status Coverage Documentation

Rather than going to random.org or making up your own random data, you can now insert random numbers, UUIDs, names, IP addresses, and much more using an IntelliJ action!

This plugin is also available on the plugin repository!

📖 How to use

To insert random data, press Alt + R (or ⌥R) to open the list of available templates and choose one that suits your task. By default, a different value is inserted at each caret.

You can modify this behavior by holding a key while selecting the type of data to insert:

You can hold multiple modifier keys to combine their effects.

Randomness can also be found in the main menu under Tools or in Code > Generate.

Animation of how to insert data

✨ Features

💻 Development

This section contains instructions in case you want to build the plugin from source or want to help with development. Please also check the contribution guidelines.

🔨 Build/run

$ gradlew runIde                       # Open a sandbox IntelliJ instance running the plugin
$ gradlew buildPlugin                  # Build an installable zip of the plugin
$ gradlew buildPlugin -Pbuild.hotswap  # Same as above, but allow hot-swapping the plugin during development
$ gradlew signPlugin                   # Sign built plugin

Signing the plugin requires specific environment variables to be set to refer to appropriate key files. See Plugin Signing for more information.

🧪 Quality assurance

$ gradlew test                    # Run tests (and collect coverage)
$ gradlew test --tests X          # Run tests in class X (package name optional)
$ gradlew test -Pkotest.tags="X"  # Run tests matching tag(s) X (also supports not (!), and (&), or (|))
$ gradlew koverHtmlReport         # Create HTML coverage report for previous test run
$ gradlew check                   # Run tests and static analysis
$ gradlew runPluginVerifier       # Check for compatibility issues

🏷️ Tagging and filtering tests

Kotest tests can be tagged to allow selectively running tests. The tags for Randomness are statically defined in Tags.

Tag an entire test class by adding tags(...) to the class definition, or tag an individual test context by writing context("foo").config(tags = setOf(...)) {. It is not possible to tag an individual test due to limitations in Kotest.

To run only one context in some test class X, prefix the context's name with f: and run with --tests X. The prefix f: filters out other contexts in that test class, and --tests X filters out other test classes. Alternatively, tag the desired context with the Focus tag and run with -Pkotest.tags="Focus" to filter by that tag.

📚 Documentation

$ gradlew dokkaHtml  # Generate documentation

🖼 Icons

The icons used by the plugin are found in the file icons.sketch. You can open this file with Sketch (macOS), Lunacy (Windows), or Figma (Linux).

🙏 Acknowledgements

I want to thank everyone who contributed something to Randomness, no matter the size of that contribution.

In chronological order of contribution:

If I should add, remove, or change anything here, just open an issue or email me!