fix: sonarcloud code smells (#2623)

* fix: make variable a pointer-to-const

* fix: use init-statement to reduce variable scope

* fix: implicit conversion from long to int

* fix: refactor to not nest more than 3 if|for|do|while|switch statements

* fix: make tr_session::setSocketTos() const

* fix: use array.prototype.some instead of a for loop

* refactor: use nullptr instead of NULL

* fix: oops
This commit is contained in:
Charles Kerr
2022-02-13 23:44:38 -06:00
committed by GitHub
parent 94c7208d82
commit d772824553
8 changed files with 17 additions and 32 deletions

View File

@@ -393,17 +393,9 @@ export class Torrent extends EventTarget {
// maybe filter by labels...
if (pass) {
for (const l of labels) {
let m = false;
for (let j = 0; j < this.getLabels().length; j++) {
if (l === this.getLabels()[j]) {
m = true;
break;
}
}
pass = pass && m;
}
// pass if this torrent has any of these labels
const torrent_labels = this.getLabels();
pass = labels.some((label) => torrent_labels.includes(label));
}
// maybe filter by tracker...