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

GothenburgBitFactory / taskwarrior / 10152339701

29 Jul 2024 09:45PM UTC coverage: 84.437% (+0.07%) from 84.372%
10152339701

push

github

web-flow
Merge pull request #3566 from felixschurk/add-clang-format

Add clang-format to enforce style guide

12359 of 13760 new or added lines in 147 files covered. (89.82%)

123 existing lines in 42 files now uncovered.

19070 of 22585 relevant lines covered (84.44%)

19724.02 hits per line

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

97.92
/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,389✔
40
  _keyword = "reports";
4,389✔
41
  _usage = "task          reports";
4,389✔
42
  _description = "Lists all supported reports";
4,389✔
43
  _read_only = true;
4,389✔
44
  _displays_id = false;
4,389✔
45
  _needs_gc = false;
4,389✔
46
  _uses_context = false;
4,389✔
47
  _accepts_filter = false;
4,389✔
48
  _accepts_modifications = false;
4,389✔
49
  _accepts_miscellaneous = false;
4,389✔
50
  _category = Command::Category::config;
4,389✔
51
}
4,389✔
52

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

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

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

79
  std::sort(reports.begin(), reports.end());
2✔
80

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

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

NEW
95
  out << optionalBlankLine() << view.render() << optionalBlankLine()
×
96
      << format("{1} reports\n", reports.size());
2✔
97

98
  output = out.str();
2✔
99
  return 0;
2✔
100
}
2✔
101

102
////////////////////////////////////////////////////////////////////////////////
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