Skip to content

Commit 908d801

Browse files
src/analysis/nanopore.cpp: linting for pointer arithmetic
1 parent 399d966 commit 908d801

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

src/analysis/nanopore.cpp

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
#include <utility>
5252
#include <vector>
5353

54-
// NOLINTBEGIN(*-narrowing-conversions,*-pointer-arithmetic)
54+
// NOLINTBEGIN(*-narrowing-conversions)
5555

5656
// clang-format off
5757
static constexpr std::array<std::uint8_t, 256> encoding = {
@@ -315,6 +315,7 @@ struct mod_prob_buffer {
315315

316316
int n_types{};
317317
const auto types = bam_mods_recorded(m.get(), &n_types);
318+
// NOLINTNEXTLINE(*-pointer-arithmetic)
318319
if (n_types < 2 || (types[h_idx] != 'h' && types[m_idx] != 'm'))
319320
return false;
320321

@@ -337,7 +338,8 @@ count_states_fwd(const bamxx::bam_rec &aln, std::vector<CountSet> &counts,
337338
/* Move through cigar, reference and read positions without
338339
inflating cigar or read sequence */
339340
const auto beg_cig = bam_get_cigar(aln);
340-
const auto end_cig = beg_cig + get_n_cigar(aln);
341+
const auto end_cig =
342+
beg_cig + get_n_cigar(aln); // NOLINT(*-pointer-arithmetic)
341343

342344
auto rpos = get_pos(aln);
343345
auto ref_itr = std::cbegin(chrom) + rpos;
@@ -386,7 +388,8 @@ count_states_rev(const bamxx::bam_rec &aln, std::vector<CountSet> &counts,
386388
/* Move through cigar, reference and (*backward*) through read
387389
positions without inflating cigar or read sequence */
388390
const auto beg_cig = bam_get_cigar(aln);
389-
const auto end_cig = beg_cig + get_n_cigar(aln);
391+
const auto end_cig =
392+
beg_cig + get_n_cigar(aln); // NOLINT(*-pointer-arithmetic)
390393

391394
auto rpos = get_pos(aln);
392395
auto ref_itr = std::cbegin(chrom) + rpos;
@@ -440,6 +443,7 @@ get_tid_to_idx(
440443
for (std::int32_t i = 0; i < get_n_targets(hdr); ++i) {
441444
// "curr_name" gives a "tid_to_name" mapping allowing to jump
442445
// through "name_to_idx" and get "tid_to_idx"
446+
// NOLINTNEXTLINE(*-pointer-arithmetic)
443447
const std::string curr_name(hdr.h->target_name[i]);
444448
const auto name_itr(name_to_idx.find(curr_name));
445449
if (name_itr == std::cend(name_to_idx))
@@ -521,6 +525,7 @@ struct mod_prob_stats {
521525

522526
int n_types{};
523527
const auto types = bam_mods_recorded(m.get(), &n_types);
528+
// NOLINTNEXTLINE(*-pointer-arithmetic)
524529
if (n_types < 2 || (types[h_idx] != 'h' && types[m_idx] != 'm'))
525530
return;
526531

@@ -943,6 +948,7 @@ valid_modification_types(const std::string &infile,
943948
int n_types{};
944949
const auto types = bam_mods_recorded(m.get(), &n_types);
945950
// clang-format off
951+
// NOLINTBEGIN(*-pointer-arithmetic)
946952
valid_types = ((n_types == 0) ||
947953
(n_types == 1 && types[0] == 'C') ||
948954
(n_types >= 2 && types[0] == 'h' && types[1] == 'm'));
@@ -953,6 +959,7 @@ valid_modification_types(const std::string &infile,
953959
message += "type[" + std::to_string(i) +
954960
"]=" + std::to_string(static_cast<char>(types[i])) + "\n";
955961
}
962+
// NOLINTEND(*-pointer-arithmetic)
956963
}
957964
return std::make_pair(valid_types, message);
958965
}
@@ -1111,6 +1118,6 @@ main_nanocount(int argc, char *argv[]) { // NOLINT(*-avoid-c-arrays)
11111118
return EXIT_SUCCESS;
11121119
}
11131120

1114-
// NOLINTEND(*-narrowing-conversions,*-pointer-arithmetic)
1121+
// NOLINTEND(*-narrowing-conversions)
11151122

11161123
#endif

0 commit comments

Comments
 (0)