milliams / plotlib

Compare 7e8873e ... +4 ... d1d456b

No flags found

Use flags to group coverage reports by test type, project and/or folders.
Then setup custom commit statuses and notifications for each flag.

e.g., #unittest #integration

#production #enterprise

#frontend #backend

Learn more about Codecov Flags here.

Showing 3 of 6 files from the diff.

@@ -2,6 +2,7 @@
Loading
2 2
The `page` module provides structures for laying out and rendering multiple views.
3 3
*/
4 4
5 +
use crate::errors;
5 6
use std::ffi::OsStr;
6 7
use std::path::Path;
7 8
@@ -12,8 +13,6 @@
Loading
12 13
use crate::errors::Result;
13 14
use crate::view::View;
14 15
15 -
use failure::ResultExt;
16 -
17 16
/**
18 17
A single page page laying out the views in a grid
19 18
*/
@@ -95,15 +94,15 @@
Loading
95 94
96 95
    The type of file will be based on the file extension.
97 96
    */
98 -
99 97
    pub fn save<P>(&self, path: P) -> Result<()>
100 98
    where
101 99
        P: AsRef<Path>,
102 100
    {
103 101
        match path.as_ref().extension().and_then(OsStr::to_str) {
104 -
            Some("svg") => svg::save(path, &self.to_svg()?)
105 -
                .context("saving svg")
106 -
                .map_err(From::from),
102 +
            Some("svg") => match svg::save(path, &self.to_svg()?) {
103 +
                    Ok(ok) => Ok(ok),
104 +
                    Err(error) => Err(errors::Error::FailedToSave(error))
105 +
                }
107 106
            _ => Ok(()),
108 107
        }
109 108
    }

@@ -25,7 +25,7 @@
Loading
25 25
26 26
    // A page with a single view is then saved to an SVG file
27 27
    Page::single(&v)
28 -
        .save("/tmp/scatter_one_length.svg")
28 +
        .save("target/scatter_one_length.svg")
29 29
        .unwrap();
30 30
}
31 31
@@ -51,7 +51,7 @@
Loading
51 51
52 52
    // A page with a single view is then saved to an SVG file
53 53
    Page::single(&v)
54 -
        .save("/tmp/scatter_zero_length.svg")
54 +
        .save("target/scatter_zero_length.svg")
55 55
        .unwrap();
56 56
}
57 57
@@ -75,6 +75,6 @@
Loading
75 75
76 76
    // // A page with a single view is then saved to an SVG file
77 77
    Page::single(&v)
78 -
        .save("/tmp/scatter_one_length.svg")
78 +
        .save("target/scatter_one_length.svg")
79 79
        .unwrap();
80 80
}

@@ -6,10 +6,10 @@
Loading
6 6
extent to plot and information about the axes. It knows how to render itself.
7 7
*/
8 8
9 +
use crate::errors;
9 10
use std;
10 11
use std::f64;
11 12
12 -
use failure::format_err;
13 13
use svg::Node;
14 14
15 15
use crate::axis;
@@ -129,21 +129,21 @@
Loading
129 129
        let default_x_range = self.default_x_range();
130 130
        let x_range = self.x_range.as_ref().unwrap_or(&default_x_range);
131 131
        if !x_range.is_valid() {
132 -
            return Err(format_err!(
133 -
                "Invalid x_range: {} >= {}. Please specify the x_range manually.",
134 -
                x_range.lower,
135 -
                x_range.upper
136 -
            ));
132 +
            return Err(errors::Error::InvalidRange {
133 +
                name: String::from("x"),
134 +
                lower: x_range.lower,
135 +
                upper: x_range.upper,
136 +
            });
137 137
        }
138 138
139 139
        let default_y_range = self.default_y_range();
140 140
        let y_range = self.y_range.as_ref().unwrap_or(&default_y_range);
141 141
        if !y_range.is_valid() {
142 -
            return Err(format_err!(
143 -
                "Invalid y_range: {} >= {}. Please specify the y_range manually.",
144 -
                y_range.lower,
145 -
                y_range.upper
146 -
            ));
142 +
            return Err(errors::Error::InvalidRange {
143 +
                name: String::from("y"),
144 +
                lower: x_range.lower,
145 +
                upper: x_range.upper,
146 +
            });
147 147
        }
148 148
149 149
        let x_label: String = self.x_label.clone().unwrap_or_else(|| "".to_string());
@@ -358,7 +358,11 @@
Loading
358 358
        let y_range = self.y_range.as_ref().unwrap_or(&default_y_range);
359 359
360 360
        if !y_range.is_valid() {
361 -
            return Err(format_err!("invalid y_range: {:?}", y_range));
361 +
            return Err(errors::Error::InvalidRange {
362 +
                name: String::from("y"),
363 +
                lower: y_range.lower,
364 +
                upper: y_range.upper,
365 +
            });
362 366
        }
363 367
364 368
        let default_x_label = "".to_string();

Learn more Showing 9 files with coverage changes found.

Changes in src/repr/plot.rs
-6
+4
Loading file...
Changes in src/style.rs
-1
Loading file...
Changes in tests/test_no_data.rs
-6
Loading file...
Changes in src/axis.rs
New
Loading file...
Changes in src/view.rs
-4
Loading file...
Changes in src/text_render.rs
-11
-3
Loading file...
Changes in src/page.rs
-2
Loading file...
Changes in src/repr/histogram.rs
-7
Loading file...
Changes in src/svg_render.rs
-29
+4
Loading file...
Files Coverage
src +1.36% 63.80%
tests/test_no_data.rs 100.00%
Project Totals (14 files) 64.37%
Loading