| File docs/uncov.1 changed (mode: 100644) (index 29a03a3..2444c26) |
| ... |
... |
Number of visible lines above and below changes. |
| 480 |
480 |
\f[B]uncov\-web\f[R]: true) |
\f[B]uncov\-web\f[R]: true) |
| 481 |
481 |
.PP |
.PP |
| 482 |
482 |
Whether line numbers are displayed in diffs. |
Whether line numbers are displayed in diffs. |
|
483 |
|
.PP |
|
484 |
|
\f[B]build\-count\f[R] (integer, \f[B]uncov\f[R]: 10, |
|
485 |
|
\f[B]uncov\-web\f[R]: 0) |
|
486 |
|
.PP |
|
487 |
|
Number of builds to show by default. |
|
488 |
|
The value of zero means \(lqunlimited\(rq. |
| 483 |
489 |
.SH FILES |
.SH FILES |
| 484 |
490 |
\f[B]<data\-directory>\f[R] in the following is either git\-directory |
\f[B]<data\-directory>\f[R] in the following is either git\-directory |
| 485 |
491 |
for a worktree (see \f[B]git\-worktree\f[R](1)) or for the repository |
for a worktree (see \f[B]git\-worktree\f[R](1)) or for the repository |
| File docs/uncov/07-configuration.md changed (mode: 100644) (index 3f8fc4c..5e144d9) |
| ... |
... |
Number of visible lines above and below changes. |
| 48 |
48 |
**diff-show-lineno** (boolean, **uncov**: false, **uncov-web**: true) |
**diff-show-lineno** (boolean, **uncov**: false, **uncov-web**: true) |
| 49 |
49 |
|
|
| 50 |
50 |
Whether line numbers are displayed in diffs. |
Whether line numbers are displayed in diffs. |
|
51 |
|
|
|
52 |
|
**build-count** (integer, **uncov**: 10, **uncov-web**: 0) |
|
53 |
|
|
|
54 |
|
Number of builds to show by default. The value of zero means "unlimited". |
| File src/Settings.cpp changed (mode: 100644) (index e6b5927..ff5b9e8) |
| ... |
... |
Settings::loadFromFile(const std::string &path) |
| 44 |
44 |
setMinFoldSize(props.get<int>("min-fold-size", minFoldSize)); |
setMinFoldSize(props.get<int>("min-fold-size", minFoldSize)); |
| 45 |
45 |
foldContext = props.get<int>("fold-context", foldContext); |
foldContext = props.get<int>("fold-context", foldContext); |
| 46 |
46 |
setPrintLineNoInDiff(props.get<bool>("diff-show-lineno", diffShowLineNo)); |
setPrintLineNoInDiff(props.get<bool>("diff-show-lineno", diffShowLineNo)); |
|
47 |
|
setBuildCount(props.get<int>("build-count", buildCount)); |
| 47 |
48 |
|
|
| 48 |
49 |
medLimit = std::max(0.0f, std::min(100.0f, medLimit)); |
medLimit = std::max(0.0f, std::min(100.0f, medLimit)); |
| 49 |
50 |
hiLimit = std::max(0.0f, std::min(100.0f, hiLimit)); |
hiLimit = std::max(0.0f, std::min(100.0f, hiLimit)); |
| |
| ... |
... |
Settings::setPrintLineNoInDiff(bool value) |
| 66 |
67 |
{ |
{ |
| 67 |
68 |
diffShowLineNo = value; |
diffShowLineNo = value; |
| 68 |
69 |
} |
} |
|
70 |
|
|
|
71 |
|
void |
|
72 |
|
Settings::setBuildCount(int value) |
|
73 |
|
{ |
|
74 |
|
buildCount = std::max(0, value); |
|
75 |
|
} |
| File src/Settings.hpp changed (mode: 100644) (index 4c560fa..562bb6b) |
| ... |
... |
public: |
| 40 |
40 |
// Loads some of the settings from file. Does nothing if it doesn't exist. |
// Loads some of the settings from file. Does nothing if it doesn't exist. |
| 41 |
41 |
void loadFromFile(const std::string &path); |
void loadFromFile(const std::string &path); |
| 42 |
42 |
|
|
|
43 |
|
/** |
|
44 |
|
* @brief Retrieves number of builds to show by default. |
|
45 |
|
* |
|
46 |
|
* @returns The number, which is 0 when there is no limit. |
|
47 |
|
*/ |
|
48 |
|
virtual int getBuildCount() const |
|
49 |
|
{ |
|
50 |
|
return buildCount; |
|
51 |
|
} |
|
52 |
|
|
| 43 |
53 |
public: // PrintingSettings only |
public: // PrintingSettings only |
| 44 |
54 |
virtual std::string getTimeFormat() const override |
virtual std::string getTimeFormat() const override |
| 45 |
55 |
{ |
{ |
| |
| ... |
... |
protected: |
| 104 |
114 |
*/ |
*/ |
| 105 |
115 |
void setPrintLineNoInDiff(bool value); |
void setPrintLineNoInDiff(bool value); |
| 106 |
116 |
|
|
|
117 |
|
/** |
|
118 |
|
* @brief Sets number of builds to show by default. |
|
119 |
|
* |
|
120 |
|
* @param value New value of the limit, use 0 for "unlimited". |
|
121 |
|
*/ |
|
122 |
|
void setBuildCount(int value); |
|
123 |
|
|
| 107 |
124 |
private: |
private: |
| 108 |
125 |
//! Percentage boundary between low and medium coverage. |
//! Percentage boundary between low and medium coverage. |
| 109 |
126 |
float medLimit = 70.0f; |
float medLimit = 70.0f; |
| |
| ... |
... |
private: |
| 117 |
134 |
bool diffShowLineNo = false; |
bool diffShowLineNo = false; |
| 118 |
135 |
//! Number of visible lines above and below interesting lines. |
//! Number of visible lines above and below interesting lines. |
| 119 |
136 |
int foldContext = 1; |
int foldContext = 1; |
|
137 |
|
//! Number of builds to show by default, 0 means "unlimited". |
|
138 |
|
int buildCount = 10; |
| 120 |
139 |
}; |
}; |
| 121 |
140 |
|
|
| 122 |
141 |
#endif // UNCOV_SETTINGS_HPP_ |
#endif // UNCOV_SETTINGS_HPP_ |
| File src/sub_commands.cpp changed (mode: 100644) (index 33a34d8..7b7390a) |
| ... |
... |
private: |
| 334 |
334 |
execImpl(const std::string &alias, |
execImpl(const std::string &alias, |
| 335 |
335 |
const std::vector<std::string> &args) override |
const std::vector<std::string> &args) override |
| 336 |
336 |
{ |
{ |
| 337 |
|
// By default limit number of builds to display to 10. |
|
|
337 |
|
// By default limit number of builds to a configurable number. |
| 338 |
338 |
bool limitBuilds = true; |
bool limitBuilds = true; |
| 339 |
|
unsigned int maxBuildCount = 10; |
|
|
339 |
|
unsigned int maxBuildCount = settings->getBuildCount(); |
| 340 |
340 |
if (tryParse(args, noArgsForm{})) { |
if (tryParse(args, noArgsForm{})) { |
| 341 |
341 |
// Nothing needs to be done, variable defaults are getting used. |
// Nothing needs to be done, variable defaults are getting used. |
| 342 |
342 |
} else if (auto parsed = tryParse(args, limitForm{})) { |
} else if (auto parsed = tryParse(args, limitForm{})) { |
| File tests/Settings.cpp changed (mode: 100644) (index a58e47c..989237e) |
| ... |
... |
operator==(const Settings &lhs, const Settings &rhs) |
| 29 |
29 |
&& lhs.printLineNoInDiff() == rhs.printLineNoInDiff() |
&& lhs.printLineNoInDiff() == rhs.printLineNoInDiff() |
| 30 |
30 |
&& lhs.getMinFoldSize() == rhs.getMinFoldSize() |
&& lhs.getMinFoldSize() == rhs.getMinFoldSize() |
| 31 |
31 |
&& lhs.getFoldContext() == rhs.getFoldContext() |
&& lhs.getFoldContext() == rhs.getFoldContext() |
| 32 |
|
&& lhs.isHtmlOutput() == rhs.isHtmlOutput(); |
|
|
32 |
|
&& lhs.isHtmlOutput() == rhs.isHtmlOutput() |
|
33 |
|
&& lhs.getBuildCount() == rhs.getBuildCount(); |
| 33 |
34 |
} |
} |
| 34 |
35 |
|
|
| 35 |
36 |
TEST_CASE("Loading from nonexistent file doesn't change anything", "[Settings]") |
TEST_CASE("Loading from nonexistent file doesn't change anything", "[Settings]") |
| |
| ... |
... |
TEST_CASE("Settings from correct config are applied", "[Settings]") |
| 61 |
62 |
CHECK(settings.getTabSize() == 4); |
CHECK(settings.getTabSize() == 4); |
| 62 |
63 |
CHECK(settings.getMinFoldSize() == 3); |
CHECK(settings.getMinFoldSize() == 3); |
| 63 |
64 |
CHECK(settings.getFoldContext() == 1); |
CHECK(settings.getFoldContext() == 1); |
|
65 |
|
CHECK(settings.getBuildCount() == 10); |
| 64 |
66 |
CHECK(!settings.printLineNoInDiff()); |
CHECK(!settings.printLineNoInDiff()); |
| 65 |
67 |
|
|
| 66 |
68 |
settings.loadFromFile("tests/test-configs/correct.ini"); |
settings.loadFromFile("tests/test-configs/correct.ini"); |
| |
| ... |
... |
TEST_CASE("Settings from correct config are applied", "[Settings]") |
| 69 |
71 |
CHECK(settings.getTabSize() == 2); |
CHECK(settings.getTabSize() == 2); |
| 70 |
72 |
CHECK(settings.getMinFoldSize() == 4); |
CHECK(settings.getMinFoldSize() == 4); |
| 71 |
73 |
CHECK(settings.getFoldContext() == 3); |
CHECK(settings.getFoldContext() == 3); |
|
74 |
|
CHECK(settings.getBuildCount() == 13); |
| 72 |
75 |
CHECK(settings.printLineNoInDiff()); |
CHECK(settings.printLineNoInDiff()); |
| 73 |
76 |
} |
} |
| 74 |
77 |
|
|
| |
| ... |
... |
TEST_CASE("Invalid values are handled sensibly", "[Settings]") |
| 104 |
107 |
CHECK(settings.getTabSize() == 1); |
CHECK(settings.getTabSize() == 1); |
| 105 |
108 |
CHECK(settings.getMinFoldSize() == 1); |
CHECK(settings.getMinFoldSize() == 1); |
| 106 |
109 |
CHECK(settings.getFoldContext() == 0); |
CHECK(settings.getFoldContext() == 0); |
|
110 |
|
CHECK(settings.getBuildCount() == 0); |
| 107 |
111 |
} |
} |
| 108 |
112 |
} |
} |
| File web/builds.ecpp changed (mode: 100644) (index 6c09310..19f076e) |
| ... |
... |
along with uncov. If not, see <http://www.gnu.org/licenses/>. |
| 24 |
24 |
#include <boost/range/adaptor/reversed.hpp> |
#include <boost/range/adaptor/reversed.hpp> |
| 25 |
25 |
|
|
| 26 |
26 |
#include "BuildHistory.hpp" |
#include "BuildHistory.hpp" |
|
27 |
|
#include "Settings.hpp" |
| 27 |
28 |
#include "listings.hpp" |
#include "listings.hpp" |
| 28 |
29 |
|
|
| 29 |
30 |
extern BuildHistory *globalBH; |
extern BuildHistory *globalBH; |
|
31 |
|
extern Settings *globalSettings; |
| 30 |
32 |
</%pre> |
</%pre> |
| 31 |
33 |
|
|
| 32 |
34 |
<%cpp> |
<%cpp> |
| |
| ... |
... |
along with uncov. If not, see <http://www.gnu.org/licenses/>. |
| 81 |
83 |
% ? globalBH->getBuilds() |
% ? globalBH->getBuilds() |
| 82 |
84 |
% : globalBH->getBuildsOn(branch); |
% : globalBH->getBuildsOn(branch); |
| 83 |
85 |
% namespace adaptors = boost::adaptors; |
% namespace adaptors = boost::adaptors; |
|
86 |
|
% const unsigned int maxBuildCount = globalSettings->getBuildCount(); |
|
87 |
|
% unsigned int i = 0; |
| 84 |
88 |
% for (const Build &build : adaptors::reverse(builds)) { |
% for (const Build &build : adaptors::reverse(builds)) { |
| 85 |
89 |
<tr> |
<tr> |
| 86 |
90 |
% const std::vector<std::string> descr = describeBuild(globalBH, build, |
% const std::vector<std::string> descr = describeBuild(globalBH, build, |
| |
| ... |
... |
along with uncov. If not, see <http://www.gnu.org/licenses/>. |
| 105 |
109 |
</div> |
</div> |
| 106 |
110 |
</td> |
</td> |
| 107 |
111 |
</tr> |
</tr> |
|
112 |
|
% if (++i == maxBuildCount && builds.size() - i > 1) { |
|
113 |
|
<tr> |
|
114 |
|
<td class="note" colspan="6"><$ builds.size() - i $> more builds were omitted</td> |
|
115 |
|
</tr> |
|
116 |
|
% break; |
|
117 |
|
% } |
| 108 |
118 |
% } |
% } |
| 109 |
119 |
|
|
| 110 |
120 |
</table> |
</table> |