We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
https://sonarcloud.io/project/issues?resolved=false&sinceLeakPeriod=true&types=CODE_SMELL&id=jhipster-sample-application&open=AY1qKP6qZqAZOZp0Vj8m
These two solutions don't work: return { predicate: sortParam }; or return { predicate: sortParam ?? undefined };
return { predicate: sortParam };
return { predicate: sortParam ?? undefined };
Indeed this test is in error:
it('should accept empty string', () => { const sortState = service.parseSortParam(''); expect(sortState).toEqual({}); });
A solution which fixes sonar is: return { predicate: (sortParam && sortParam !== '') ? sortParam : undefined }; but sortParam !== '' is useless.
return { predicate: (sortParam && sortParam !== '') ? sortParam : undefined };
sortParam !== ''
Maybe add a NOSONAR ...
NOSONAR
WDYT @mshima ?
Test:
The text was updated successfully, but these errors were encountered:
return { predicate: sortParam || undefined };?
return { predicate: sortParam || undefined };
Sorry, something went wrong.
nope 🙂
return { predicate: Boolean(sortParam) ? sortParam : undefined }; return { predicate: sortParam?.length ? sortParam : undefined }; return { predicate: sortParam !== undefined && sortParam.length > 0 ? sortParam : undefined }; return { predicate: (sortParam ?? '').length > 0 ? sortParam : undefined };
return { predicate: Boolean(sortParam) ? sortParam : undefined };
return { predicate: sortParam?.length ? sortParam : undefined };
return { predicate: sortParam !== undefined && sortParam.length > 0 ? sortParam : undefined };
return { predicate: (sortParam ?? '').length > 0 ? sortParam : undefined };
if (sortParam) { return { predicate: sortParam }; } return {};
return { predicate: sortParam?.length ? sortParam : undefined }; seems good
qmonmert
Successfully merging a pull request may close this issue.
https://sonarcloud.io/project/issues?resolved=false&sinceLeakPeriod=true&types=CODE_SMELL&id=jhipster-sample-application&open=AY1qKP6qZqAZOZp0Vj8m
These two solutions don't work:
return { predicate: sortParam };
or
return { predicate: sortParam ?? undefined };
Indeed this test is in error:
A solution which fixes sonar is:
return { predicate: (sortParam && sortParam !== '') ? sortParam : undefined };
but
sortParam !== ''
is useless.Maybe add a
NOSONAR
...WDYT @mshima ?
Test:
The text was updated successfully, but these errors were encountered: