• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

uber / piranha / #263
92%

Build:
DEFAULT BRANCH: master
Ran 06 Dec 2022 06:46PM UTC
Jobs 1
Files 16
Run time 1s
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

pending completion
#263

push

github-actions

web-flow
Handle the configuration chaos (#283)

I know this is a slightly large PR :| But it solves two mangled problems related to the way we handle our configurations.

Problem 1
There are two ways to use Piranha - as a binary (i.e. command line) and as a library (rust/python).
Currently our library has only one function (which is equivalent to our command line options).
To execute Piranha we provide it multiple command line options like - path_to_codebase, path_to_configurations, path_to_output and dry_run. Now path_to_configurations itself contains piranha_arguments.toml. This file contains more options to specify piranha's behavior like cleanup comments, delete an empty file, and so on.
All of this causes some chaos :|

Internally, we had a struct CommandLineArguments to capture the command line arguments. We also re-used this struct within the only function that our library provides.
We had another struct PiranhaConfiguration to capture the piranha_arguments.toml.
We then combined the contents of these two structs CommandLineArguments and PiranhaConfiguration into a larger struct PiranhaArguments and used PiranhaArguments as our oracle of configurations.
Unsurprisingly, it causes chaos especially when :

Handling default values
scenario where we want to expose the option via command line and piranha_arguments.toml
Testing required constructing the objects for these three structs
Solution
We just removed PiranhaConfigurations and CommandLineArguments :) We use the power of Rust macros to cleanly repurpose PiranhaArguments for parsing command line and piranha_arguments.toml.
We can choose what properties need to be part of toml_serde and clap (command line parsing library).
This also allows us to easily expose flags/features via command line, api or piranha_arguments.toml

We first read the PiranhaArguments from the toml file and then "merge" it with the PiranhaArguments we parsed from command line, or testing specs or Python API .

... (continued)

1141 of 1246 relevant lines covered (91.57%)

0.92 hits per line

Jobs
ID Job ID Ran Files Coverage
1 #263.1 06 Dec 2022 06:46PM UTC 0
91.57
Source Files on build #263
Detailed source file information is not available for this build.
  • Back to Repo
  • de2d604e on github
  • Prev Build on master
  • Next Build on master
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc