eBay / tsv-utils

eBay's TSV Utilities: Command line tools for large, tabular data files. Filtering, statistics, sampling, joins and more.
https://ebay.github.io/tsv-utils/
Boost Software License 1.0
1.43k stars 80 forks source link

Prefer enforce to throw #279

Closed jondegenhardt closed 4 years ago

jondegenhardt commented 4 years ago

Code refactoring - Prefer enforce (from std.exception) over if-test plus throw new Exception. Minor, but reduces the volume of code, especially in command line argument validation.

Found one bug in the process - Field ranges ending in zero were not getting caught during command line argument checking. Only occurs in cases where zero is a valid value, and its for field ranges in reverse order so a rare case.

Added a couple missed unit tests, all in command line argument validation.

codecov-io commented 4 years ago

Codecov Report

Merging #279 into master will increase coverage by 0.08%. The diff coverage is 99.38%.

@@            Coverage Diff             @@
##           master     #279      +/-   ##
==========================================
+ Coverage   99.15%   99.24%   +0.08%     
==========================================
  Files          17       17              
  Lines        5684     5689       +5     
==========================================
+ Hits         5636     5646      +10     
+ Misses         48       43       -5     
Impacted Files Coverage Δ
tsv-split/src/tsv_utils/tsv-split.d 98.50% <95.83%> (-0.01%) :arrow_down:
common/src/tsv_utils/common/utils.d 100.00% <100.00%> (+0.26%) :arrow_up:
csv2tsv/src/tsv_utils/csv2tsv.d 100.00% <100.00%> (+0.68%) :arrow_up:
tsv-append/src/tsv_utils/tsv-append.d 97.89% <100.00%> (ø)
tsv-filter/src/tsv_utils/tsv-filter.d 100.00% <100.00%> (ø)
tsv-join/src/tsv_utils/tsv-join.d 100.00% <100.00%> (ø)
tsv-pretty/src/tsv_utils/tsv-pretty.d 99.32% <100.00%> (+<0.01%) :arrow_up:
tsv-sample/src/tsv_utils/tsv-sample.d 99.43% <100.00%> (ø)
tsv-select/src/tsv_utils/tsv-select.d 100.00% <100.00%> (ø)
tsv-summarize/src/tsv_utils/tsv-summarize.d 98.18% <100.00%> (-0.01%) :arrow_down:
... and 1 more