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

GothenburgBitFactory / taskwarrior / 29693910695

19 Jul 2026 03:58PM UTC coverage: 84.782% (-0.2%) from 84.997%
29693910695

Pull #4117

github

web-flow
Merge 2a56ced1a into bbbf3f9fd
Pull Request #4117: Add a (mostly) full Task FFI from TaskChampion

19599 of 23117 relevant lines covered (84.78%)

24198.81 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

98.0
/src/commands/CmdReports.cpp
1
////////////////////////////////////////////////////////////////////////////////
2
//
3
// Copyright 2006 - 2021, Tomas Babej, Paul Beckingham, Federico Hernandez.
4
//
5
// Permission is hereby granted, free of charge, to any person obtaining a copy
6
// of this software and associated documentation files (the "Software"), to deal
7
// in the Software without restriction, including without limitation the rights
8
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
// copies of the Software, and to permit persons to whom the Software is
10
// furnished to do so, subject to the following conditions:
11
//
12
// The above copyright notice and this permission notice shall be included
13
// in all copies or substantial portions of the Software.
14
//
15
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
16
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
// SOFTWARE.
22
//
23
// https://www.opensource.org/licenses/mit-license.php
24
//
25
////////////////////////////////////////////////////////////////////////////////
26

27
#include <cmake.h>
28
// cmake.h include header must come first
29

30
#include <CmdReports.h>
31
#include <Context.h>
32
#include <Table.h>
33
#include <format.h>
34
#include <util.h>
35

36
#include <sstream>
37

38
////////////////////////////////////////////////////////////////////////////////
39
CmdReports::CmdReports() {
4,621✔
40
  _keyword = "reports";
4,621✔
41
  _usage = "task          reports";
4,621✔
42
  _description = "Lists all supported reports";
4,621✔
43
  _read_only = true;
4,621✔
44
  _displays_id = false;
4,621✔
45
  _needs_gc = false;
4,621✔
46
  _needs_recur_update = false;
4,621✔
47
  _uses_context = false;
4,621✔
48
  _accepts_filter = false;
4,621✔
49
  _accepts_modifications = false;
4,621✔
50
  _accepts_miscellaneous = false;
4,621✔
51
  _category = Command::Category::config;
4,621✔
52
}
4,621✔
53

54
////////////////////////////////////////////////////////////////////////////////
55
int CmdReports::execute(std::string& output) {
3✔
56
  std::vector<std::string> reports;
3✔
57

58
  // Add custom reports.
59
  for (auto& i : Context::getContext().config) {
735✔
60
    if (i.first.substr(0, 7) == "report.") {
732✔
61
      std::string report = i.first.substr(7);
309✔
62
      auto columns = report.find(".columns");
309✔
63
      if (columns != std::string::npos) reports.push_back(report.substr(0, columns));
309✔
64
    }
309✔
65
  }
66

67
  // Add known reports.
68
  reports.push_back("burndown.annual");
6✔
69
  reports.push_back("burndown.daily");
6✔
70
  reports.push_back("burndown.monthly");
6✔
71
  reports.push_back("burndown.weekly");
6✔
72
  reports.push_back("ghistory.annual");
6✔
73
  reports.push_back("ghistory.monthly");
6✔
74
  reports.push_back("history.annual");
6✔
75
  reports.push_back("history.monthly");
6✔
76
  reports.push_back("information");
6✔
77
  reports.push_back("projects");
6✔
78
  reports.push_back("summary");
6✔
79
  reports.push_back("tags");
3✔
80

81
  std::sort(reports.begin(), reports.end());
3✔
82

83
  // Compose the output.
84
  std::stringstream out;
3✔
85
  Table view;
3✔
86
  view.width(Context::getContext().getWidth());
3✔
87
  view.add("Report");
6✔
88
  view.add("Description");
3✔
89
  setHeaderUnderline(view);
3✔
90

91
  for (auto& report : reports) {
90✔
92
    int row = view.addRow();
87✔
93
    view.set(row, 0, report);
87✔
94
    view.set(row, 1, Context::getContext().commands[report]->description());
87✔
95
  }
96

97
  out << optionalBlankLine() << view.render() << optionalBlankLine()
×
98
      << format("{1} reports\n", reports.size());
9✔
99

100
  output = out.str();
3✔
101
  return 0;
3✔
102
}
3✔
103

104
////////////////////////////////////////////////////////////////////////////////
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc