Skip to content

Commit 2ea1494

Browse files
Merge pull request #50 from DSACMS/DSACMS/nat/pr-check-fixes
Frontend: Fix PR checks and add privacy policy
2 parents 47fed4d + be841c4 commit 2ea1494

File tree

7 files changed

+47
-37
lines changed

7 files changed

+47
-37
lines changed

_data/codegovData.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@ module.exports = function() {
8787
agencies.push({
8888
code: agencyName,
8989
name: agencyName,
90-
version: "1.0.0",
91-
measurementType: "Projects",
90+
version: '1.0.0',
91+
measurementType: 'Projects',
9292
organizations: agencyOrgs,
9393
projectCount: releases.length,
9494
totalLaborHours: releases.reduce((acc, curr) => acc + (curr.laborHours || 0), 0)
@@ -112,7 +112,7 @@ module.exports = function() {
112112

113113
projects.push({
114114
agencyCode: agencyName,
115-
agencyName: agencyName,
115+
agencyName,
116116
organization: release.organization,
117117
name: release.name,
118118
description: release.description,

assets/_common/js/filters.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@ const applySearchFilter = (data, searchTerm, targetType) => {
3030
});
3131
};
3232

33-
const applySelectFilters = (data, filters, targetType) => {
34-
return Object.entries(filters).reduce((filtered, [key, value]) => {
33+
const applySelectFilters = (data, filters, targetType) => Object.entries(filters).reduce((filtered, [key, value]) => {
3534
if (!value || key === 'search') return filtered;
3635

3736
return filtered.filter(item => {
@@ -80,13 +79,12 @@ const applySelectFilters = (data, filters, targetType) => {
8079
}
8180
});
8281
}, data);
83-
};
8482

8583
const sortData = (data, sortBy) => {
8684
const [field, direction] = sortBy.split('-');
8785

8886
return [...data].sort((a, b) => {
89-
let aVal, bVal;
87+
let aVal; let bVal;
9088

9189
switch (field) {
9290
case 'name':

assets/_common/js/issue-filters.js

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,7 @@ const applySearchFilter = (data, searchTerm) => {
3434
});
3535
};
3636

37-
const applySelectFilters = (data, filters) => {
38-
return Object.entries(filters).reduce((filtered, [key, value]) => {
37+
const applySelectFilters = (data, filters) => Object.entries(filters).reduce((filtered, [key, value]) => {
3938
if (!value || key === 'search') return filtered;
4039

4140
return filtered.filter(issue => {
@@ -58,13 +57,12 @@ const applySelectFilters = (data, filters) => {
5857
}
5958
});
6059
}, data);
61-
};
6260

6361
const sortData = (data, sortBy) => {
6462
const [field, direction] = sortBy.split('-');
6563

6664
return [...data].sort((a, b) => {
67-
let aVal, bVal;
65+
let aVal; let bVal;
6866

6967
switch (field) {
7068
case 'created':
@@ -294,8 +292,7 @@ const bindEvents = (state, setState) => {
294292
}
295293
};
296294

297-
const preprocessIssuesData = (issues) => {
298-
return issues.map(issue => {
295+
const preprocessIssuesData = (issues) => issues.map(issue => {
299296
// Extract repo name from URL
300297
if (issue.url) {
301298
const urlParts = issue.url.split('/');
@@ -310,7 +307,6 @@ const preprocessIssuesData = (issues) => {
310307

311308
return issue;
312309
});
313-
};
314310

315311
const initializeIssueFilters = (data) => {
316312
const processedData = preprocessIssuesData(data);

config/updateCodeGov.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
const fs = require("fs").promises
1+
const fs = require('fs').promises
22
const path = require('path')
33

44
// these will always stay constant
55
const CONFIG = {
6-
agencyDirectory: path.resolve(__dirname, "../agency-indexes"),
7-
outputFile: path.resolve(__dirname, "../codegov.json"),
6+
agencyDirectory: path.resolve(__dirname, '../agency-indexes'),
7+
outputFile: path.resolve(__dirname, '../codegov.json'),
88
regex: /^(.*?)-.*\.json$/
99
}
1010

@@ -25,7 +25,7 @@ async function updateCodeGov() {
2525
const filePath = path.join(CONFIG.agencyDirectory, file)
2626

2727
try {
28-
const content = await fs.readFile(filePath, "utf-8")
28+
const content = await fs.readFile(filePath, 'utf-8')
2929
const jsonData = JSON.parse(content)
3030

3131
// store the agency name only for readability in codegov.json
@@ -45,7 +45,7 @@ async function updateCodeGov() {
4545

4646
return updatedJSON
4747
} catch (error) {
48-
console.error("❌ Failed to update codegov.json:", error)
48+
console.error('❌ Failed to update codegov.json:', error)
4949
}
5050
}
5151

config/updateIssuePool.js

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
const fs = require("fs").promises
1+
const fs = require('fs').promises
22
const path = require('path')
33

44
const CONFIG = {
5-
repoFilePath: path.resolve(__dirname, "../codegov.json"),
6-
issueFilePath: path.resolve(__dirname, "../issue-pool.json"),
5+
repoFilePath: path.resolve(__dirname, '../codegov.json'),
6+
issueFilePath: path.resolve(__dirname, '../issue-pool.json'),
77
regex: /https?:\/\/github\.com\/([^\/]+)\/([^\/]+)/,
88
githubToken: process.env.GITHUB_TOKEN,
99
requiredLabel: 'code-gov',
@@ -41,10 +41,10 @@ async function fetchWithRateLimit(url, options = {}) {
4141
}
4242

4343
async function getRepoInfo() { // dont know how i feel about this double loop setup...
44-
let repoInfo = []
44+
const repoInfo = []
4545

4646
try {
47-
const content = await fs.readFile(CONFIG.repoFilePath, "utf-8")
47+
const content = await fs.readFile(CONFIG.repoFilePath, 'utf-8')
4848
const jsonData = JSON.parse(content)
4949

5050
for (const agencyKey in jsonData) {
@@ -71,7 +71,7 @@ async function getRepoInfo() { // dont know how i feel about this double loop se
7171
}
7272
}
7373
} catch (error) {
74-
console.error("Error in getting repo information:", error)
74+
console.error('Error in getting repo information:', error)
7575
}
7676

7777
// console.log(repoInfo)
@@ -102,11 +102,11 @@ function transformIssue(issue, repo, repoLanguage) {
102102
id: String(issue.id),
103103
number: issue.number,
104104
url: issue.html_url,
105-
content_title: issue.title || "",
106-
content_description: issue.body || "",
105+
content_title: issue.title || '',
106+
content_description: issue.body || '',
107107
repo_name: repo.repoName,
108108
repo_url: `https://github.com/${repo.ownerName}/${repo.repoName}`,
109-
repo_language: repoLanguage || "",
109+
repo_language: repoLanguage || '',
110110
repo_owner: repo.ownerName,
111111
status_is_open: issue.state === 'open',
112112
status_has_assignee: issue.assignee !== null,
@@ -115,9 +115,9 @@ function transformIssue(issue, repo, repoLanguage) {
115115
time_last_updated: issue.updated_at,
116116
time_days_old: daysBetween(createdDate, now),
117117
time_last_activity_days_ago: daysBetween(updatedDate, now),
118-
people_author: issue.user?.login || "",
118+
people_author: issue.user?.login || '',
119119
people_assignee: issue.assignee?.login || null,
120-
people_author_type: issue.user?.type || "",
120+
people_author_type: issue.user?.type || '',
121121
labels_list: labelNames,
122122
labels_count: labelNames.length,
123123
labels_has_priority: checkLabelKeywords(issue.labels, ['priority', 'p0', 'p1', 'p2', 'urgent']),
@@ -146,7 +146,7 @@ async function processSingleRepository(repo, headers) {
146146
}
147147

148148
const repoData = await repoResponse.json()
149-
const repoLanguage = repoData.language || ""
149+
const repoLanguage = repoData.language || ''
150150

151151
let page = 1
152152
let hasMore = true
@@ -215,9 +215,9 @@ async function updateIssuePool() {
215215

216216
try {
217217
await fs.writeFile(CONFIG.issueFilePath, JSON.stringify(issuePool, null, 2))
218-
console.log(`Successfully saved issues!`)
218+
console.log('Successfully saved issues!')
219219
} catch (error) {
220-
console.error("Error saving issue pool:", error)
220+
console.error('Error saving issue pool:', error)
221221
}
222222

223223
return issuePool

content/privacy-policy/index.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
title: Privacy Policy
3+
description: 'Privacy Policy'
4+
permalink: /privacy-policy/
5+
layout: layouts/page
6+
tags: codegov
7+
eleventyNavigation:
8+
parent: codegov-privacypolicy
9+
key: codegov-privacypolicy-main
10+
order: 1
11+
title: Privacy Policy
12+
sidenav: false
13+
sticky_sidenav: false
14+
---
15+
16+
This website follows the [HHS Privacy Policy](https://www.hhs.gov/web/policies-and-standards/hhs-web-policies/privacy/index.html).

index.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,20 +34,20 @@ <h2>Developers</h2>
3434
href="https://github.com/GSA/code-gov/blob/master/README.md" target="_blank">contribute here</a>. Help
3535
improve America's Code by exploring projects.
3636
</p>
37-
<a class="usa-button" href="{{'/projects' | url }}">Explore projects</a>
37+
<a class="usa-button" href="{{'/projects/' | url }}">Explore projects</a>
3838
</div>
3939
<div class="explore-inventory">
4040
<h2>Source Code Inventory</h2>
4141
<p>Review source code development across the entire federal government.</p>
42-
<a class="usa-button" href="{{'/agencies' | url }}"> View by Agency </a>
42+
<a class="usa-button" href="{{'/agencies/' | url }}"> View by Agency </a>
4343
</div>
4444
<div class="explore-agencies">
4545
<h2>Agency Partners</h2>
4646
<p>
4747
Federal agency partners use Code.gov to share usable open source code, promote open source
4848
projects, and track compliance with federal open source policy.
4949
</p>
50-
<a class="usa-button" href="{{'/agency-compliance/compliance/dashboard' | url }}">Agency Compliance</a>
50+
<a class="usa-button" href="{{'/agency-compliance/compliance/dashboard/' | url }}">Agency Compliance</a>
5151
</div>
5252
</div>
5353
<div class="grid-row">
@@ -108,7 +108,7 @@ <h3>OPT-IN WITH LABELS</h3>
108108
</div>
109109
</div>
110110
<div style="text-align: center; margin-top: 2rem;">
111-
<a class="usa-button" href="/code-gov/issues/">Browse Issues</a>
111+
<a class="usa-button" href="{{'/issues/' | url }}">Browse Issues</a>
112112
</div>
113113
</div>
114114
</section>

0 commit comments

Comments
 (0)