presidential-innovation-fellows/code-gov-web

View on GitHub

Showing 125 of 125 total issues

Similar blocks of code found in 2 locations. Consider refactoring.
Open

describe('SubnavComponent', () => {
 
describe('component logic', () => {
let fixture: ComponentFixture<SubnavComponent>;
let component: SubnavComponent;
Severity: Major
Found in src/app/components/subnav/subnav.component.spec.ts and 1 other location - About 2 days to fix
src/app/components/four-oh-four/four-oh-four.component.spec.ts on lines 19..74

Similar blocks of code found in 2 locations. Consider refactoring.
Open

describe('FourOhFourComponent', () => {
 
describe('component logic', () => {
let fixture: ComponentFixture<FourOhFourComponent>;
let component: FourOhFourComponent;
Severity: Major
Found in src/app/components/four-oh-four/four-oh-four.component.spec.ts and 1 other location - About 2 days to fix
src/app/components/subnav/subnav.component.spec.ts on lines 19..74

Identical blocks of code found in 2 locations. Consider refactoring.
Open

updateMenuSize(event) {
if (this.expanded) {
let nav = document.querySelector('header.main nav.main');
let computedStyle = window.getComputedStyle(nav);
let paddingTop = Number(computedStyle['padding-top'].replace('px', ''));
src/app/components/header-navigation/header-navigation.component.ts on lines 152..172

Identical blocks of code found in 2 locations. Consider refactoring.
Open

updateMenuSize(event) {
if (this.expanded) {
let nav = document.querySelector('header.main nav.main');
let computedStyle = window.getComputedStyle(nav);
let paddingTop = Number(computedStyle['padding-top'].replace('px', ''));
src/app/components/home/header-navigation/home-header-navigation.component.ts on lines 72..92

Similar blocks of code found in 2 locations. Consider refactoring.
Open

describe('when a url with unescaped spaces and parentheses is used', () => {
it('the serializer parsed correctly', () => {
 
let url: string = '/explore-code/agencies/DOJ/repos/Better View Pane Args (Drupal module)';
 
 
src/app/serializers/custom-url-serializer/custom-url-serializer.spec.ts on lines 66..84

Similar blocks of code found in 2 locations. Consider refactoring.
Open

describe('when a url with escaped parentheses is used', () => {
it('the serializer parsed and unescaped correctly', () => {
 
let url: string = '/explore-code/agencies/DOJ/repos/Better%20View%20Pane%20Args%20%28Drupal%20module%29';
 
 
src/app/serializers/custom-url-serializer/custom-url-serializer.spec.ts on lines 86..104

Identical blocks of code found in 2 locations. Consider refactoring.
Open

this.menu = content.header.menu.map(option => {
if (option.links) {
option.links.forEach(link => {
link.routerLink = toRouterLink(link.url);
});
src/app/components/home/header-navigation/home-header-navigation.component.ts on lines 34..44

Identical blocks of code found in 2 locations. Consider refactoring.
Open

this.menu = content.header.menu.map(option => {
if (option.links) {
option.links.forEach(link => {
link.routerLink = toRouterLink(link.url);
});
src/app/components/header-navigation/header-navigation.component.ts on lines 47..57

Identical blocks of code found in 2 locations. Consider refactoring.
Open

this.finalResults.sort((a, b) => {
const aTime = a.date && a.date.lastModified ? new Date(a.date.lastModified).getTime() : -10e10;
const bTime = b.date && b.date.lastModified ? new Date(b.date.lastModified).getTime() : -10e10;
return Math.sign(bTime - aTime) || 0;
});
src/app/components/help-wanted/help-wanted.component.ts on lines 48..53

Identical blocks of code found in 2 locations. Consider refactoring.
Open

this.results = tasks
.sort((a, b) => {
const aTime = a.date && a.date.lastModified ? new Date(a.date.lastModified).getTime() : -10e10;
const bTime = b.date && b.date.lastModified ? new Date(b.date.lastModified).getTime() : -10e10;
return Math.sign(bTime - aTime) || 0;
Severity: Major
Found in src/app/components/help-wanted/help-wanted.component.ts and 1 other location - About 4 hrs to fix
src/app/components/base-filter-page/base-filter-page.component.ts on lines 313..317

Similar blocks of code found in 2 locations. Consider refactoring.
Open

scrollToError(error) {
const { startMarker, endMarker } = error;
const range = new this.monaco.Range(
startMarker.position.lineNumber,
startMarker.position.column,
src/app/components/tools/upgrade-schema/upgrade-schema.component.ts on lines 85..96

Similar blocks of code found in 2 locations. Consider refactoring.
Open

scrollToError(error) {
const { startMarker, endMarker } = error;
const range = new this.monaco.Range(
startMarker.position.lineNumber,
startMarker.position.column,
src/app/components/tools/schema-validator/schema-validator.component.ts on lines 63..74

Identical blocks of code found in 2 locations. Consider refactoring.
Open

onClickMenuOption(selected, event) {
 
// make sure to close all other menuOptions
this.menu.forEach(menuOption => {
if (menuOption !== selected) {
src/app/components/home/header-navigation/home-header-navigation.component.ts on lines 57..70

Identical blocks of code found in 2 locations. Consider refactoring.
Open

onClickMenuOption(selected, event) {
// make sure to close all other menuOptions
this.menu.forEach(menuOption => {
if (menuOption !== selected) {
menuOption.expanded = false;
src/app/components/header-navigation/header-navigation.component.ts on lines 136..150

Similar blocks of code found in 2 locations. Consider refactoring.
Open

beforeEach(() => {
TestBed.configureTestingModule({
imports: [
RouterModule.forRoot([])
],
src/app/components/autocomplete-result/autocomplete-result.component.spec.ts on lines 40..54

Similar blocks of code found in 2 locations. Consider refactoring.
Open

beforeEach(() => {
TestBed.configureTestingModule({
imports: [
RouterModule.forRoot([])
],
src/app/components/autocomplete-result/autocomplete-result.component.spec.ts on lines 76..90

Similar blocks of code found in 2 locations. Consider refactoring.
Open

case 'Best Match':
this.finalResults.sort((a, b) => {
if (a.searchScore < b.searchScore) {
return 1;
} else if (a.searchScore > b.searchScore) {
src/app/components/base-filter-page/base-filter-page.component.ts on lines 300..311

Similar blocks of code found in 2 locations. Consider refactoring.
Open

case 'Data Quality':
this.finalResults.sort((a, b) => {
if (a.score < b.score) {
return 1;
} else if (a.score > b.score) {
src/app/components/base-filter-page/base-filter-page.component.ts on lines 288..299

Similar blocks of code found in 2 locations. Consider refactoring.
Open

set afterModel(m) {
this._afterModel = m;
this._afterModel.onDidChangeDecorations(() => {
this.errors = this._afterModel.getAllDecorations()
.filter(decoration => decoration.isForValidation);
src/app/components/tools/schema-validator/schema-validator.component.ts on lines 42..49

Similar blocks of code found in 2 locations. Consider refactoring.
Open

set model(m) {
this._model = m;
this._model.onDidChangeDecorations(() => {
this.errors = this.model.getAllDecorations()
.filter(decoration => decoration.isForValidation);
src/app/components/tools/upgrade-schema/upgrade-schema.component.ts on lines 64..71
Severity
Category
Status
Source
Language