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

add more tests, use the Sourcegraph stubs api and improve repo matching. #13

Merged
merged 40 commits into from
May 21, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
4b36175
add more tests, extend the mock API to test activate
vanesa Apr 23, 2019
90bed81
Update dependency @sourcegraph/tslint-config to ^13.1.0
renovate-bot Apr 26, 2019
4d26f4d
WIP: refactor to use extension api stubs
vanesa Apr 26, 2019
3665af2
remove wip
vanesa Apr 29, 2019
94af29b
Merge branch 'master' of github.com:sourcegraph/sourcegraph-sentry
vanesa Apr 29, 2019
2afb581
Update dependency sourcegraph to ^23.0.1
renovate-bot Apr 30, 2019
b28aeea
Add CI badge (#17)
felixfbecker Apr 30, 2019
dbbdb88
add more tests, extend the mock API to test activate
vanesa Apr 23, 2019
1a3dbc7
WIP: refactor to use extension api stubs
vanesa Apr 26, 2019
07a3693
add more tests, extend the mock API to test activate
vanesa Apr 23, 2019
f1a5fd0
WIP: refactor to use extension api stubs
vanesa Apr 26, 2019
b13e934
Merge branch 'vo/increase-test-coverage' of github.com:sourcegraph/so…
vanesa Apr 30, 2019
a40c7ca
fix tests
vanesa Apr 30, 2019
accbf41
update extension stubs package and tests
vanesa Apr 30, 2019
011c6ad
fix tests
vanesa May 1, 2019
0a0739b
refactor code, increase text coverage to 88%
vanesa May 8, 2019
c780656
improve repo matching with better repoMatch param, update tests
vanesa May 9, 2019
c58b093
update package.json and combineLatest implementation
vanesa May 9, 2019
d76f9cf
handle promises with beforeEach and await
vanesa May 9, 2019
d6b86c8
use URLSearchParams instead of encodeURIComponent
vanesa May 9, 2019
0c328e3
Update src/test/handler.test.ts wording
vanesa May 13, 2019
dfb48aa
Update src/test/handler.test.ts wording
vanesa May 13, 2019
c126f17
Update src/test/handler.test.ts wording
vanesa May 13, 2019
c089c03
Update src/test/extension.test.ts wording
vanesa May 13, 2019
6e27835
Update src/test/handler.test.ts wording
vanesa May 13, 2019
f00abd6
refactor based on code review
vanesa May 13, 2019
4480b93
refactor for better config structure and based on code review
vanesa May 15, 2019
9dc20f0
update test name, improve missing configs hover message
vanesa May 15, 2019
9294264
improve matching and add more tests
vanesa May 16, 2019
b959cf6
capture group after # in fileMatch regexp pattern
vanesa May 16, 2019
8fd14dc
improve hover messages
vanesa May 16, 2019
aa93c7a
update test and clean code
vanesa May 16, 2019
870178f
fix hover message matching
vanesa May 16, 2019
9c44d15
simplify repo matching, add tests, restructure configs
vanesa May 21, 2019
7a63ea7
update ReadMe
vanesa May 21, 2019
ddf84b1
fix prettier
vanesa May 21, 2019
e44aea3
Fix type of regexp properties in SentryProject
May 21, 2019
e8aca8a
Update src/handler.ts
lguychard May 21, 2019
d165eee
Use array.some, rename variables
May 21, 2019
622bf92
Add a return, remove a return
May 21, 2019
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
89 changes: 66 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
[![codecov](https://codecov.io/gh/sourcegraph/sentry/branch/master/graph/badge.svg)](https://codecov.io/gh/sourcegraph/sourcegraph-sentry)

# Sentry extension

[![build](https://travis-ci.org/sourcegraph/sentry.svg?branch=master)](https://travis-ci.org/sourcegraph/sentry)
[![codecov](https://codecov.io/gh/sourcegraph/sentry/branch/master/graph/badge.svg)](https://codecov.io/gh/sourcegraph/sourcegraph-sentry)

Sentry helps devs track, organize and break down errors more efficiently, facilitating their debug process. We want to make it more convenient for developers to access Sentry's error tracking tools directly from the code that is doing the error handling, code such as `throw new Error(QUERY)`, `console.log(QUERY)`, `console.error(QUERY)` etc..

The Sentry extension renders a `View logs in Sentry` next to error throwing statements, linking directly to the corresponding Sentry issues stream page. Links are rendered when viewing files on [Sourcegraph](https://sourcegraph.com), GitHub and GitLab.
Expand Down Expand Up @@ -34,24 +35,31 @@ Set the following configurations in your settings:
{
"name": "[Project name for the config overview, e.g. Webapp errors]",
"projectId": "[Sentry project ID, e.g. "1334031"]",
"patternProperties": {
"repoMatches": "[RegExp[] repo names asociated with this Sentry project]",
"fileMatches": [
[RegExp[] that matches file format, e.g. "\\.tsx?"]
],
"lineMatches": [
[RegExp[] that matches error handling code, e.g. "throw new Error+\\(['\"]([^'\"]+)['\"]\\)"],
"linePatterns": [
// List of RegExp patterns that match error handling code, e.g. "throw new Error+\\(['\"]([^'\"]+)['\"]\\)",
// !! Make sure to capture the error message in a RegExp group !!
]
"filters": {
[
"repositories": [
// List of RegExp repo names asociated with this Sentry project
],
"files": [
// List of RegExp that matches file format, e.g. "\\.tsx?",
// or for more specific matching, folder matching, e.g. "(?:web|shared|src)\/.*\\.tsx?"
],
}
}

```

File matches can also be narrowed down to certain folders by specifying this in the RegExp:
## Important features:

File patterns can also be narrowed down to certain folders by specifying this in the RegExp:

```
...
"fileMatches": ["(web|shared|src)\/.*\\.tsx?"]
"files": ["(?:web|shared|src)\/.*\\.tsx?"]
...
```

Expand All @@ -62,25 +70,60 @@ File matches can also be narrowed down to certain folders by specifying this in
Configuration:

```
...
"patternProperties": {
"repoMatches": "sourcegraph",
"fileMatches": ["([^'\"]+)\/.*\\.ts?"],
"lineMatches": [
"throw new Error+\\(['\"]([^'\"]+)['\"]\\)",
"console\\.(warn|debug|info|error)\\(['\"`]([^'\"`]+)['\"`]\\)"
]
"sentry.decorations.inline": true,
"sentry.organization": "sourcegraph",
"sentry.projects": [
{
"name": "sourcegraph",
"projectId": "1334031",
"linePatterns": [
"throw new Error+\\(['\"]([^'\"]+)['\"]\\)",
"console\\.(warn|debug|info|error)\\(['\"`]([^'\"`]+)['\"`]\\)"
]
"filters": [
{
"repositories": "sourcegraph\/sourcegraph",
"files": ["web\/.*\\.ts?"],
},
{
"files": ["sourcegraph-subfolder\/.*\\.tsx?"]
}

]
}
]

```

- [On Sourcegraph](https://sourcegraph.com/github.com/sourcegraph/sourcegraph/-/blob/client/browser/src/libs/github/file_info.ts#L16)
- [On GitHub](https://github.com/sourcegraph/sourcegraph/blob/master/client/browser/src/libs/github/file_info.ts#L16)
- [On Sourcegraph](https://sourcegraph.com/github.com/sourcegraph/sourcegraph/-/blob/browser/src/libs/github/file_info.ts#L22)
- [On GitHub](https://github.com/sourcegraph/sourcegraph/blob/master/browser/src/libs/github/file_info.ts#L22)

- Go

- [On Sourcegraph](https://sourcegraph.com/github.com/sourcegraph/sourcegraph/-/blob/cmd/frontend/auth/user_test.go#L54:19)
- [On GitHub](https://github.com/sourcegraph/sourcegraph/blob/master/cmd/frontend/auth/user_test.go#L54)
Configuration:

```
"sentry.decorations.inline": true,
"sentry.organization": "sourcegraph",
"sentry.projects": [
"name": "Dev env errors",
"projectId": "213332",
"linePatterns": ["errors\\.New\\(['\"`](.*)['\"`]\\)"],
"filters": [
{
"repositories": ["sourcegraph\/sourcegraph", "sourcegraph\/dev-repo"],
"files": ["/auth\/.*.go?/"],
},
{
"repositories": ["/dev-env/"]
}
],
]

```

- [On Sourcegraph](https://sourcegraph.com/github.com/sourcegraph/sourcegraph/-/blob/cmd/frontend/auth/user_test.go#L54:19)
- [On GitHub](https://github.com/sourcegraph/sourcegraph/blob/master/cmd/frontend/auth/user_test.go#L54)

- JavaScript

Expand Down
37 changes: 23 additions & 14 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 17 additions & 17 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"activationEvents": [
"*"
],
"wip": true,
"wip": false,
"categories": [
"External services"
],
Expand Down Expand Up @@ -44,7 +44,6 @@
"alt": "sentry.link.fileList",
"when": "resource && !config.sentry.hideSentryButton"
}

],
"commandPalette": [
{
Expand Down Expand Up @@ -89,22 +88,22 @@
"repoMatches": {
"type": "array",
"items": {
"type": "string"
},
"type": "string"
},
"description": "Regex to match repos associated to this Sentry project, e.g. github\\.com/sourcegraph/sourcegraph"
},
"fileMatches": {
"type": "array",
"items": {
"type": "string"
},
"type": "string"
},
"description": "Regex to match files associated with this project, e.g. (web|shared)/.*\\.tsx?$"
},
"lineMatches": {
"type": "array",
"items": {
"type": "string"
},
"type": "string"
},
"description": "Regex to match lines associated with this project, e.g. throw new Error\\([\"']([^'\"]+)[\"']\\)"
}
},
Expand Down Expand Up @@ -175,9 +174,10 @@
"last 1 Safari versions"
],
"devDependencies": {
"@sourcegraph/extension-api-stubs": "^0.2.0",
"@sourcegraph/prettierrc": "^2.2.0",
"@sourcegraph/tsconfig": "^4.0.0",
"@sourcegraph/tslint-config": "^13.0.0",
"@sourcegraph/tslint-config": "^13.1.0",
"@types/expect": "1.20.4",
"@types/lodash": "4.14.123",
"@types/mocha": "5.2.6",
Expand All @@ -188,17 +188,17 @@
"lnfs-cli": "^2.1.0",
"lodash": "^4.17.11",
"mkdirp": "^0.5.1",
"mocha": "^6.1.2",
"mocha": "^6.1.4",
"mock-require": "^3.0.3",
"nyc": "^13.3.0",
"nyc": "^14.1.0",
"parcel-bundler": "^1.12.3",
"prettier": "1.17.0",
"rxjs": "^6.4.0",
"sinon": "^7.3.1",
"rxjs": "^6.5.1",
"sinon": "^7.3.2",
"source-map-support": "^0.5.12",
"sourcegraph": "^23.0.0",
"ts-node": "^8.0.3",
"tslint": "^5.15.0",
"typescript": "^3.4.2"
"sourcegraph": "^23.0.1",
"ts-node": "^8.1.0",
"tslint": "^5.16.0",
"typescript": "^3.4.5"
}
}
Loading