Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions _data/codegovData.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const codegov = require('../codegov.json');
const legacyCodegov = require('../legacy-codegov.json')

module.exports = function() {

Check warning on line 4 in _data/codegovData.js

View workflow job for this annotation

GitHub Actions / Run linter

Unexpected unnamed function
const agencies = [];
const projects = [];
const organizations = new Set();
Expand Down Expand Up @@ -87,8 +87,8 @@
agencies.push({
code: agencyName,
name: agencyName,
version: "1.0.0",
measurementType: "Projects",
version: '1.0.0',
measurementType: 'Projects',
organizations: agencyOrgs,
projectCount: releases.length,
totalLaborHours: releases.reduce((acc, curr) => acc + (curr.laborHours || 0), 0)
Expand All @@ -112,7 +112,7 @@

projects.push({
agencyCode: agencyName,
agencyName: agencyName,
agencyName,
organization: release.organization,
name: release.name,
description: release.description,
Expand Down
6 changes: 2 additions & 4 deletions assets/_common/js/filters.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@
});
};

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

return filtered.filter(item => {
Expand All @@ -58,7 +57,7 @@
} else {
let actualKey = key;

switch (key) {

Check failure on line 60 in assets/_common/js/filters.js

View workflow job for this annotation

GitHub Actions / Run linter

Expected a default case
case 'language':
actualKey = 'languages'
break;
Expand All @@ -80,13 +79,12 @@
}
});
}, data);
};

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

return [...data].sort((a, b) => {
let aVal, bVal;
let aVal; let bVal;

switch (field) {
case 'name':
Expand All @@ -110,9 +108,9 @@
}

if (direction === 'desc') {
return aVal < bVal ? 1 : aVal > bVal ? -1 : 0;

Check failure on line 111 in assets/_common/js/filters.js

View workflow job for this annotation

GitHub Actions / Run linter

Do not nest ternary expressions
}
return aVal > bVal ? 1 : aVal < bVal ? -1 : 0;

Check failure on line 113 in assets/_common/js/filters.js

View workflow job for this annotation

GitHub Actions / Run linter

Do not nest ternary expressions
});
};

Expand Down Expand Up @@ -351,7 +349,7 @@
const data = JSON.parse(dataScript.textContent);
initializeFilters(data, targetType);
} catch (error) {
console.error('Error parcing data for filters: ', error);

Check warning on line 352 in assets/_common/js/filters.js

View workflow job for this annotation

GitHub Actions / Run linter

Unexpected console statement
}
}
}
Expand Down
10 changes: 3 additions & 7 deletions assets/_common/js/issue-filters.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@
});
};

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

return filtered.filter(issue => {
Expand All @@ -58,13 +57,12 @@
}
});
}, data);
};

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

return [...data].sort((a, b) => {
let aVal, bVal;
let aVal; let bVal;

switch (field) {
case 'created':
Expand All @@ -84,9 +82,9 @@
}

if (direction === 'desc') {
return aVal < bVal ? 1 : aVal > bVal ? -1 : 0;

Check failure on line 85 in assets/_common/js/issue-filters.js

View workflow job for this annotation

GitHub Actions / Run linter

Do not nest ternary expressions
}
return aVal > bVal ? 1 : aVal < bVal ? -1 : 0;

Check failure on line 87 in assets/_common/js/issue-filters.js

View workflow job for this annotation

GitHub Actions / Run linter

Do not nest ternary expressions
});
};

