fix: remove unnecessary assertion and unused import#105
Open
sonarqube-agent[bot] wants to merge 1 commit intomainfrom
Open
fix: remove unnecessary assertion and unused import#105sonarqube-agent[bot] wants to merge 1 commit intomainfrom
sonarqube-agent[bot] wants to merge 1 commit intomainfrom
Conversation
Fixed issues: - AZZjKfX74RkVRlFrkaQV for typescript:S1128 rule - AZZjKfPs4RkVRlFrkaO2 for typescript:S4325 rule Generated by SonarQube Agent (task: 7d8e4cff-14d1-4c00-bbbc-78ae31132ab8)
Author
|
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Resolves two SonarQube code smells by removing an unnecessary non-null assertion operator from a test file and eliminating an unused Toggle import. These changes improve code clarity and reduce bundle size without affecting functionality.
View Project in SonarCloud
Fixed Issues
typescript:S4325 - This assertion is unnecessary since the receiver accepts the original type of the expression. • MINOR • View issue
Location:
psc-admin-portal/src/app/interrogation-ps/interrogation-ps.component.spec.ts:95Why is this an issue?
In TypeScript, casts and non-null assertions are two mechanisms used to inform the TypeScript compiler about the intended types of variables, expressions, or values in the code. They are used to help the compiler understand the types more accurately and to handle certain situations where type inference might not be sufficient:
What changed
Removes the unnecessary non-null assertion operator (!) from
idNatPsControlin thespyOncall. The TypeScript compiler already knows thatidNatPsControlis not null or undefined at this point in the code, making the non-null assertion redundant. Removing it eliminates the code smell of an unnecessary assertion that adds noise without providing any type safety benefit.typescript:S1128 - Remove this unused import of 'Toggle'. • MINOR • View issue
Location:
psc-admin-portal/src/app/app.component.ts:24Why is this an issue?
Unnecessary imports refer to importing modules, libraries, or dependencies that are not used or referenced anywhere in the code. These imports do not contribute to the functionality of the application and only add extra weight to the JavaScript bundle, leading to potential performance and maintainability issues.
What changed
Removes the unused import of 'Toggle' from 'app.component.ts'. The static analysis flagged this import as unnecessary because the 'Toggle' symbol was not referenced anywhere in the code. Removing it eliminates the unused import code smell and reduces unnecessary bundle weight.
SonarQube Remediation Agent uses AI. Check for mistakes.