Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

URL parse work #25

Open
wants to merge 156 commits into
base: AK-Branch
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
156 commits
Select commit Hold shift + click to select a range
f8da3d9
Commit by Jonah
JNicho206 Sep 3, 2023
0f3eac8
Commit by Ethan
ethanburmane Sep 3, 2023
40ab1d0
Merge pull request #1 from ethanburmane/AK-Branch
ethanburmane Sep 3, 2023
719b6b6
Update README.md
ethanburmane Sep 3, 2023
27aba33
Commit by Ashwin Sreedhar
ashwinsreedhar28 Sep 3, 2023
51a1d34
Commit by Ashwin
ashwinsreedhar28 Sep 3, 2023
3ef9d01
Merge pull request #4 from ethanburmane/Ashwin-Branch
ashwinsreedhar28 Sep 3, 2023
4a73bcb
Update README.md - Added my name
JNicho206 Sep 3, 2023
46caf55
Merge pull request #6 from ethanburmane/Jonah-Branch
JNicho206 Sep 3, 2023
268496b
Update README.md
tobyonyekwere1 Sep 7, 2023
069cade
Create Toby-test
tobyonyekwere1 Sep 7, 2023
4591db5
Rename Toby-test to Commit by Toby
tobyonyekwere1 Sep 7, 2023
a145ec9
Commit by Toby
tobyonyekwere1 Sep 7, 2023
5ec98a9
Update README.md with rpm documentation
JNicho206 Sep 7, 2023
132a499
Update README.md outlined npm install problems
JNicho206 Sep 7, 2023
a61c7cc
Update README.md reformatted bullets
JNicho206 Sep 7, 2023
29f2e1f
Update README.md Added information on GItHub and npm APIs
JNicho206 Sep 7, 2023
17a3cad
Merge branch 'main' into Jonah-Branch
JNicho206 Sep 7, 2023
598423c
Merge pull request #22 from ethanburmane/Jonah-Branch
JNicho206 Sep 7, 2023
2be5fa8
started working on the metrics file
ethanburmane Sep 7, 2023
1740864
moved files out of unneccessary folder
ethanburmane Sep 7, 2023
8e523e1
organized files, added headers, started url handler
ethanburmane Sep 7, 2023
339e76c
modified the metrics to be class-based. Added urlfile.ts
ethanburmane Sep 8, 2023
9f75b58
removed unused import
ethanburmane Sep 8, 2023
34a2739
added methods for bus factor class
ethanburmane Sep 9, 2023
bcafc99
Built out npm handler and added helper objects
Sep 11, 2023
cb36ccb
Added function headers
Sep 11, 2023
32dc98e
Merge pull request #26 from ethanburmane/Jonah-Branch
JNicho206 Sep 11, 2023
ee4c291
Removed comments
JNicho206 Sep 11, 2023
d271d6a
Merge branch 'main' into Ethan-Branch
ethanburmane Sep 11, 2023
d8dfe70
Merge pull request #27 from ethanburmane/Ethan-Branch
ethanburmane Sep 11, 2023
e4a2c43
Started making unit tests for handler
Sep 12, 2023
5ae3334
Added getters:
Sep 12, 2023
795d095
Skeleton of unit tests for Score module
Sep 14, 2023
35f565d
Skeleton of unit tests for Score module
Sep 14, 2023
e35dacd
Added Package module and reformatted code to take the new module
Sep 14, 2023
f5621f8
Changed .evaluate to loop through metrics available
Sep 14, 2023
781dbbe
License
kreimera02 Sep 15, 2023
060db40
license update
kreimera02 Sep 15, 2023
74703ce
License
kreimera02 Sep 15, 2023
4c289a0
Changed metric implementations to implement an interface and inherit …
Sep 16, 2023
542f51e
Created installer objectand moved functionality into the object
Sep 16, 2023
3dd0561
Cleanup and comments
Sep 16, 2023
9ae1b77
Fixed type for metrics
Sep 16, 2023
ffe0821
Added import
Sep 16, 2023
7dcc055
Skeleton for package installation function
Sep 16, 2023
8865c6c
added to the metrics interface file
ethanburmane Sep 17, 2023
8b9deb1
commiting .DS_store
ethanburmane Sep 17, 2023
55851e2
added bus factor functionallity
ethanburmane Sep 17, 2023
86c3fb9
Merge pull request #35 from ethanburmane/Ethan-Branch
ethanburmane Sep 17, 2023
a1b5da4
updating file structure
ethanburmane Sep 17, 2023
a48f02b
removed unnesseccary file
ethanburmane Sep 17, 2023
b29eb93
updated the pull_request.yaml file
ethanburmane Sep 17, 2023
6907866
created a main.yml for workflow configuration
ethanburmane Sep 17, 2023
9a559aa
added .github/labeler.yml
ethanburmane Sep 17, 2023
f6d4e81
working on fixing the main.yml
ethanburmane Sep 17, 2023
f222d3a
tried fixing the main.yml file
ethanburmane Sep 17, 2023
535ac2e
tried fixing the main.yml file
ethanburmane Sep 17, 2023
9ddfd15
tried fixing the main.yml file
ethanburmane Sep 17, 2023
d1450bb
Merge pull request #36 from ethanburmane/Ethan-Branch
ethanburmane Sep 17, 2023
eb3c313
updating file structure -- added Ashwin's code
ethanburmane Sep 17, 2023
5085d7e
Merge pull request #37 from ethanburmane/Ethan-Branch
ethanburmane Sep 17, 2023
f35bc48
Add files via upload
ethanburmane Sep 17, 2023
8f2e831
Merge pull request #33 from kreimera02/main
ethanburmane Sep 17, 2023
a6c5ba0
Restructured code
Sep 17, 2023
297a58f
Merge branch 'main' into Jonah-Branch
JNicho206 Sep 17, 2023
60e321c
Merge pull request #38 from ethanburmane/Jonah-Branch
ethanburmane Sep 17, 2023
effc8d1
Update urlfile.ts with outline for command
JNicho206 Sep 17, 2023
c30d950
Update urlfile.ts with functions for command action
JNicho206 Sep 17, 2023
9d7e74e
Fixed name mismatch
Sep 17, 2023
69c0740
Code cleanup
Sep 17, 2023
cafbe82
Update urlfile.ts - filled in function to print scores.
JNicho206 Sep 18, 2023
9dbce20
Added function to get the issues from github
Sep 18, 2023
53b3925
updated netscore
tobyonyekwere1 Sep 19, 2023
29a97ae
adding the correct urlfile.ts
ethanburmane Sep 19, 2023
db09ab9
corrected the url_file.ts
ethanburmane Sep 19, 2023
0540807
changed file path
ethanburmane Sep 19, 2023
c512c58
Merge branch 'main' into Ethan-Branch
ethanburmane Sep 19, 2023
a811915
Merge pull request #39 from ethanburmane/Ethan-Branch
ethanburmane Sep 19, 2023
1fca778
Added logger file
Sep 21, 2023
fcd5c86
added the bus factor and the responsive maintainer metrics
ethanburmane Sep 21, 2023
aee7015
Merge pull request #41 from ethanburmane/Jonah-Branch
JNicho206 Sep 21, 2023
b0798c8
Updated Test Files
ashwinsreedhar28 Sep 21, 2023
023f465
Merge branch 'main' of https://github.com/ethanburmane/ECE461Project
ashwinsreedhar28 Sep 21, 2023
da20497
Added logging examples
Sep 22, 2023
25cc143
Merge pull request #42 from ethanburmane/Jonah-Branch
JNicho206 Sep 22, 2023
5725538
Updated Testing for Metrics and URL_handler
ashwinsreedhar28 Sep 22, 2023
de69680
Merge branch 'main' of https://github.com/ethanburmane/ECE461Project
ashwinsreedhar28 Sep 22, 2023
69a48e5
Merge pull request #43 from ethanburmane/Ethan-Branch
ethanburmane Sep 22, 2023
3534281
Created new branch
ashwinsreedhar28 Sep 22, 2023
fa0d3b1
Updated with new sections
JNicho206 Sep 23, 2023
fc4dc4d
Filled out readme with some subheads
JNicho206 Sep 23, 2023
fd3b668
added functionallity for net score
ethanburmane Sep 23, 2023
2458f8e
Merge pull request #44 from ethanburmane/Ethan-Branch
ethanburmane Sep 23, 2023
4ce6687
added error handling to bus factor, responsive maintainer, and net score
ethanburmane Sep 23, 2023
7e894dd
Merge pull request #45 from ethanburmane/Ethan-Branch
ethanburmane Sep 23, 2023
e179e72
Merge pull request #46 from ethanburmane/Ashwin-2
ashwinsreedhar28 Sep 23, 2023
12e96d5
created folder for deprecated code
ethanburmane Sep 23, 2023
452c037
deleting files moved into the deprecated code folder
ethanburmane Sep 23, 2023
02819cf
reorganizing deprecated files
ethanburmane Sep 23, 2023
5893e6d
Merge pull request #47 from ethanburmane/Ethan-Branch
ethanburmane Sep 23, 2023
032b445
Update metric.ts
ashwinsreedhar28 Sep 23, 2023
6648064
Merge pull request #48 from ethanburmane/Ashwin-2
ashwinsreedhar28 Sep 23, 2023
7978921
Reconfigured urlfile, new imports
ashwinsreedhar28 Sep 23, 2023
7ecab02
Merge pull request #51 from ethanburmane/Ashwin-2
ashwinsreedhar28 Sep 23, 2023
c187a69
adding PKG.ts file and making logger exportable
ethanburmane Sep 23, 2023
602fca4
Merge pull request #52 from ethanburmane/Ethan-Branch
ethanburmane Sep 23, 2023
bfa45ef
code
tobyonyekwere1 Sep 24, 2023
5af48d2
Added comments for logging locations
Sep 24, 2023
111a52e
Update README.md with code snippets
JNicho206 Sep 24, 2023
7734261
Update README.md added more documentation
JNicho206 Sep 24, 2023
c6dceea
correctness metric
tobyonyekwere1 Sep 24, 2023
ae2fa2a
correctness done
tobyonyekwere1 Sep 24, 2023
2859c78
Update README.md
JNicho206 Sep 24, 2023
55d36cf
Merge pull request #53 from ethanburmane/toby-branch
ethanburmane Sep 24, 2023
4a9ef4d
Update README.md
JNicho206 Sep 24, 2023
2579a92
Update logger.ts to use log level and log path from environment
JNicho206 Sep 24, 2023
359296e
Update logger.ts syntax fix
JNicho206 Sep 24, 2023
24ef032
Update README.md diagram links
JNicho206 Sep 24, 2023
abc7c21
Update README.md
JNicho206 Sep 24, 2023
462ad73
Changing imports to depend on PKG.ts
ashwinsreedhar28 Sep 24, 2023
a32d05d
Merge pull request #54 from ethanburmane/Ashwin-4_withPKG
ashwinsreedhar28 Sep 24, 2023
0fbb945
Update README.md
JNicho206 Sep 24, 2023
71a79bf
Update README.md
JNicho206 Sep 24, 2023
1dda3f8
License
kreimera02 Sep 24, 2023
2256d9c
Update README.md
JNicho206 Sep 24, 2023
ec0bd81
Update README.md
JNicho206 Sep 24, 2023
d62a392
public token
kreimera02 Sep 24, 2023
095c188
Updated URL_FILE Command
ashwinsreedhar28 Sep 24, 2023
806c84f
Update README.md
JNicho206 Sep 24, 2023
9e88f08
Update README.md
kreimera02 Sep 24, 2023
eaabeb0
Updated testing, adjusted to remove errors
ashwinsreedhar28 Sep 24, 2023
6a09731
Merge pull request #57 from ethanburmane/ashwin-6
ashwinsreedhar28 Sep 24, 2023
c51d4d7
Update install.ts with log locations
JNicho206 Sep 24, 2023
ffb3275
Update PKG.ts with log locations
JNicho206 Sep 24, 2023
f301382
Adjusted URL_FILE command to only need to run NetScore command
ashwinsreedhar28 Sep 24, 2023
f51fbb6
Merge pull request #58 from ethanburmane/ashwin-6
ashwinsreedhar28 Sep 24, 2023
57447cd
Adding index.ts and run
ashwinsreedhar28 Sep 24, 2023
ebcf5dc
Merge pull request #59 from ethanburmane/ashwin-6
ashwinsreedhar28 Sep 24, 2023
f8abf9e
Update install.ts added logging instances
JNicho206 Sep 24, 2023
7a27c2c
Update PKG.ts with logging
JNicho206 Sep 24, 2023
8f3f7e9
Added logging
JNicho206 Sep 24, 2023
c6329b4
Merge pull request #60 from ethanburmane/integrate-logging
JNicho206 Sep 24, 2023
b10c672
Update README.md
JNicho206 Sep 24, 2023
f5b148c
Minor changes to run.ts, metric test and executable
ashwinsreedhar28 Sep 25, 2023
adc0014
added functionallity for ramp up metric
ethanburmane Sep 25, 2023
4fc67a0
added call to clone repo method, added temp_dir attribute to the Pack…
ethanburmane Sep 25, 2023
34f3dcf
resolving conflicts
ethanburmane Sep 25, 2023
e1f52f0
Merge branch 'main' into Ethan-Branch
ethanburmane Sep 25, 2023
06e88d5
Merge pull request #62 from ethanburmane/Ethan-Branch
ethanburmane Sep 25, 2023
018a579
Added documentation link
JNicho206 Sep 26, 2023
0393f9a
Fixed file name
Oct 12, 2023
a1c77f9
Merge pull request #63 from ethanburmane/Fix-file-name
JNicho206 Oct 12, 2023
2882bf9
Error Removal within urlfile.js
ashwinsreedhar28 Oct 20, 2023
891ced5
Update install.js to install pino
JNicho206 Oct 20, 2023
7bb72c6
Adding LOG_FILE
ashwinsreedhar28 Oct 21, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
9 changes: 9 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
labels:
- name: bug
conditions:
- title: bug
- body: bug
- name: update
conditions:
- title: update
- body: update
23 changes: 23 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Pull Request Labeler
on:
pull_request_target:
types: [opened, edited]

