Showing 14 of 125 total issues
File base-filter-page.component.ts
has 274 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { JsonPipe } from '@angular/common';
import { ChangeDetectorRef, Component, ElementRef, ViewEncapsulation } from '@angular/core';
import { DomSanitizer, SafeStyle } from '@angular/platform-browser';
import { ActivatedRoute } from '@angular/router';
import { Observable } from 'rxjs/Observable';
Function upgradeToPermissions
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
upgradeToPermissions(project) {
project.permissions = {};
project.permissions.licenses = [];
Function ngOnInit
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
ngOnInit() {
this.eventSub = this.route.params.subscribe(params => {
let id = params['id'];
if (id === 'All') {
this.agency = { acronym: 'All', name: 'All' };
Function eventSub
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
this.eventSub = this.route.params.subscribe(params => {
let id = params['id'];
if (id === 'All') {
this.agency = { acronym: 'All', name: 'All' };
this.repos = [];
Function sortResults
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
public sortResults() {
switch (this.selectedSortOption) {
case 'A-Z':
this.finalResults.sort((a, b) => a.name.trim() < b.name.trim() ? -1 : 1);
break;
Function _setRequirementStatuses
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
_setRequirementStatuses(agencyRequirements) {
let requirements = [];
let overallStatus = 'noncompliant';
for (let requirement in agencyRequirements) {
- 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 ngOnInit
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
ngOnInit() {
this.bannerImage = this.sanitizer.bypassSecurityTrustStyle(`url('${images.background}')`);
this.stateService.set('section', 'browse-projects');
Function getStatuses
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
getStatuses() {
this.statusesSub = this.clientService.getStatuses().
subscribe((result) => {
if (result) {
for (let statusAgency in result.statuses) {
- 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 routeSubscription
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
(response: any) => {
if (this.isLoading) {
const initialAgencies = response.agencies ? response.agencies.split(',') : [];
this.queryValue = ''; // blank for all repos
this.clientService.search(this.queryValue, 10000).subscribe(data => {
Function getStatuses
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
getStatuses() {
this.statusesSub = this.clientService.getStatuses().
subscribe((result) => {
if (result) {
for (let statusAgency in result.statuses) {
Function upgradeToPermissions
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
upgradeToPermissions(project) {
project.permissions = {};
project.permissions.licenses = [];
- 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 toAbsoluteUrl
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export function toAbsoluteUrl(url: string): string {
if (url.startsWith('http')) {
return url;
} else if (url.startsWith('/assets')) {
let baseURI = document.head.baseURI;
- 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 displayRepo
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
displayRepo(repo) {
if (repo.agency.acronym === 'EPA') {
try {
return repo.permissions.usageType.toLowerCase().startsWith('exempt') === false;
} catch (error) {
- 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 filterLicenses
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public filterLicenses(result) {
const selectedLicenseIds = this.getFilterBoxValues('License');
const selectedLicenseNames = selectedLicenseIds.map(id => licenseIdToName[id]);
let selectedLicenses = Array.from(new Set(selectedLicenseIds.concat(selectedLicenseNames)));
- 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"