Skip to content

Commit

Permalink
Sonarlint
Browse files Browse the repository at this point in the history
  • Loading branch information
rolljee committed Sep 25, 2023
1 parent 0d41305 commit 677c686
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions lib/service/storage/elasticsearch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1980,7 +1980,7 @@ export default class ElasticSearch extends Service {
*
* bulk body can contain more than 10K elements
*/
for (let i = 0; i < body.items.length; i++) {
for (let i = 0; i < body.items.length; i++) { //NOSONAR

Check failure on line 1983 in lib/service/storage/elasticsearch.ts

View workflow job for this annotation

GitHub Actions / Lint - Node.js LTS 16

Insert `⏎·····`

Check failure on line 1983 in lib/service/storage/elasticsearch.ts

View workflow job for this annotation

GitHub Actions / Lint - Node.js LTS 18

Insert `⏎·····`
const row = body.items[i];
const action = Object.keys(row)[0];
const item = row[action];
Expand Down Expand Up @@ -2318,7 +2318,7 @@ export default class ElasticSearch extends Service {
const errors = [];
const items = [];

for (let i = 0; i < body.docs.length; i++) {
for (let i = 0; i < body.docs.length; i++) { //NOSONAR

Check failure on line 2321 in lib/service/storage/elasticsearch.ts

View workflow job for this annotation

GitHub Actions / Lint - Node.js LTS 16

Insert `⏎·····`

Check failure on line 2321 in lib/service/storage/elasticsearch.ts

View workflow job for this annotation

GitHub Actions / Lint - Node.js LTS 18

Insert `⏎·····`
const doc = body.docs[i];

if (doc.found) {
Expand Down Expand Up @@ -2530,7 +2530,7 @@ export default class ElasticSearch extends Service {
*
* request can contain more than 10K elements
*/
for (let i = 0; i < extractedDocuments.length; i++) {
for (let i = 0; i < extractedDocuments.length; i++) { //NOSONAR

Check failure on line 2533 in lib/service/storage/elasticsearch.ts

View workflow job for this annotation

GitHub Actions / Lint - Node.js LTS 16

Insert `⏎·····`

Check failure on line 2533 in lib/service/storage/elasticsearch.ts

View workflow job for this annotation

GitHub Actions / Lint - Node.js LTS 18

Insert `⏎·····`
esRequest.body.push({
index: {
_id: extractedDocuments[i]._id,
Expand Down Expand Up @@ -2594,7 +2594,7 @@ export default class ElasticSearch extends Service {
*
* request can contain more than 10K elements
*/
for (let i = 0; i < extractedDocuments.length; i++) {
for (let i = 0; i < extractedDocuments.length; i++) { //NOSONAR

Check failure on line 2597 in lib/service/storage/elasticsearch.ts

View workflow job for this annotation

GitHub Actions / Lint - Node.js LTS 16

Insert `⏎·····`

Check failure on line 2597 in lib/service/storage/elasticsearch.ts

View workflow job for this annotation

GitHub Actions / Lint - Node.js LTS 18

Insert `⏎·····`
const extractedDocument = extractedDocuments[i];

if (typeof extractedDocument._id === "string") {
Expand Down Expand Up @@ -2709,7 +2709,7 @@ export default class ElasticSearch extends Service {
*
* request can contain more than 10K elements
*/
for (let i = 0; i < extractedDocuments.length; i++) {
for (let i = 0; i < extractedDocuments.length; i++) { //NOSONAR

Check failure on line 2712 in lib/service/storage/elasticsearch.ts

View workflow job for this annotation

GitHub Actions / Lint - Node.js LTS 16

Insert `⏎·····`

Check failure on line 2712 in lib/service/storage/elasticsearch.ts

View workflow job for this annotation

GitHub Actions / Lint - Node.js LTS 18

Insert `⏎·····`
esRequest.body.push(
{
update: {
Expand Down Expand Up @@ -2877,7 +2877,7 @@ export default class ElasticSearch extends Service {
*
* request can contain more than 10K elements
*/
for (let i = 0; i < ids.length; i++) {
for (let i = 0; i < ids.length; i++) { //NOSONAR

Check failure on line 2880 in lib/service/storage/elasticsearch.ts

View workflow job for this annotation

GitHub Actions / Lint - Node.js LTS 16

Insert `⏎·····`

Check failure on line 2880 in lib/service/storage/elasticsearch.ts

View workflow job for this annotation

GitHub Actions / Lint - Node.js LTS 18

Insert `⏎·····`
const _id = ids[i];

if (typeof _id === "string") {
Expand All @@ -2902,7 +2902,7 @@ export default class ElasticSearch extends Service {
*
* request can contain more than 10K elements
*/
for (let i = 0; i < validIds.length; i++) {
for (let i = 0; i < validIds.length; i++) { //NOSONAR

Check failure on line 2905 in lib/service/storage/elasticsearch.ts

View workflow job for this annotation

GitHub Actions / Lint - Node.js LTS 16

Insert `⏎·····`

Check failure on line 2905 in lib/service/storage/elasticsearch.ts

View workflow job for this annotation

GitHub Actions / Lint - Node.js LTS 18

Insert `⏎·····`
const validId = validIds[i];
const item = items[idx];

Expand Down Expand Up @@ -3037,7 +3037,7 @@ export default class ElasticSearch extends Service {
*
* request can contain more than 10K elements
*/
for (let i = 0; i < documents.length; i++) {
for (let i = 0; i < documents.length; i++) { //NOSONAR

Check failure on line 3040 in lib/service/storage/elasticsearch.ts

View workflow job for this annotation

GitHub Actions / Lint - Node.js LTS 16

Insert `⏎·····`

Check failure on line 3040 in lib/service/storage/elasticsearch.ts

View workflow job for this annotation

GitHub Actions / Lint - Node.js LTS 18

Insert `⏎·····`
const document = documents[i];

if (!isPlainObject(document.body) && !prepareMUpsert) {
Expand Down Expand Up @@ -3105,8 +3105,8 @@ export default class ElasticSearch extends Service {
extractedDocument = {
_source: {
// Do not use destructuring, it's 10x slower
changes: Object.assign({}, metadata.doc, document.changes),
default: Object.assign(
changes: Object.assign({}, metadata.doc, document.changes), //NOSONAR
default: Object.assign( //NOSONAR

Check failure on line 3109 in lib/service/storage/elasticsearch.ts

View workflow job for this annotation

GitHub Actions / Lint - Node.js LTS 16

Insert `⏎···········`

Check failure on line 3109 in lib/service/storage/elasticsearch.ts

View workflow job for this annotation

GitHub Actions / Lint - Node.js LTS 18

Insert `⏎···········`
{},
metadata.upsert,
document.changes,
Expand All @@ -3117,7 +3117,7 @@ export default class ElasticSearch extends Service {
} else {
extractedDocument = {
// Do not use destructuring, it's 10x slower
_source: Object.assign({}, metadata, document.body),
_source: Object.assign({}, metadata, document.body), //NOSONAR
};
}

Expand Down Expand Up @@ -3253,7 +3253,7 @@ export default class ElasticSearch extends Service {
index: string,
collection: string
): Promise<string> {
let indice = this._getAlias(index, collection).substr(
let indice = this._getAlias(index, collection).substring(
INDEX_PREFIX_POSITION_IN_ALIAS
);

Expand All @@ -3270,7 +3270,7 @@ export default class ElasticSearch extends Service {
if (overflow > 0) {
const indiceBuffer = Buffer.from(indice);
indice = indiceBuffer
.slice(0, indiceBuffer.length - overflow)
.subarray(0, indiceBuffer.length - overflow)
.toString();
}

Expand Down Expand Up @@ -3737,7 +3737,7 @@ export default class ElasticSearch extends Service {
let lastAction = "";
const actionNames = ["index", "create", "update", "delete"];

for (let i = 0; i < esRequest.body.length; i++) {
for (let i = 0; i < esRequest.body.length; i++) { //NOSONAR

Check failure on line 3740 in lib/service/storage/elasticsearch.ts

View workflow job for this annotation

GitHub Actions / Lint - Node.js LTS 16

Insert `⏎·····`

Check failure on line 3740 in lib/service/storage/elasticsearch.ts

View workflow job for this annotation

GitHub Actions / Lint - Node.js LTS 18

Insert `⏎·····`
const item = esRequest.body[i];
const action = Object.keys(item)[0];

Expand Down

0 comments on commit 677c686

Please sign in to comment.