Fixed the following SonarQube code smells:

1) Do not use Array index in keys.
2) Unnecessary escape character.
3) Rename this local variable to match the regular expression ^[_a-z][a-z0-9_]*$
4) Remove the unused local variable.
This commit is contained in:
Akshay Joshi
2023-06-12 18:44:31 +05:30
parent 3e713cf58b
commit 251bf05692
31 changed files with 136 additions and 117 deletions

View File

@@ -133,7 +133,7 @@ export function Search({closeModal}) {
let menuItemsHtmlElement = [];
items.forEach((i) => {
menuItemsHtmlElement.push(
<li key={ 'li-menu-' + i }><a tabIndex='0' id={ 'li-menu-' + i.label } href={'#'} className={ (i.isDisabled ? 'dropdown-item menu-groups-a disabled':'dropdown-item menu-groups-a')} key={ 'menu-' + i.label } onClick={
<li key={ 'li-menu-' + i.label }><a tabIndex='0' id={ 'li-menu-' + i.label } href={'#'} className={ (i.isDisabled ? 'dropdown-item menu-groups-a disabled':'dropdown-item menu-groups-a')} onClick={
() => {
closeModal();
i.callback();
@@ -257,7 +257,7 @@ export function Search({closeModal}) {
</div>
{Object.keys(helpSearchResult.data).map( (value, index) => {
if(index <= 9) { return <li key={ 'li-help-' + index }><a tabIndex='0' href={helpSearchResult.data[value]} key={ 'help-' + index } className='dropdown-item' target='_blank' rel='noreferrer'>{value}</a></li>; }
if(index <= 9) { return <li key={ 'li-help-' + value }><a tabIndex='0' href={helpSearchResult.data[value]} className='dropdown-item' target='_blank' rel='noreferrer'>{value}</a></li>; }
})}
{(Object.keys(helpSearchResult.data).length == 0) ? (<div className='pad-12 no-results'><span className='fa fa-info-circle'></span> {gettext('No search results')}</div>):''}