Expand Down Expand Up @@ -161,7 +159,7 @@
`;
};

const createCard = (item, targetType) => {

Check failure on line 162 in assets/_common/js/issue-filters.js

View workflow job for this annotation

GitHub Actions / Run linter

'targetType' is defined but never used
const cardElement = document.createElement('div');
cardElement.innerHTML = createIssueCardHTML(item);
return cardElement.firstElementChild;
Expand Down Expand Up @@ -294,8 +292,7 @@
}
};

const preprocessIssuesData = (issues) => {
return issues.map(issue => {
const preprocessIssuesData = (issues) => issues.map(issue => {
// Extract repo name from URL
if (issue.url) {
const urlParts = issue.url.split('/');
Expand All @@ -310,7 +307,6 @@

return issue;
});
};

const initializeIssueFilters = (data) => {
const processedData = preprocessIssuesData(data);
Expand Down Expand Up @@ -338,10 +334,10 @@
if (dataScript) {
try {
const data = JSON.parse(dataScript.textContent);
console.log('Found', data.length, 'issues');

Check warning on line 337 in assets/_common/js/issue-filters.js

View workflow job for this annotation

GitHub Actions / Run linter

Unexpected console statement
initializeIssueFilters(data);
} catch (error) {
console.error('Error parsing data for issues filters:', error);

Check warning on line 340 in assets/_common/js/issue-filters.js

View workflow job for this annotation

GitHub Actions / Run linter

Unexpected console statement
issuesGrid.innerHTML = '<p>Error loading issues. Please refresh or contact us.</p>';
}
}
Expand Down
10 changes: 5 additions & 5 deletions config/updateCodeGov.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
const fs = require("fs").promises
const fs = require('fs').promises
const path = require('path')

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

Expand All @@ -13,7 +13,7 @@
but that prove to be a disadvantage down the road */

// updates the codegov.json file with new data found from ./agency-indexes
async function updateCodeGov() {

Check failure on line 16 in config/updateCodeGov.js

View workflow job for this annotation

GitHub Actions / Run linter

Expected to return a value at the end of async function 'updateCodeGov'
try {
const updatedJSON = {}

Expand All @@ -21,11 +21,11 @@
const filenames = await fs.readdir(CONFIG.agencyDirectory)

// we know that the directory will only contain json files so dont need to check for non jsons
for (const file of filenames) {

Check failure on line 24 in config/updateCodeGov.js

View workflow job for this annotation

GitHub Actions / Run linter

iterators/generators require regenerator-runtime, which is too heavyweight for this guide to allow them. Separately, loops should be avoided in favor of array iterations
const filePath = path.join(CONFIG.agencyDirectory, file)

try {
const content = await fs.readFile(filePath, "utf-8")
const content = await fs.readFile(filePath, 'utf-8')

Check failure on line 28 in config/updateCodeGov.js

View workflow job for this annotation

GitHub Actions / Run linter

Unexpected `await` inside a loop
const jsonData = JSON.parse(content)

// store the agency name only for readability in codegov.json
Expand All @@ -33,9 +33,9 @@
const agencyName = matches[1]

updatedJSON[agencyName] = jsonData
console.log(`✅ Successfully processed: ${file}`)

Check warning on line 36 in config/updateCodeGov.js

View workflow job for this annotation

GitHub Actions / Run linter

Unexpected console statement
} catch (error) {
console.error(`❌ Error processing file: ${file}`, error)

Check warning on line 38 in config/updateCodeGov.js

View workflow job for this annotation

GitHub Actions / Run linter

Unexpected console statement
}
}

Expand All @@ -45,7 +45,7 @@

return updatedJSON
} catch (error) {
console.error("❌ Failed to update codegov.json:", error)
console.error('❌ Failed to update codegov.json:', error)

Check warning on line 48 in config/updateCodeGov.js

View workflow job for this annotation

GitHub Actions / Run linter

Unexpected console statement
}
}

Expand Down
28 changes: 14 additions & 14 deletions config/updateIssuePool.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
const fs = require("fs").promises
const fs = require('fs').promises
const path = require('path')

const CONFIG = {
repoFilePath: path.resolve(__dirname, "../codegov.json"),
issueFilePath: path.resolve(__dirname, "../issue-pool.json"),
repoFilePath: path.resolve(__dirname, '../codegov.json'),
issueFilePath: path.resolve(__dirname, '../issue-pool.json'),
regex: /https?:\/\/github\.com\/([^\/]+)\/([^\/]+)/,

Check failure on line 7 in config/updateIssuePool.js

View workflow job for this annotation

GitHub Actions / Run linter

Unnecessary escape character: \/
githubToken: process.env.GITHUB_TOKEN,
requiredLabel: 'code-gov',
concurrentRepos: 6, // processing 6 repos at once but need to find the sweetspot because at this rate, it takes 18 minutes for the entire script to run through codegov.json. the "bathtub curve" is what we have here and what we need to experiment with and solve 👀
Expand All @@ -25,7 +25,7 @@
async function fetchWithRateLimit(url, options = {}) {
if (CONFIG.rateLimitRemaining <= 10 && Date.now() < CONFIG.rateLimitReset) {
const waitTime = CONFIG.rateLimitReset - Date.now() + 1000 // add 1 second buffer
console.log(`Rate limit low (${CONFIG.rateLimitRemaining} remaining). Waiting ${Math.round(waitTime/1000)}s...`)

Check warning on line 28 in config/updateIssuePool.js

View workflow job for this annotation

GitHub Actions / Run linter

Unexpected console statement
await new Promise(resolve => setTimeout(resolve, waitTime))
}

Expand All @@ -41,10 +41,10 @@
}

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

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

for (const agencyKey in jsonData) {
Expand All @@ -64,14 +64,14 @@
repoName: repo
})
} else {
console.warn(`No match found for URL: ${organization.repositoryURL}`)

Check warning on line 67 in config/updateIssuePool.js

View workflow job for this annotation

GitHub Actions / Run linter

Unexpected console statement
}
}
}
}
}
} catch (error) {
console.error("Error in getting repo information:", error)
console.error('Error in getting repo information:', error)
}

// console.log(repoInfo)
Expand Down Expand Up @@ -102,11 +102,11 @@
id: String(issue.id),
number: issue.number,
url: issue.html_url,
content_title: issue.title || "",
content_description: issue.body || "",
content_title: issue.title || '',
content_description: issue.body || '',
repo_name: repo.repoName,
repo_url: `https://github.com/${repo.ownerName}/${repo.repoName}`,
repo_language: repoLanguage || "",
repo_language: repoLanguage || '',
repo_owner: repo.ownerName,
status_is_open: issue.state === 'open',
status_has_assignee: issue.assignee !== null,
Expand All @@ -115,9 +115,9 @@
time_last_updated: issue.updated_at,
time_days_old: daysBetween(createdDate, now),
time_last_activity_days_ago: daysBetween(updatedDate, now),
people_author: issue.user?.login || "",
people_author: issue.user?.login || '',
people_assignee: issue.assignee?.login || null,
people_author_type: issue.user?.type || "",
people_author_type: issue.user?.type || '',
labels_list: labelNames,
labels_count: labelNames.length,
labels_has_priority: checkLabelKeywords(issue.labels, ['priority', 'p0', 'p1', 'p2', 'urgent']),
Expand Down Expand Up @@ -146,7 +146,7 @@
}

