Skip to content

Commit 4cdb6f3

Browse files
addressing clang comments
Signed-off-by: AdityaPandeyCN <adityapand3y666@gmail.com>
1 parent 3282c59 commit 4cdb6f3

File tree

3 files changed

+21
-21
lines changed

3 files changed

+21
-21
lines changed

src/ramcore/SamToNTuple.cxx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66
#include <cstdint>
77
#include <cstdio>
88
#include <map>
9-
#include <memory>
9+
#include <memory> // NOLINT(misc-include-cleaner) - used for std::unique_ptr
1010
#include <mutex>
1111
#include <string>
12-
#include <thread>
13-
#include <unordered_set>
14-
#include <vector>
12+
#include <thread> // NOLINT(misc-include-cleaner) - used for std::thread
13+
#include <unordered_set> // NOLINT(misc-include-cleaner) - used for std::unordered_set
14+
#include <vector> // NOLINT(misc-include-cleaner) - used for std::vector
1515

1616
#include <ROOT/RNTupleModel.hxx>
1717
#include <ROOT/RNTupleWriter.hxx>
@@ -24,9 +24,9 @@
2424
#include <TFile.h>
2525
#include <TROOT.h>
2626

27-
void samtoramntuple(const char *datafile, const char *treefile, bool index, bool split,
28-
bool cache, // NOLINT(misc-use-internal-linkage)
29-
int compression_algorithm, uint32_t quality_policy)
27+
void samtoramntuple(const char *datafile, const char *treefile, bool index,
28+
bool split, // NOLINT(misc-use-internal-linkage) - public API function
29+
bool cache, int compression_algorithm, uint32_t quality_policy)
3030
{
3131
(void)split;
3232
(void)cache;

test/ramcoretests.cxx

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
class ramcoreTest : public ::testing::Test {
1717
protected:
18-
void SetUp() override
18+
void SetUp() override // NOLINT(readability-convert-member-functions-to-static) - virtual method in Google Test
1919
{
2020
const int num_reads_for_test = 100;
2121
GenerateSAMFile("samexample.sam", num_reads_for_test);
@@ -24,14 +24,14 @@ class ramcoreTest : public ::testing::Test {
2424
std::remove("test_rntuple.root");
2525
}
2626

27-
void TearDown() override
27+
void TearDown() override // NOLINT(readability-convert-member-functions-to-static) - virtual method in Google Test
2828
{
2929
std::remove("test_ttree.root");
3030
std::remove("test_rntuple.root");
3131
}
3232
};
3333

34-
TEST_F(ramcoreTest, ConversionProducesEqualEntries)
34+
TEST_F(ramcoreTest, ConversionProducesEqualEntries) // NOLINT(misc-use-internal-linkage) - TEST_F is a macro
3535
{
3636
const char *samFile = "samexample.sam";
3737
const char *ttreeFile = "test_ttree.root";
@@ -59,13 +59,11 @@ TEST_F(ramcoreTest, ConversionProducesEqualEntries)
5959

6060
testing::internal::CaptureStdout();
6161
ramview(ttreeFile, region, /*cache=*/true, /*perfstats=*/false, /*perfstatsfilename=*/nullptr);
62-
std::string ramview_output;
63-
ramview_output = testing::internal::GetCapturedStdout();
62+
std::string ramview_output = testing::internal::GetCapturedStdout();
6463

6564
testing::internal::CaptureStdout();
6665
ramntupleview(rntupleFile, region, /*cache=*/true, /*perfstats=*/false, /*perfstatsfilename=*/nullptr);
67-
std::string ramntupleview_output;
68-
ramntupleview_output = testing::internal::GetCapturedStdout();
66+
std::string ramntupleview_output = testing::internal::GetCapturedStdout();
6967

7068
EXPECT_TRUE(ramview_output.find("Found") != std::string::npos);
7169
EXPECT_TRUE(ramntupleview_output.find("Found") != std::string::npos);

tools/samtoramntuple.cxx

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#include "ramcore/SamToNTuple.h"
22
#include "rntuple/RAMNTupleRecord.h"
3+
#include <exception>
34
#include <iostream>
45
#include <string>
56
#include <cstring>
@@ -8,7 +9,8 @@
89
int main(int argc, char *argv[])
910
{
1011
if (argc < 2) {
11-
std::cout << "Usage: " << argv[0] << " <input.sam> [output]\n";
12+
std::cout << "Usage: " << argv[0]
13+
<< " <input.sam> [output]\n"; // NOLINT(cppcoreguidelines-pro-bounds-pointer-arithmetic)
1214
std::cout << "Options:\n";
1315
std::cout << " -split Split by chromosome\n";
1416
std::cout << " -only <chr> When used with -split, emit only the specified chromosome (repeatable)\n";
@@ -18,7 +20,7 @@ int main(int argc, char *argv[])
1820
return 1;
1921
}
2022

21-
const char *input = argv[1];
23+
const char *input = argv[1]; // NOLINT(cppcoreguidelines-pro-bounds-pointer-arithmetic)
2224
const char *output = nullptr;
2325

2426
bool do_split = false;
@@ -27,13 +29,13 @@ int main(int argc, char *argv[])
2729
std::vector<std::string> only_chromosomes;
2830

2931
for (int i = 2; i < argc; i++) {
30-
std::string arg = argv[i];
32+
std::string arg = argv[i]; // NOLINT(cppcoreguidelines-pro-bounds-pointer-arithmetic)
3133
if (arg == "-split") {
3234
do_split = true;
3335
} else if (arg == "-only") {
3436
if (i + 1 < argc) {
3537

36-
only_chromosomes.emplace_back(argv[++i]);
38+
only_chromosomes.emplace_back(argv[++i]); // NOLINT(cppcoreguidelines-pro-bounds-pointer-arithmetic)
3739
} else {
3840
std::cerr << "-only expects a chromosome name\n";
3941
return 1;
@@ -42,14 +44,14 @@ int main(int argc, char *argv[])
4244
do_index = false;
4345
} else if (arg == "-illumina") {
4446
quality_mode = RAMNTupleRecord::kIlluminaBinning;
45-
} else if (arg == "-dropqual") {
47+
} else if (arg == "-dropqual") { // NOLINT(bugprone-branch-clone) - different values assigned
4648
quality_mode = RAMNTupleRecord::kDrop;
4749
} else if (arg[0] != '-') {
48-
output = argv[i];
50+
output = argv[i]; // NOLINT(cppcoreguidelines-pro-bounds-pointer-arithmetic)
4951
}
5052
}
5153

52-
std::string outfile;
54+
std::string outfile{};
5355
if (!output) {
5456
outfile = std::string(input);
5557
size_t pos = outfile.rfind(".sam");

0 commit comments

Comments
 (0)