Skip to content
New issue

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

Clean up CodeQL issues #275

Merged
merged 30 commits into from
Jun 13, 2024

Conversation

Freezor
Copy link
Contributor

@Freezor Freezor commented Jun 13, 2024

Description

This PR addresses several CodeQL issues identified across various files in the project. The changes include removing unused variables, fixing potentially dangerous logic, and ensuring proper implementation of methods like Equals(object).

Motivation and Context

These changes are necessary to improve code quality and maintainability by resolving CodeQL alerts related to unused variables, dangerous logic patterns, and missing method implementations.

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

The changes have been tested by running unit tests and verifying the affected functionality in a development environment. Detailed tests were conducted to ensure that the fixes are effective and do not introduce regressions.

Screenshots (if appropriate):

Checklist:

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works

@Freezor Freezor added the bug Something isn't working label Jun 13, 2024
@Freezor Freezor merged commit 06d4538 into eclipse-aaspe:main Jun 13, 2024
3 of 4 checks passed
}

// now, "salt" the strings
for (int i = 0; i < 32; i++)
{
var c = Convert.ToChar(48 + MyRnd.Next(10));
decimals += c;
hexamals += c;
decimals += c;

Check notice

Code scanning / CodeQL

String concatenation in loop Note

String concatenation in loop: use 'StringBuilder'.
decimals += c;
hexamals += c;
decimals += c;
hexamals += c;

Check notice

Code scanning / CodeQL

String concatenation in loop Note

String concatenation in loop: use 'StringBuilder'.
@@ -606,20 +623,18 @@
{
if (tpli == 'D' && decimals.Length > 0)
{
id += decimals[0];
decimals = decimals.Remove(0, 1);
id += decimals[ 0 ];

Check notice

Code scanning / CodeQL

String concatenation in loop Note

String concatenation in loop: use 'StringBuilder'.
{
id += hexamals[0];
hexamals = hexamals.Remove(0, 1);
id += hexamals[ 0 ];

Check notice

Code scanning / CodeQL

String concatenation in loop Note

String concatenation in loop: use 'StringBuilder'.
{
id += alphamals[0];
alphamals = alphamals.Remove(0, 1);
id += alphamals[ 0 ];

Check notice

Code scanning / CodeQL

String concatenation in loop Note

String concatenation in loop: use 'StringBuilder'.
@@ -339,6 +343,19 @@
this.foundText == other.foundText &&
this.foundHash == other.foundHash;
}

public override bool Equals(object obj) => obj is SearchResultItem item && Equals(item);

Check warning

Code scanning / CodeQL

Equals should not apply "is" Warning

SearchResultItem.Equals(object) should not use "is" on its parameter, as it will not work properly for subclasses of SearchResultItem.
@Freezor Freezor deleted the freezor/fix-code-scanning-allerts branch June 18, 2024 11:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant