Showing 718 of 1,370 total issues
Function findFreePort
has a Cognitive Complexity of 17 (exceeds 8 allowed). Consider refactoring. Open
Open
function findFreePort(beg, ...rest){
const p = rest.slice(0, rest.length - 1), cb = rest[rest.length - 1];
let [end, ip, cnt] = Array.from(p);
if (!ip && end && !/^\d+$/.test(end)) { // deal with method 3
ip = end;
- 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 get
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
get(summary: any, appInstances: AppStat[]): ApplicationStateData {
const appState: string = summary ? summary.state : 'UNKNOWN';
const pkgState = this.getPackageState(appState, summary);
const wildcard = this.stateMetadata['?'];
Function ngOnInit
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
ngOnInit() {
this.sourceType$ = combineLatest(
this.appDeploySourceTypes.getAutoSelectedType(this.route),
this.store.select(selectSourceType),
this.appDeploySourceTypes.types$.pipe(first(), map(st => st[this.INITIAL_SOURCE_TYPE]))
Function ngOnInit
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
ngOnInit() {
// Listen for the graph
this.graph = combineLatest(
this.helper.fetchReleaseGraph(),
Method CFAppPush.getGitSCMSource
has 67 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func (cfAppPush *CFAppPush) getGitSCMSource(clientWebSocket *websocket.Conn, tempDir string, msg SocketMessage, userGUID string) (StratosProject, string, error) {
var (
err error
)
Method portalProxy.doRequest
has 67 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func (p *portalProxy) doRequest(cnsiRequest *interfaces.CNSIRequest, done chan<- *interfaces.CNSIRequest) {
log.Debugf("doRequest for URL: %s", cnsiRequest.URL.String())
var body io.Reader
var res *http.Response
var req *http.Request
Function login
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
login(username: string, password: string) {
// If this is a different user to last time, then logout first
if (SSOLoginPage.ssoLastUsername && SSOLoginPage.ssoLastUsername !== username) {
browser.waitForAngularEnabled(false);
this.logoutUAA();
Function createActionTableDate
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function createActionTableDate(orgTarget, spaceTarget, stateIcon) {
return [{
user: userName,
action: 'remove_circle\nRemove',
role: 'Manager',
Function ngOnInit
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
ngOnInit() {
const helmLastModifiedRegEx = /seconds:([0-9]*)/;
this.sessionData$ = this.store.select(s => s.auth).pipe(
Function goNext
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
goNext() {
// Close previous error snackbar if there was one
if (this.snackBarRef) {
this.snackBar.dismiss();
}
Function setupAutoSelectors
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private setupAutoSelectors(initialCf: string, initialOrg: string) {
// Clear or automatically select org + space given cf
let cfTapped = false;
const orgResetSub = this.cf.select.asObservable().pipe(
startWith(initialCf),
Function constructor
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
constructor(dir: string, options?: any, loggingEnabled = true) {
this.angularJsonFile = this.findFileOrFolderInChain(dir, 'angular.json');
this.angularJson = JSON.parse(fs.readFileSync(this.angularJsonFile, 'utf8').toString());
this.loggingEnabled = loggingEnabled;
Function hasUpgrade
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public hasUpgrade(returnLatest = false): Observable<InternalHelmUpgrade> {
const updates = combineLatest(this.getCharts(), this.release$);
return updates.pipe(
map(([charts, release]) => {
let score = -1;
Method MetricsSpecification.getMetricsEndpoints
has 65 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func (m *MetricsSpecification) getMetricsEndpoints(userGUID string, cnsiList []string) (map[string]EndpointMetricsRelation, error) {
metricsProviders := make([]MetricsMetadata, 0)
endpointsMap := make(map[string]*interfaces.ConnectedEndpoint)
results := make(map[string]EndpointMetricsRelation)
Function testEntityMissingEntityRequired
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function testEntityMissingEntityRequired(done: () => void) {
const getOrgAction = new GetOrganization(
orgGuid,
cfGuid,
[createEntityRelationKey(organizationEntityType, quotaDefinitionEntityType)],
Function handleFileInputSelection
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
handleFileInputSelection(items): Observable<FileScannerInfo> {
const obs$ = new BehaviorSubject<DeployApplicationFSScanner>(undefined);
let scanner = new DeployApplicationFSScanner(CF_DEFAULT_IGNORES);
let cfIgnoreFile;
let manifestFile = false;
Function mapMultiEndpointResponses
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function mapMultiEndpointResponses(
action: EntityRequestAction,
catalogEntity: StratosBaseCatalogEntity,
requestType: ApiRequestTypes,
multiEndpointResponses: HandledMultiEndpointResponse,
Function parse
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
parse(content) {
const prepareRegexes = this.prepareRegexes.bind(this);
return content.split('\n')
.map(line => {
line = line.trim();
Function processSingleItemDeleteAction
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private processSingleItemDeleteAction<T extends BasicKubeAPIResource>(action: KubeAction, url: string) {
this.store.dispatch(new StartRequestAction(action, 'delete'));
const headers = new HttpHeaders({
'x-cap-cnsi-list': action.kubeGuid,
'x-cap-passthrough': 'true'
Method Analyzer.deleteEndpoint
has a Cognitive Complexity of 16 (exceeds 8 allowed). Consider refactoring. Open
Open
func (a *Analyzer) deleteEndpoint(ec echo.Context) error {
log.Debug("delete reports for endpoint")
endpoint := ec.Param("endpoint")
- 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"