Why this matters
Using `str.substring(beginIndex).indexOf(char1)` creates unnecessary temporary strings. Use index methods with an offset parameter instead to improve performance.
Ensure that offset-based string methods are used instead of creating unnecessary substring instances.
Using `str.substring(beginIndex).indexOf(char1)` creates unnecessary temporary strings. Use index methods with an offset parameter instead to improve performance.
Side-by-side examples engineers can pattern-match during review.
str.substring(beginIndex).indexOf(char1); // Noncompliant; a new String is going to be created by "substring"str.indexOf(char1, beginIndex) - beginIndex; // index for char1 not found is (-1-beginIndex)str.substring(beginIndex).indexOf(char1); // Noncompliant; a new String is going to be created by "substring"str.indexOf(char1, beginIndex) - beginIndex; // index for char1 not found is (-1-beginIndex)From the same buckets as this rule.
All static JS/CSS/font/image files MUST use content-hashed filenames (e.g., app.9c1a7b.js) and be served with "Cache-Control: public, max-age=31536000, immutable". HTML and other non-fingerprinted documents MUST be served with "Cache-Control: no-cache" (or equivalent) to enable conditional revalidation.