Giter Club home page Giter Club logo

sourcegraph-codecov's Issues

Discuss: Behavior for files with no test coverage data

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:
image

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.)

Showing coverage for commits

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.

Set API token for private repositories reports error when viewing a file page

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.

Screen Shot 2020-01-13 at 4 43 55 PM

Happy to provide more details if needed. It's possible this is related to #11, but the symptoms seem sufficiently different.

Doesn't work on Firefox

There is no coverage button/codecov option on Firefox. Seems that codecov extension doesn't load at all. Everything works fine on Chrome.

Firefox Nightly 95.0a1 (2021-10-14) / Sourcegraph v21.9.10.1803
image

Chrome 94.0.4606.81 / Sourcegraph v21.9.10.1802
image

Type errors on master

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.

@3askaal these seem to have been introduced in #19

Coverage overlay for PRs

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. :)

"Coverage: X%" button doesn't appear by default

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.

Screenshot from 2019-09-18 12-39-17

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.

Screenshot from 2019-09-18 12-50-02

Issue with Firefox on private repository

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,

Plugin does not work for private repository

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:

  • navigate to chrome://extensions
  • enable developer mode (top-right corner)
  • Inspect the background page of the sourcegraph extension
  • reload the code page on GitHub page in a browser tab
  • check the chrome dev tools for the extension’s background page
  • In the “Network” tab, the ResolveRev, ResolveRepo steps should return 200

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.

Error message when selecting action

Using Sourcegraph.com, when I select the below.

screen shot 2018-09-17 at 1 57 21 pm

Produced the error message.

Request commands/$executeCommand failed with message: Cannot read property 'showInputBox' of undefined.

Can't add token for private repos

The only option available in the sourcegraph menu is to go to the codecov documentation. How can I set the token for private repos?

image

Authorization no longer works with Codecov API v2. Migrate to API v2.

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.

code cov highlighting requires refresh on github.com

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.
Screen Shot 2022-07-13 at 4 25 38 PM

Additionally, there are errors in the console for Uncaught Error: Could not find repository content element

Reloading the page returns syntax highlighting
Screen Shot 2022-07-13 at 4 25 51 PM

When the highlighting isn't loadin a CSS class .repository-content seems not to be loading in the <turbo-frame> HTML element
Screen Shot 2022-07-14 at 12 34 23 PM

On a page refresh the class seems to load correctly
Screen Shot 2022-07-14 at 12 35 32 PM

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

request: allow customization of line coverage colors ( accessibility )

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.

Doesn't work entirely

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.