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

Cherry pick #6883 #6888

Merged
merged 3 commits into from
Apr 18, 2024
Merged

Cherry pick #6883 #6888

merged 3 commits into from
Apr 18, 2024

Conversation

sjaanus
Copy link
Contributor

@sjaanus sjaanus commented Apr 18, 2024

Cherry pick #6883

Copy link

vercel bot commented Apr 18, 2024

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

Name Status Preview Comments Updated (UTC)
unleash-monorepo-frontend ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 18, 2024 10:59am
1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
unleash-docs ⬜️ Ignored (Inspect) Visit Preview Apr 18, 2024 10:59am

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: 2 findings(s) 🚩
  • Improving Code Health: 1 findings(s) ✅

View detailed results in CodeScene

Comment on lines +409 to +494
): IApplicationOverview {
if (!this.flagResolver.isEnabled('applicationOverviewNewQuery')) {
return this.mapOldApplicationOverviewData(rows, existingStrategies);
}
const featureCount = new Set(rows.flatMap((row) => row.features)).size;
const missingStrategies: Set<string> = new Set();

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

if (!environment) return acc;

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

const featuresNotMappedToProject = !project;

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: featuresNotMappedToProject
? features
: [],
},
};
acc.push(env);
} else {
if (instance_id) {
env.uniqueInstanceIds.add(instance_id);
env.instanceCount = env.uniqueInstanceIds.size;
}
if (featuresNotMappedToProject) {
env.issues.missingFeatures = features;
}
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,
issues: {
missingStrategies: [...missingStrategies],
},
};
}

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 16 to 15, threshold = 9

Comment on lines +496 to +498
private mapOldApplicationOverviewData(
rows: any[],
existingStrategies: string[],

Choose a reason for hiding this comment

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

❌ New issue: Complex Method
ClientApplicationsStore.mapOldApplicationOverviewData has a cyclomatic complexity of 16, threshold = 9

Suppress

@@ -10,6 +10,9 @@ import type { Logger, LogProvider } from '../logger';
import type { Db } from './db';
import type { IApplicationOverview } from '../features/metrics/instance/models';
import { applySearchFilters } from '../features/feature-search/search-utils';
import type { IFlagResolver } from '../types';

Choose a reason for hiding this comment

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

❌ New issue: String Heavy Function Arguments
In this module, 39.1% of all arguments to its 21 functions are strings. The threshold for string arguments is 39.0%

Suppress

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: 3 findings(s) 🚩
  • Improving Code Health: 1 findings(s) ✅

View detailed results in CodeScene

@@ -65,6 +65,7 @@ export const createStores = (
db,
eventBus,
getLogger,
flagResolver,

Choose a reason for hiding this comment

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

❌ Getting worse: Large Method
createStores increases from 104 to 105 lines of code, threshold = 70

Suppress

Copy link
Contributor

@FredrikOseberg FredrikOseberg left a comment

Choose a reason for hiding this comment

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

LGTM

@sjaanus sjaanus merged commit a59d179 into 5.11 Apr 18, 2024
10 of 11 checks passed
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

2 participants