const repoData = await repoResponse.json()
const repoLanguage = repoData.language || ""
const repoLanguage = repoData.language || ''

let page = 1
let hasMore = true
Expand Down Expand Up @@ -215,9 +215,9 @@

try {
await fs.writeFile(CONFIG.issueFilePath, JSON.stringify(issuePool, null, 2))
console.log(`Successfully saved issues!`)
console.log('Successfully saved issues!')
} catch (error) {
console.error("Error saving issue pool:", error)
console.error('Error saving issue pool:', error)
}

return issuePool
Expand Down
16 changes: 16 additions & 0 deletions content/privacy-policy/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
title: Privacy Policy
description: 'Privacy Policy'
permalink: /privacy-policy/
layout: layouts/page
tags: codegov
eleventyNavigation:
parent: codegov-privacypolicy
key: codegov-privacypolicy-main
order: 1
title: Privacy Policy
sidenav: false
sticky_sidenav: false
---

This website follows the [HHS Privacy Policy](https://www.hhs.gov/web/policies-and-standards/hhs-web-policies/privacy/index.html).
8 changes: 4 additions & 4 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,20 +34,20 @@ <h2>Developers</h2>
href="https://github.com/GSA/code-gov/blob/master/README.md" target="_blank">contribute here</a>. Help
improve America's Code by exploring projects.
</p>
<a class="usa-button" href="{{'/projects' | url }}">Explore projects</a>
<a class="usa-button" href="{{'/projects/' | url }}">Explore projects</a>
</div>
<div class="explore-inventory">
<h2>Source Code Inventory</h2>
<p>Review source code development across the entire federal government.</p>
<a class="usa-button" href="{{'/agencies' | url }}"> View by Agency </a>
<a class="usa-button" href="{{'/agencies/' | url }}"> View by Agency </a>
</div>
<div class="explore-agencies">
<h2>Agency Partners</h2>
<p>
Federal agency partners use Code.gov to share usable open source code, promote open source
projects, and track compliance with federal open source policy.
</p>
<a class="usa-button" href="{{'/agency-compliance/compliance/dashboard' | url }}">Agency Compliance</a>
<a class="usa-button" href="{{'/agency-compliance/compliance/dashboard/' | url }}">Agency Compliance</a>
</div>
</div>
<div class="grid-row">
Expand Down Expand Up @@ -108,7 +108,7 @@ <h3>OPT-IN WITH LABELS</h3>
</div>
</div>
<div style="text-align: center; margin-top: 2rem;">
<a class="usa-button" href="/code-gov/issues/">Browse Issues</a>
<a class="usa-button" href="{{'/issues/' | url }}">Browse Issues</a>
</div>
</div>
</section>
Expand Down
Loading