jobs:
triage:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write

steps:
- name: Check Out Code
uses: actions/checkout@v2

- name: Label Pull Request
uses: actions/labeler@v4
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
labels: |
bug:bug
update:update
13 changes: 0 additions & 13 deletions .github/workflows/pull_request.yml

This file was deleted.

2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/cli/node_modules/
/.github/
156 changes: 156 additions & 0 deletions License.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
// Version: 1.0
// Date: 09/15/2023
// Author: Andrew Kreimer
// Description: This file will take in a url and determine the correct handler to send it to
// Actions: Link to CLI call
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
import axios from 'axios';
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
// Parameters: repo_url: string
// Function: github_handler
// Associated: github_handler, npm_handler
// Description: This function will take in a url and determine the correct handler to send it to
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
class UrlHandler {
private githubRegex: RegExp;
private npmRegex: RegExp;
private token: string;
public urlList: string[] = []; //list of unmatched urls


constructor(token: string) {
//regex for github url and npm url
this.githubRegex = /^https?:\/\/github\.com\/[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+\/?$/;
//this.githubRegex = /^(?:https:\/\/)?(github\.com\/|git@github\.com:)([A-Za-z0-9_.-])+\/([A-Za-z0-9_.-]+)(?:\.git)?$/;
this.npmRegex = /^https?:\/\/(?:www\.)?npmjs\.com\/package\/[^/]+\/?$/;
//this.npmRegex = /^(?:https:\/\/www\.)?npmjs\.com\/package\/([^/]+)/;
this.token = token;
}

private async github_handler(url:string) {
const repo = url.split('/')[2] // Github Repo Name
const owner = url.split('/')[1] // Github Username
try {
const response = await axios.get(`https://api.github.com/repos/${owner}/${repo}`, {
headers: {
Authorization: `Bearer ${this.token}`,
},
});

if (response.status === 200) {
const repositoryData = response.data;
console.log(repositoryData);
} else {
console.error(`GitHub API request failed with status: ${response.status}`);
}
} catch (error) {
console.error('Error while making the GitHub API request:', error);
}
}

Parse(url: string) {
if (this.githubRegex.test(url)) {
//call github handler
this.github_handler(url);
console.log("Github Repository URL");
} else if (this.npmRegex.test(url)) {
//call npm handler
//this.npm_handler(url);
console.log("NPM Repository URL");
} else {
//store
this.urlList.push(url);
console.log("Neither GitHub nor NPM Repository URL");
}
return url;
}
}

// Test cases
const AK_token = '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'
const detector = new UrlHandler(AK_token);

const passingURLs: string[] = [
"https://github.com/user/repo",
"https://github.com/user/repo/",
"http://github.com/user/repo",
"https://npmjs.com/package/package-name",
"https://www.npmjs.com/package/package-name",
"http://npmjs.com/package/package-name",
"https://www.npmjs.com/package/package-name/",
"https://npm.pkg.github.com/user/repo",
"https://www.npm.pkg.github.com/user/repo",
"http://npm.pkg.github.com/user/repo",
"https://github.com/user/repo123",
"https://github.com/user/repo123/",
"http://github.com/user/repo123",
"https://npmjs.com/package/package-name123",
"https://www.npmjs.com/package/package-name123",
"http://npmjs.com/package/package-name123",
"https://www.npmjs.com/package/package-name123/",
"https://npm.pkg.github.com/user/repo123",
"https://www.npm.pkg.github.com/user/repo123",
"http://npm.pkg.github.com/user/repo123",
];

const failingURLs: string[] = [
"https://example.com",
"https://www.example.com",
"http://example.com",
"ftp://github.com/user/repo",
"https://npmjs.org/package/package-name",
"https://www.npmjs.org/package/package-name",
"http://npmjs.org/package/package-name",
"https://www.npmjs.org/package/package-name/",
"https://npmjs.com",
"https://www.npmjs.com",
"http://npmjs.com",
"https://github.com",
"https://www.github.com",
"http://github.com",
"https://npmjs.com/package-name123",
"https://www.npmjs.com/package-name123",
"http://npmjs.com/package-name123",
"https://www.npmjs.com/package-name123/",
"https://npm.pkg.github.com",
"https://www.npm.pkg.github.com",
"http://npm.pkg.github.com",
"https://github.com123",
"https://www.github.com123",
"http://github.com123",
"https://npmjs.org/package/package-name123",
"https://www.npmjs.org/package/package-name123",
"http://npmjs.org/package/package-name123",
"https://www.npmjs.org/package/package-name123/",
"https://npm.pkg.github.com123",
"https://www.npm.pkg.github.com123",
"http://npm.pkg.github.com123",
"https://github.com/user/repo/extra",
"https://npmjs.com/package/package-name/extra",
"https://npm.pkg.github.com/user/repo/extra",
"https://example.com/user/repo",
"https://example.com/package/package-name",
"https://example.com/user/repo123",
"https://example.com/package/package-name123",
"https://example.com/user/repo/extra",
"https://example.com/package/package-name/extra",
"https://example.com/user/repo123/extra",
"https://example.com/package/package-name123/extra",
];

console.log(detector.Parse("https://github.com/yoheinakajima/instagraph"));
// console.log("Passing URLs:");
// for (let i = 0; i < passingURLs.length; i++) {
// console.log(detector.Parse(passingURLs[i]));
// }

// console.log("\nFailing URLs:");
// for (let j = 0; j < failingURLs.length; j++) {
// console.log(detector.Parse(failingURLs[j]));
// }

// console.log("\nUnmatched URLs:");
// console.log(detector.urlList);

// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Loading