codecov / sourcegraph-codecov Goto Github PK
View Code? Open in Web Editor NEWSee code coverage information from Codecov on GitHub, Sourcegraph, and other tools.
License: MIT License
See code coverage information from Codecov on GitHub, Sourcegraph, and other tools.
License: MIT License
We use Codecov on all of the code in our repository. But some code files have no tests and therefore no test coverage data, and the extension's current behavior can be confusing because a user would probably expect those files to be marked "0% coverage" instead of showing nothing.
For example, https://sourcegraph.com/github.com/sourcegraph/sourcegraph@eda8778b442c5fb25617e07e006516c4d815092a/-/blob/cmd/frontend/auth/providers/providers.go is a file in a Go package that has no test files. There is no "0% coverage" displayed, the file in the sidebar has no file tree decorations with "0%", and the lines have no red background colors to indicate no coverage. This causes a user to think either that the Codecov extension is not working, or perhaps that the file is not missing test coverage ("well, I didn't see any red lines!").
That file's directory is marked as having "0%" coverage in the sidebar:
I don't know what the solution is here. Is the problem with how we're sending up test coverage from our repository to Codecov? Can the extension infer that "0% coverage" on the directory means the same for all files? Is this a per-language thing, a Codecov thing, or an extension thing?
(Related: internal Sourcegraph discussion at https://sourcegraph.slack.com/archives/C01CSS3TC75/p1609369144174800?thread_ts=1609367985.172800&cid=C01CSS3TC75.)
I cannot seem to get the code coverage background color to show up in GitHub for the example mentioned in the usage section of the README. Perhaps the recent GitHub UI change from June 23rd broke it?
I just installed the extension and I'm seeing diffs on github working for specific files but not for commits.
For example I don't see coverage showing up mapbox/geometry.hpp@c83a2ab but I do see coverage showing at https://github.com/mapbox/geometry.hpp/blob/c83a2ab18a225254f128b6f5115aa39d04f2de21/include/mapbox/geometry_io.hpp.
I think the commit view is the most valuable place to show coverage. Also the now deprecated https://github.com/codecov/browser-extension used to work this way: it showed coverage for commits.
Specifically, the error message "To set a Codecov API token, navigate to a file and then re-run this command." is displayed (nearly unreadably, I had to highlight text to figure this out) when clicking on the command.
I'm not sure when exactly this happened, but the codecov token I generated hadn't been used since last week (and I wasn't getting coverage overlays), so I removed/readded the sourcegraph extension only to not be able to re-add the token.
While the message suggests that you need to be on a file page, it currently is displaying on all pages for me.
Happy to provide more details if needed. It's possible this is related to #11, but the symptoms seem sufficiently different.
https://sourcegraph.com/extensions?query=category%3AInsights&category=All doesn't currently show codecov, but it can contribute Insights, so it should!
On master, yarn run typecheck
prints these errors:
> yarn run typecheck
yarn run v1.16.0
$ tsc -p tsconfig.json
src/model.ts:18:9 - error TS2322: Type 'string | undefined' is not assignable to type 'string'.
Type 'undefined' is not assignable to type 'string'.
18 baseURL: endpoint.url,
~~~~~~~
src/api.ts:7:5
7 baseURL: string
~~~~~~~
The expected type comes from property 'baseURL' which is declared here on type 'CodecovGetCommitCoverageArgs'
src/model.ts:31:9 - error TS2322: Type 'string | undefined' is not assignable to type 'string'.
Type 'undefined' is not assignable to type 'string'.
31 baseURL: endpoint.url,
~~~~~~~
src/api.ts:7:5
7 baseURL: string
~~~~~~~
The expected type comes from property 'baseURL' which is declared here on type 'CodecovGetCommitCoverageArgs'
src/model.ts:44:9 - error TS2322: Type 'string | undefined' is not assignable to type 'string'.
Type 'undefined' is not assignable to type 'string'.
44 baseURL: endpoint.url,
~~~~~~~
src/api.ts:7:5
7 baseURL: string
~~~~~~~
The expected type comes from property 'baseURL' which is declared here on type 'CodecovGetCommitCoverageArgs'
src/model.ts:49:39 - error TS2345: Argument of type 'unknown' is not assignable to parameter of type '{ l: { [line: number]: string | number | null | undefined; }; t: { c: string; }; } | undefined'.
Type 'unknown' is not assignable to type '{ l: { [line: number]: string | number | null | undefined; }; t: { c: string; }; }'.
49 const ratio = toCoverageRatio(fileData)
~~~~~~~~
src/uri.test.ts:11:50 - error TS2554: Expected 1 arguments, but got 2.
11 assert.throws(() => resolveURI(null, 'file:///d/f')))
~~~~~~~~~~~~~
src/uri.test.ts:15:34 - error TS2554: Expected 1 arguments, but got 2.
15 resolveURI(null, 'git://example.com/repo?v#d/f'),
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/uri.test.ts:27:53 - error TS2554: Expected 1 arguments, but got 2.
27 resolveURI({ repo: 'r', rev: 'v' }, 'file:///d/f'),
~~~~~~~~~~~~~
src/uri.test.ts:39:21 - error TS2554: Expected 1 arguments, but got 2.
39 'git://example.com/repo?v#d/f'
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/uri.test.ts:52:21 - error TS2554: Expected 1 arguments, but got 2.
52 'git://example.com/repo2?v2#d/f'
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/uri.test.ts:63:46 - error TS2554: Expected 1 arguments, but got 2.
63 assert.throws(() => resolveURI(null, 'example://a')))
~~~~~~~~~~~~~
src/uri.ts:41:15 - error TS2322: Type 'readonly Endpoint[] | undefined' is not assignable to type 'Endpoint[] | undefined'.
The type 'readonly Endpoint[]' is 'readonly' and cannot be assigned to the mutable type 'Endpoint[]'.
41 const endpoints: Endpoint[] | undefined = sourcegraph.configuration.get<Settings>().get('codecov.endpoints')
~~~~~~~~~
Found 11 errors.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
When you enter an invalid API token, the decorations should get cleared.
Related to #10,
But would be really awesome to have the overlay on the diff overview for PRs.
ie on this page https://github.com/<org>/<repo>/pull/<#pr>/files
The old codecov extension offered this and it was amazing. After submitting a PR, one could see which lines of the code they'd touched were covered.
It was especially nice how it'd continue to use a darker green/red highlighting in the line number gutter to indicate which lines were added/removed, whilst the lighter green/red highlighting across the actual code indicated what lines were covered by tests.
All the best. :)
I traced through some code and added some logs and it looks like this extension is emitting decorations 3 times for every click. First null
, then the decorations, then null
again which clears the decorations. See screenshot below.
I would bet that this commit introduced this bug.
https://docs.sourcegraph.com/extensions/deprecation leads to
Page not found
The page extensions/deprecation was not found.
Does it mean that there is in general no browser extension for highlighting PRs or there is some other way?
Not sure if this is a limitation of the Codecov extension or the Sourcegraph extension API, but as a user, I expect all non-test files to have coverage decorations once the file is loaded.
I get this when I'm going to https://sourcegraph.com/github.com/gorilla/mux/-/blob/mux.go
Looks like it doesn't handle the case that the repo has no report?
Testing Item: https://sourcegraph-team.monday.com/boards/322741303/pulses/322741437
Local Sourcegraph started through: IMAGE=sourcegraph/server:3.8.0-rc.2 ./dev/run-server-image.sh
While testing for release 3.8, even with setting "codecov.hideCoverageButton": false,
explicitly defined, I could not see the "Coverage: X%" button on Sourcegraph (local) or GitHub (with extension), but coverage line highlights are visible.
On Sourcegraph, after loading a code page with the coverage line highlights, when I navigate to another page then return to the code, by hitting the browser back button, the button appears. So it seems to only render when the page is re-rendered after navigating away and back (maybe component update issue?). After refreshing the page the highlights appear but the button doesn't.
Steps to reproduce:
Further clicking of the Coverage button fails to show the tested lines again.
Hi,
I recently decided to setup code-cov on a private repository.
While it seems to work perfectly with Chrome; i tried to setup the extension on Firefox,
but i can't make it work : The highlight does not work, and the coverage
button does not appear on github.
Yet, i followed the same step than i did to install the chrome extension.
Here are the Chrome logs (For which it works):
Sourcegraph browser extension is running
Detected code host: github
Browser extension is enabled
Code view added
Activating Sourcegraph extension: sourcegraph/codecov
Activating Sourcegraph extension: sourcegraph/git-extras
Activating Sourcegraph extension: sourcegraph/python
Here are the Firefox logs (For which it does not work):
Sourcegraph browser extension is running
Detected code host: github
Browser extension is enabled
Code view added
Sourcegraph browser extension is running
Sourcegraph native integration is already running
Activating Sourcegraph extension: sourcegraph/template
I don't seems to be the only one to meet this problem in my team.
Do you see any reason why it would fail to work ? Is there some additional step to be done concerning firefox ?
Note : the Firefox version i'm using (on mac) is Version 82.0.3
Thanks,
There should be no functions in a subscribe
function that can throw an exception, especially not async
functions, because the error cannot be handled. Instead, this logic should likely happen in a switchMap
.
I can see the Codecov button and test coverage decorations on Sourcegraph but not GitHub for file https://github.com/theupdateframework/notary/blob/fb795b0bc868746ed2efa2cd7109346bc7ddf0a4/server/storage/tuf_store.go
After following the instructions in the readme for private repos, my console has an Uncaught RepoNotFoundError error when viewing my private repo.
After contacting codecov support, they told me to do the following:
The network tab did not have any activity.
Is there anything else that needs to be done that's not in the readme? For what its worth, I do see a "Configure sourcegraph" button.
The extension does not show commit coverage data anymore.
Commit coverage requests fail with a 401 error:
{"meta": {"status": 401}, "error": {"reason": "Credentials are invalid. Please login again.", "context": null}}
Removing the access_token
from the query string helps resolve the request successfully (as it’s the public repo).
The URL we use is different from v1 get single commit URL (commits vs commit). Moreover, the docs page we reference in the code no longer exists. But, the request is still resolved without the access token in it.
Codecov is migrating its API to v2, though they claim that v1 is still maintained (at least for six months). I checked the v2 way to authorize and could successfully get the commit coverage data using this endpoint.
It's likely that to make the extension work again, we need to migrate API to v2.
Hey all 👋
Just wanted to flag an issue that has been observed with highlighting when navigating hyper-links on github.com
When navigating through hyperlinks or loading a file page on GitHub.com, during the initial loading of a page no syntax highlighting is observed.
Additionally, there are errors in the console for Uncaught Error: Could not find repository content element
Reloading the page returns syntax highlighting
When the highlighting isn't loadin a CSS class .repository-content
seems not to be loading in the <turbo-frame>
HTML element
On a page refresh the class seems to load correctly
It may be the case that Github has started using some new pjax library stuff, and that sourcegraph browser extension doesn't currently have handlers for this?
https://github.com/defunkt/jquery-pjax
Currently, the high contrast of the chosen coverage highlight colors can be painful on the eyes, especially if you're using some method of forcing pages into a dark mode. Additionally, the lines can be difficult to tell apart with various types of colorblindness.
The "simplest" method of resolution would be to allow configuration of line highlight colors, such that end-users can set a trio of colors that are more pleasant in contrast of their browsing environment.
I used this neat integration. It recently stopped working. I found sourcegraph/sourcegraph#43802 which confirms that apparently this integration is "no more". Leaving this note so might help to others interested to find why it no longer works.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.