Thanks to visit codestin.com
Credit goes to github.com

Skip to content

fix(analyzer): add unwanted channel drain before done channel returns for correct line count#7942

Merged
cx-artur-ribeiro merged 10 commits intomasterfrom
AST-128072-analyze-scan-loc-discrepancy
Jan 29, 2026
Merged

fix(analyzer): add unwanted channel drain before done channel returns for correct line count#7942
cx-artur-ribeiro merged 10 commits intomasterfrom
AST-128072-analyze-scan-loc-discrepancy

Conversation

@cx-artur-ribeiro
Copy link
Contributor

@cx-artur-ribeiro cx-artur-ribeiro commented Jan 9, 2026

Reason for Proposed Changes

  • The analyzer's unwanted channel is buffered with capacity equal to the number of files. When all worker goroutines finish (wg.Wait()), the channels are closed and a done signal is sent. However, the computeValues() function uses a select statement that races between reading messages from unwanted and receiving the done signal.
  • Once done is received, the function returned immediately, abandoning thousands of unread messages still sitting in the buffered unwanted channel. These lost exclusions meant the scan processed files that should have been excluded for huge projects.

Proposed Changes

  • Drain the buffered unwanted channel before exiting;
  • Update ListSupportedCloudProviders to match ListSupportedPlatforms() implementation, reducing tech dept and automatically fetch supported cloud providers from the constants;

I submit this contribution under the Apache-2.0 license.

…he all excluded files to be taken into consideration
@cx-artur-ribeiro cx-artur-ribeiro self-assigned this Jan 9, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Jan 9, 2026

kics-logo

KICS version: v2.1.18

Category Results
CRITICAL CRITICAL 0
HIGH HIGH 0
MEDIUM MEDIUM 0
LOW LOW 0
INFO INFO 0
TRACE TRACE 0
TOTAL TOTAL 0
Metric Values
Files scanned placeholder 1
Files parsed placeholder 1
Files failed to scan placeholder 0
Total executed queries placeholder 47
Queries failed to execute placeholder 0
Execution time placeholder 0

@cx-artur-ribeiro cx-artur-ribeiro marked this pull request as ready for review January 12, 2026 09:13
@cx-artur-ribeiro cx-artur-ribeiro requested a review from a team as a code owner January 12, 2026 09:13
Copy link
Contributor

@cx-rui-araujo cx-rui-araujo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cx-artur-ribeiro check my comment please

cx-rui-araujo
cx-rui-araujo previously approved these changes Jan 12, 2026
Copy link
Contributor

@cx-rui-araujo cx-rui-araujo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM pal

Copy link
Contributor

@cx-eduardo-semanas cx-eduardo-semanas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

cx-bruno-silva
cx-bruno-silva previously approved these changes Jan 26, 2026
@cx-artur-ribeiro cx-artur-ribeiro merged commit d9c865b into master Jan 29, 2026
27 checks passed
@cx-artur-ribeiro cx-artur-ribeiro deleted the AST-128072-analyze-scan-loc-discrepancy branch January 29, 2026 17:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

Comments