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

[Gitar] Cleaning up stale feature flag: applicationOverviewNewQuery with value true #6956

Merged
merged 2 commits into from
Apr 29, 2024

Conversation

gitar-bot[bot]
Copy link
Contributor

@gitar-bot gitar-bot bot commented Apr 29, 2024

Gitar

Feature Flag Cleanup
Stale Flag Value
applicationOverviewNewQuery true
Trigger

#6559 (comment)

Bot Commands

@gitar-bot cleanup stale_flag=value will cleanup a stale feature flag. Replace stale_flag with the name of the stale feature flag and value with either true or false.

@gitar-bot gitar-bot bot force-pushed the gitar_gitar__applicationOverviewNewQuery_true branch from 927e0a4 to a46ddf5 Compare April 29, 2024 07:31
Copy link

vercel bot commented Apr 29, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

2 Ignored Deployments
Name Status Preview Comments Updated (UTC)
unleash-docs ⬜️ Ignored (Inspect) Visit Preview Apr 29, 2024 7:56am
unleash-monorepo-frontend ⬜️ Ignored (Inspect) Visit Preview Apr 29, 2024 7:56am

Copy link

@codescene-delta-analysis codescene-delta-analysis bot left a comment

Choose a reason for hiding this comment

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

Code Health Quality Gates: FAILED

  • Declining Code Health: 1 findings(s) 🚩
  • Improving Code Health: 1 findings(s) ✅

View detailed results in CodeScene

Comment on lines -403 to -405
if (!this.flagResolver.isEnabled('applicationOverviewNewQuery')) {
return this.mapOldApplicationOverviewData(rows, existingStrategies);
}

Choose a reason for hiding this comment

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

✅ Getting better: Complex Method
ClientApplicationsStore.mapApplicationOverviewData decreases in cyclomatic complexity from 15 to 14, threshold = 9

Copy link

@codescene-delta-analysis codescene-delta-analysis bot left a comment

Choose a reason for hiding this comment

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

Code Health Quality Gates: OK

  • Improving Code Health: 3 findings(s) ✅

View detailed results in CodeScene

Comment on lines -489 to -572
private mapOldApplicationOverviewData(
rows: any[],
existingStrategies: string[],
): IApplicationOverview {
const featureCount = new Set(rows.map((row) => row.feature_name)).size;
const missingStrategies: Set<string> = new Set();

const environments = rows.reduce((acc, row) => {
const {
environment,
instance_id,
sdk_version,
last_seen,
project,
feature_name,
strategies,
} = row;

if (!environment) return acc;

strategies.forEach((strategy) => {
if (
!DEPRECATED_STRATEGIES.includes(strategy) &&
!existingStrategies.includes(strategy)
) {
missingStrategies.add(strategy);
}
});

const featureDoesNotExist = !project && feature_name;

let env = acc.find((e) => e.name === environment);
if (!env) {
env = {
name: environment,
instanceCount: instance_id ? 1 : 0,
sdks: sdk_version ? [sdk_version] : [],
lastSeen: last_seen,
uniqueInstanceIds: new Set(
instance_id ? [instance_id] : [],
),
issues: {
missingFeatures: featureDoesNotExist
? [feature_name]
: [],
},
};
acc.push(env);
} else {
if (instance_id) {
env.uniqueInstanceIds.add(instance_id);
env.instanceCount = env.uniqueInstanceIds.size;
}
if (
featureDoesNotExist &&
!env.issues.missingFeatures.includes(feature_name)
) {
env.issues.missingFeatures.push(feature_name);
}
if (sdk_version && !env.sdks.includes(sdk_version)) {
env.sdks.push(sdk_version);
}
if (new Date(last_seen) > new Date(env.lastSeen)) {
env.lastSeen = last_seen;
}
}

return acc;
}, []);
environments.forEach((env) => {
delete env.uniqueInstanceIds;
env.sdks.sort();
});

return {
projects: [
...new Set(
rows
.filter((row) => row.project != null)
.map((row) => row.project),
),
],
featureCount,
environments,

Choose a reason for hiding this comment

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

✅ No longer an issue: Complex Method
ClientApplicationsStore.mapOldApplicationOverviewData is no longer above the threshold for cyclomatic complexity

@@ -301,9 +301,6 @@ export default class ClientApplicationsStore
async getApplicationOverview(
appName: string,
): Promise<IApplicationOverview> {
if (!this.flagResolver.isEnabled('applicationOverviewNewQuery')) {

Choose a reason for hiding this comment

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

✅ No longer an issue: String Heavy Function Arguments
The ratio of strings in function arguments is no longer above the threshold

@sjaanus sjaanus merged commit 010c4ee into main Apr 29, 2024
7 checks passed
@sjaanus sjaanus deleted the gitar_gitar__applicationOverviewNewQuery_true branch April 29, 2024 08:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

1 participant