fix: resolve 5 SonarQube issues with readonly and unused imports#106
Open
sonarqube-agent[bot] wants to merge 1 commit intomainfrom
Open
fix: resolve 5 SonarQube issues with readonly and unused imports#106sonarqube-agent[bot] wants to merge 1 commit intomainfrom
sonarqube-agent[bot] wants to merge 1 commit intomainfrom
Conversation
Fixed issues: - AZZjKfSO4RkVRlFrkaO3 for typescript:S2933 rule - AZZjKfX74RkVRlFrkaQW for typescript:S1128 rule - AZZjKfX74RkVRlFrkaQX for typescript:S1128 rule - AZZjKfX74RkVRlFrkaQY for typescript:S1128 rule - AZZjKfX74RkVRlFrkaQZ for typescript:S1128 rule Generated by SonarQube Agent (task: 31b8c79e-8c80-43f4-84e9-6b0f7bd07b97)
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.



This PR fixes 5 SonarQube code quality issues: marking the ID_NAT_PS field as readonly to explicitly prevent reassignment, and removing 4 unused imports (Status, PsApi, Pscload, Extract) from app.component.ts. These changes improve code clarity, prevent potential bugs, and reduce bundle size.
View Project in SonarCloud
Fixed Issues
typescript:S2933 - Member 'ID_NAT_PS' is never reassigned; mark it as `readonly`. • MAJOR • View issue
Location:
psc-admin-portal/src/app/interrogation-ps/interrogation-ps.component.ts:50Why is this an issue?
readonlyfields can only be assigned in a class constructor. If a class has a field that’s not markedreadonlybut is only set in the constructor, it could cause confusion about the field’s intended use. To avoid confusion, such fields should be markedreadonlyto make their intended use explicit, and to prevent future maintainers from inadvertently changing their use.What changed
This hunk adds the
readonlymodifier to theID_NAT_PSfield, which is a private member that is initialized at declaration and never reassigned elsewhere in the class. Marking it asreadonlymakes the intent explicit that this field should not be modified after initialization, preventing future maintainers from inadvertently changing its use and resolving the code smell about members that are never reassigned not being marked asreadonly.typescript:S1128 - Remove this unused import of 'Extract'. • MINOR • View issue
Location:
psc-admin-portal/src/app/app.component.ts:28Why 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
This hunk removes four unused import statements from app.component.ts: 'Status' from './api/status', 'PsApi' from './api/psApi.service', 'Pscload' from './api/pscload.service', and 'Extract' from './api/extract.service'. Each of these imports was flagged as unnecessary because the imported symbols were not referenced anywhere in the code. Removing them eliminates the unused import code smells and reduces unnecessary bundle weight.
typescript:S1128 - Remove this unused import of 'Pscload'. • MINOR • View issue
Location:
psc-admin-portal/src/app/app.component.ts:27Why 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
This hunk removes four unused import statements from app.component.ts: 'Status' from './api/status', 'PsApi' from './api/psApi.service', 'Pscload' from './api/pscload.service', and 'Extract' from './api/extract.service'. Each of these imports was flagged as unnecessary because the imported symbols were not referenced anywhere in the code. Removing them eliminates the unused import code smells and reduces unnecessary bundle weight.
typescript:S1128 - Remove this unused import of 'PsApi'. • MINOR • View issue
Location:
psc-admin-portal/src/app/app.component.ts:26Why 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
This hunk removes four unused import statements from app.component.ts: 'Status' from './api/status', 'PsApi' from './api/psApi.service', 'Pscload' from './api/pscload.service', and 'Extract' from './api/extract.service'. Each of these imports was flagged as unnecessary because the imported symbols were not referenced anywhere in the code. Removing them eliminates the unused import code smells and reduces unnecessary bundle weight.
typescript:S1128 - Remove this unused import of 'Status'. • MINOR • View issue
Location:
psc-admin-portal/src/app/app.component.ts:25Why 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
This hunk removes four unused import statements from app.component.ts: 'Status' from './api/status', 'PsApi' from './api/psApi.service', 'Pscload' from './api/pscload.service', and 'Extract' from './api/extract.service'. Each of these imports was flagged as unnecessary because the imported symbols were not referenced anywhere in the code. Removing them eliminates the unused import code smells and reduces unnecessary bundle weight.
SonarQube Remediation Agent uses AI. Check for mistakes.