Showing 1,111 of 1,370 total issues
Function ConfigInit
has a Cognitive Complexity of 18 (exceeds 8 allowed). Consider refactoring. Open
Open
func ConfigInit(envLookup *env.VarSet, jetstreamConfig *interfaces.PortalConfig) {
// Check we are deployed in Cloud Foundry
if !envLookup.IsSet(VCapApplication) {
return
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function onRunComplete
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
this.onRunComplete = (browser, result) => {
if (fs.existsSync(this.file)) {
fs.unlinkSync(this.file);
}
Function doCreateWindow
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function doCreateWindow(url) {
let mainWindowState = windowStateKeeper({
defaultWidth: 1024,
defaultHeight: 768
Function createPaginationAction
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public createPaginationAction(isAdmin: boolean, cfGuid: string, orgGuid?: string, spaceGuid?: string): Observable<PaginatedAction> {
if (isAdmin) {
const allCfUsersAction = this.createCfGetAllUsersAction(cfGuid);
if (!orgGuid) {
Function doEndpointAction
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private doEndpointAction(
apiAction: EntityRequestAction | PaginatedAction,
url: string,
params: HttpParams,
apiActionType: ApiRequestTypes = 'update',
Function parseKeyValue
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private parseKeyValue(key: any, value: any): Segment {
const segment: Segment = {
key,
value,
type: undefined,
Function ngOnInit
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
ngOnInit() {
this.hasFavEntities = this.userFavoriteManager.endpointHasEntitiesThatCanFavorite(this.endpoint.cnsi_type);
// Favorites for this endpoint
this.favorites$ = this.userFavoriteManager.getFavoritesForEndpoint(this.endpoint.guid);
this.entity = entityCatalog.getEndpoint(this.endpoint.cnsi_type, this.endpoint.sub_type);
Function ngOnInit
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
ngOnInit() {
const chartConfigBuilder = getMetricsChartConfigBuilder<IMetricApplication>(
result => {
const metric = result.metric;
if (!!metric.pod && !!metric.namespace) {
Function constructor
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
constructor(
public cfEndpointService: CloudFoundryEndpointService,
private currentUserPermissionsService: CurrentUserPermissionsService,
endpointsService: EndpointsService,
userFavoriteManager: UserFavoriteManager
Function paginate
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function paginate(action, state: PaginationState = {}, updatePagination) {
if (action.type === ApiActionTypes.API_REQUEST_START) {
return state;
}
Function resource$
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
map((item: (KubeAPIResource | KubeStatus)) => {
const resource: KubernetesResourceViewerResource = {} as KubernetesResourceViewerResource;
const newItem = {} as any;
resource.raw = item;
Function processSingleItemAction
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private processSingleItemAction<T extends BasicKubeAPIResource>(
action: KubeAction,
url: string,
body?: any) {
const requestType: ApiRequestTypes = body ? 'create' : 'fetch';
Function mapMetricsData
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function mapMetricsData(ep: MetricsEndpointProvider): MetricsEndpointInfo[] {
const data: MetricsEndpointInfo[] = [];
// Add all of the known endpoints first
ep.endpoints.forEach(endpoint => {
Function ngOnInit
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
ngOnInit() {
this.committedAction = this.metricsConfig.metricsAction;
this.metricsMonitor = this.entityMonitorFactory.create<IMetrics>(
this.metricsConfig.metricsAction.guid,
this.committedAction
Method HelmReleaseGraph.ParseManifest
has 69 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func (r *HelmReleaseGraph) ParseManifest(release *HelmRelease) {
for _, item := range release.Resources {
node := ReleaseNode{
ID: fmt.Sprintf("%s-%s", item.Kind, item.Metadata.Name),
Label: item.Metadata.Name,
Method KubernetesSpecification.GetReleaseStatus
has 69 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func (c *KubernetesSpecification) GetReleaseStatus(ec echo.Context) error {
// Need to get a config object for the target endpoint
endpointGUID := ec.Param("endpoint")
release := ec.Param("name")
Function cleanUpServiceInstances
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
cleanUpServiceInstances(serviceInstanceNames: string[], userProvided = false): promise.Promise<any> {
// Sleeping because the service instance may not be listed in the `get services` request
browser.sleep(1000);
if (serviceInstanceNames.length === 0) {
return promise.fullyResolved(createEmptyCfResponse());
Function types$
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
map(endpoints => {
const newTypes: SourceType[] = [];
// Add all the base types... also update git types if the user has provided credentials for it
this.baseTypes.forEach(t => {
Function constructor
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
constructor(
private store: Store<AppState>,
private activeRouteCfOrgSpace: ActiveRouteCfOrgSpace,
private cfUserService: CfUserService,
private cfRolesService: CfRolesService,
Function default
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export default function (options: ThemeOptionsSchema): Rule {
return async (host: Tree, context: SchematicContext) => {
if (!options.name) {
throw new SchematicsException(`Invalid options, "name" is required.`);
}