Giter Site home page Giter Site logo

aklinker1 / github-better-line-counts Goto Github PK

View Code? Open in Web Editor NEW
27.0 27.0 3.0 982 KB

Chrome extension that removes generated files from GitHub line counts

Home Page: https://chrome.google.com/webstore/detail/ocfdgncpifmegplaglcnglhioflaimkd

License: MIT License

TypeScript 81.50% Shell 4.21% JavaScript 0.53% CSS 0.52% Vue 12.36% HTML 0.88%
chrome-extension github

github-better-line-counts's People

Contributors

aklinker1 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

github-better-line-counts's Issues

Recalculate Diff Squares

Right now, the extension doesn't change the red/green/grey squares that visualize how much of the file was new code vs removed code.

I don't know how these are calculated... the grey blocks confuse me lol. Otherwise it'd be a simple ratio.

Better "processing" UI

Right now I just set the display: none on the line counts while the extension recalculates the totals.

// Render loading UI while calculating stats
let additionsElement = getAdditionsElement();
let deletionsElement = getDeletionsElement();
if (additionsElement) additionsElement.style.display = "none";
if (deletionsElement) deletionsElement.style.display = "none";

I want to leave them visible and put a loading indicator to the right of the numbers, between the line counts and the red/green squares (where the generated count now shows up)

Hover over changes to view original diff

Sometimes, when upgrading dependencies, it's nice to know the original count to see how many dependencies were added/removed.

So when hovering over the generated number, it should show the generated + and - for a quick reference.

Doesn't work with `yarn` out of the box

image

The thing is, when you create a new yarn project using yarn init, it will create a .gitattributes like the following:

/.yarn/**            linguist-vendored
/.yarn/releases/*    binary
/.yarn/plugins/**/*  binary
/.pnp.*              binary linguist-generated

yarn.lock is not added to linguist-generated because git by itself doesn't count .lock files

so this extension should probably look for any .lock files by itself

Couldn't count generated lines for private repo

I know there's mention of this:

Optional: To load the .gitattributes for private repos, you need to enter a GitHub personal access token.

But the thing is... I don't need nor use .gitattributes. For me the basic functionality is just enough.

Currently it just hangs into this state infinitely:

gif2

IMO for simple cases without .gitattributes, โ€“ extension has all the info just on the page: token shouldn't be needed.

I just tried to add github token though, and it suddenly worked. But it shouldn't require it.

I think it is a minor issue yet important enough to mention.

Failed to calculate diff: FetchError -- returns 404

This is for a private organization repository that uses SSO, so I'm not sure if this is an expected behaviour or not. I made sure to authorize the personal access token for the organization, but still no luck.

When I run this on the command line ( with the token, owner, repo, & pull number filled in properly ) it does return a JSON response though:

curl -L \
  -H "Accept: application/vnd.github+json" \
  -H "Authorization: Bearer <YOUR-TOKEN>" \
  -H "X-GitHub-Api-Version: 2022-11-28" \
  https://api.github.com/repos/OWNER/REPO/pulls/PULL_NUMBER

Correct diff calculations when ignoring whitespace

Currently, the extension ignores whether or not you've disabled whitespace diffs on the PR (?w=1 query param). It shows the counts you would regularly see without that query parameter.

There doesn't appear to be an API that supports this parameter, it will be have to be calculated manually? I don't know how to do that.

An alternative is to read the diff numbers from the page instead of using the GitHub API. But I can't figure out how to load those all for large PRs, using the API is simpler.

Show generated file count

Right now it's not super clear when the extension has finished recalculating the line counts, but adding the number of generated files would help with that.

See the screenshot for what I want it to look like: screenshot

Add Save Button/Saving Label to Options Page

Settings save automatically when changed, but that's not obvious at all. We need to add either a save button that saves the settings, or a label that says "saving..." and "Saved!" when updating the settings.

Custom file lists

In the extension options, add:

  • A list of files that are always ignored for all repos #14
  • And a way to add a list of files for individual repos

The lists will just be strings that work with fast-blob, the library I use to test if a file is in the gitattributes.

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.