Coder Social home page Coder Social logo

hubstats's Introduction

In my free time, I occasionaly blog here. โœ๏ธ

I also like collaborating on TLDR, Collaborative cheatsheets for console commands. ๐Ÿ“–

My kanban for personal projects and learning experimentations. ๐Ÿ‘โ€๐Ÿ—จ

personal "tool" projects ๐Ÿ› ๏ธ

personal "toy" projects ๐Ÿงช

  • hubstats, pullpito, pullpitoK and pullpigo: CLI tools to experiment with Clojure, Rust, Kotlin and Go programming languages. ๐Ÿง‘โ€๐Ÿ’ป
  • dom-manipulator: experimentations with JavaScript/TypeScript, HTML and CSS. ๐Ÿง‘โ€๐ŸŽจ

hubstats's People

Contributors

nicokosi avatar renovate-bot avatar renovate[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

hubstats's Issues

Introduce "since" option

Command line actually return summary since last week. A "since" argument should be available.

Fix GitHub deprecation notice for authentication via URL query parameters

Just received this email from GitHub:

Hi @nicokosi,

On August 22nd, 2020 at 10:30 (UTC) your personal access token (Compute statistics via https://github.com/nicokosi/hubstats) using Apache-HttpClient/4.5.10 (Java/14.0.2) was used as part of a query parameter to access an endpoint through the GitHub API:

https://api.github.com/repositories/25971796/events

Please use the Authorization HTTP header instead, as using the access_token query parameter is deprecated. If this token is being used by an app you don't have control over, be aware that it may stop working as a result of this deprecation.

Depending on your API usage, we'll be sending you this email reminder on a monthly basis for each token and User-Agent used in API calls made on your behalf.
Just one URL that was accessed with a token and User-Agent combination will be listed in the email reminder, not all.

Visit https://developer.github.com/changes/2020-02-10-deprecating-auth-through-query-param for more information about suggested workarounds and removal dates.

Thanks,
The GitHub Team

Investigate on latency

Investigate if latency can be enhanced.

For instance, the following command took 6 seconds on my machine:

$ time hubstats -o vidal-community -r atom-jaxb
pull requests for vidal-community/atom-jaxb ->
	since 2019-12-26T18:04:13Z
		0 opened / 0 closed / 0 commented (0 comments)
 		opened per author:  {}
 		comments per author:  {}
 		closed per author:  {}
hubstats -o vidal-community -r atom-jaxb  4.90s user 0.32s system 86% cpu 6.052 total

Using pullpitoK, the equivalent command takes 1 second on my machine:

$ time pullpitoK vidal-community/atom-jaxb
pull requests for "vidal-community/atom-jaxb" ->
            opened per author
		amairi: 1
            commented per author
		AElMehdiVidal: 1
		jcgay: 1
            closed per author

Note that the output is different because hubstats retrieves changes for last 7 days (--since-weeks has a default value of 1). ๐Ÿ˜‡

Use named options

Command line options should be named instead being sequential. Examples:

hubstats --repository foo --organization bar --token baz
hubstats -r foo -o bar -t baz

Cannot generate native image on Ubuntu 20: "error linking the native image"

On my Ubuntu machine:

./generate-executable.sh

โœ‚๏ธ

Fatal error:java.lang.RuntimeException: java.lang.RuntimeException: There was an error linking the native image: Linker command exited with 1

Based on the linker command output, possible reasons for this include:
1. It appears as though libz.a is missing. Please install it.

โœ‚๏ธ

/home/nkosinski/.sdkman/candidates/java/21.0.0.r11-grl/lib/svm/clibraries/linux-amd64/libjvm.a -lstdc++ -ldl -lpthread -lz -lrt -lgcc --push-state --as-needed -lgcc_s --pop-state -lc -lgcc --push-state --as-needed -lgcc_s --pop-state /usr/lib/gcc/x86_64-linux-gnu/9/crtendS.o /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/crtn.o
/home/linuxbrew/.linuxbrew/bin/ld: cannot find -lz
collect2: error: ld returned 1 exit status
	at com.oracle.svm.hosted.image.NativeBootImageViaCC.handleLinkerFailure(NativeBootImageViaCC.java:474)
	at com.oracle.svm.hosted.image.NativeBootImageViaCC.write(NativeBootImageViaCC.java:441)
	at com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:685)
	at com.oracle.svm.hosted.NativeImageGenerator.lambda$run$0(NativeImageGenerator.java:476)
	at java.base/java.util.concurrent.ForkJoinTask$AdaptedRunnableAction.exec(ForkJoinTask.java:1407)
	at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
	at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)
	at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)
	at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)
	at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)
Error: Image build request failed with exit status 1

Full log

git show
commit ab719ae7a8915512d3a8a8e1c47ab00e0e6679cb (HEAD -> master, origin/master, origin/HEAD)
Author: Renovate Bot <[email protected]>
Date:   Thu Mar 18 06:22:27 2021 +0000

    Update dependency org.clojure:clojure to v1.10.3
cat /etc/issue
Ubuntu 20.04.2 LTS \n \l

Fix GitHub API deprecation notice for authentication via URL query parameters

Prevent this kind of email notification by GitHub:

On February 27th, 2021 at 15:37 (UTC) your personal access token (Compute statistics via https://github.com/nicokosi/hubstats) using Java/11.0.5 was used as part of a query parameter to access an endpoint through the GitHub API:

https://api.github.com/repositories/7420643/events

Please use the Authorization HTTP header instead, as using the `access_token` query parameter is deprecated. If this token is being used by an app you don't have control over, be aware that it may stop working as a result of this deprecation.

Depending on your API usage, we'll be sending you this email reminder on a monthly basis for each token and User-Agent used in API calls made on your behalf.
Just one URL that was accessed with a token and User-Agent combination will be listed in the email reminder, not all.

Visit https://developer.github.com/changes/2020-02-10-deprecating-auth-through-query-param for more information about suggested workarounds and removal dates.

Thanks,
The GitHub Team

Incorrect counters if many pull requests

For example :

lein run --organization docker --repository docker --token $token --since-weeks 4                                         
pull requests for docker/docker ->
	since 4 week(s):
		18 opened / 43 commented / 16 closed
		opened per author: {"samattridge" 2, "aaronlehmann" 2, "yongtang" 1, "wojas" 1, "vieux" 1, "vdemeester" 1, "twang2218" 1, "pmelopereira" 1, "panmanphil" 1, "nishanttotla" 1, "krasi-georgiev" 1, "kklemmicknvidia" 1, "jhowardmsft" 1, "eZanmoto" 1, "alexandrevicenzi" 1, "albers" 1}
		commented per author: {"aaronlehmann" 9, "thaJeztah" 6, "johnstep" 5, "cpuguy83" 5, "stevvooe" 3, "dnephin" 3, "vdemeester" 2, "tianon" 2, "runcom" 2, "vikstrous" 1, "tophj-ibm" 1, "tonistiigi" 1, "ehazlett" 1, "cyli" 1, "allencloud" 1}
		closed per author: {"thaJeztah" 2, "cpuguy83" 1, "allencloud" 1}

But more pull requests have been created/closed (and probably commented), as seen via Monthly Pulse:

http https://github.com/docker/docker/pulse/monthly | grep -B 2 "Merged Pull Requests\|Proposed Pull Requests"
            274
          </span>
          Merged Pull Requests
--
            91
          </span>
          Proposed Pull Requests

Use 'Authorization' HTTP header instead of 'access_token' query parameter which is deprecated by GitHub

Source: https://developer.github.com/changes/2020-02-10-deprecating-auth-through-query-param/

GitHub's email received recently:

Hi @nicokosi,
On April 4th, 2020 at 17:21 (UTC) your personal access token (Compute statistics via https://github.com/nicokosi/hubstats) using Java/11.0.5 was used as part of a query parameter to access an endpoint through the GitHub API:
https://api.github.com/repositories/25971796/events
Please use the Authorization HTTP header instead, as using the access_token query parameter is deprecated. If this token is being used by an app you don't have control over, be aware that it may stop working as a result of this deprecation.
Depending on your API usage, we'll be sending you this email reminder on a monthly basis for each token and User-Agent used in API calls made on your behalf.
Just one URL that was accessed with a token and User-Agent combination will be listed in the email reminder, not all.
Visit https://developer.github.com/changes/2020-02-10-deprecating-auth-through-query-param for more information about suggested workarounds and removal dates.
Thanks,
The GitHub Team

Fails for a public repository: HTTP 401

$ lein run --organization python --repository peps
Exception in thread "async-dispatch-1" clojure.lang.ExceptionInfo: status: 401 {:request-time 586, :request {:user-info nil, :headers {"Authorization" "token ", "Accept" "application/vnd.github.v3+json", "accept-encoding" "gzip, deflate"}, :server-port nil, :url "https://api.github.com/repos/python/peps/events?page=1", :http-request #object[jdk.internal.net.http.HttpRequestImpl 0x78f8a81a "https://api.github.com/repos/python/peps/events?page=1 GET"], :uri "/repos/python/peps/events", :server-name "api.github.com", :query-string "page=1", :scheme :https, :request-method :get}, :http-client #object[jdk.internal.net.http.HttpClientFacade 0x29391ed6 "jdk.internal.net.http.HttpClientImpl@c6d739f(1)"], :headers {"access-control-expose-headers" "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, Deprecation, Sunset", "referrer-policy" "origin-when-cross-origin, strict-origin-when-cross-origin", "server" "GitHub.com", "content-type" "application/json; charset=utf-8", "access-control-allow-origin" "*", "x-content-type-options" "nosniff", "content-length" "80", "x-frame-options" "deny", "strict-transport-security" "max-age=31536000; includeSubdomains; preload", "x-ratelimit-limit" "60", "x-ratelimit-remaining" "59", "x-ratelimit-reset" "1615663377", "x-github-request-id" "7039:3FA3:DA0959:E32B85:604D0301", "x-ratelimit-used" "1", "x-github-media-type" "github.v3; format=json", ":status" "401", "date" "Sat, 13 Mar 2021 18:22:57 GMT", "vary" "Accept-Encoding, Accept, X-Requested-With", "x-xss-protection" "1; mode=block", "content-security-policy" "default-src 'none'"}, :status 401, :content-type :application/json, :uri "https://api.github.com/repos/python/peps/events?page=1", :content-type-params {:charset "utf-8"}, :version :http-2, :body "{\"message\":\"Bad credentials\",\"documentation_url\":\"https://docs.github.com/rest\"}"}
	at hato.middleware$exceptions_response.invokeStatic(middleware.clj:149)
	at hato.middleware$exceptions_response.invoke(middleware.clj:140)
	at hato.middleware$wrap_exceptions$fn__1246.invoke(middleware.clj:158)
	at hato.middleware$wrap_accept$fn__1332.invoke(middleware.clj:315)
	at hato.middleware$wrap_accept_encoding$fn__1339.invoke(middleware.clj:337)
	at hato.middleware$wrap_multipart$fn__1499.invoke(middleware.clj:705)
	at hato.middleware$wrap_content_type$fn__1326.invoke(middleware.clj:298)
	at hato.middleware$wrap_form_params$fn__1427.invoke(middleware.clj:536)
	at hato.middleware$wrap_nested_params$fn__1493.invoke(middleware.clj:685)
	at hato.middleware$wrap_method$fn__1395.invoke(middleware.clj:470)
	at hato.client$request.invokeStatic(client.clj:314)
	at hato.client$request.doInvoke(client.clj:308)
	at clojure.lang.RestFn.invoke(RestFn.java:439)
	at hato.client$configure_and_execute.invokeStatic(client.clj:319)
	at hato.client$configure_and_execute.doInvoke(client.clj:316)
	at clojure.lang.RestFn.invoke(RestFn.java:442)
	at clojure.core$partial$fn__5858.invoke(core.clj:2629)
	at hubstats.github$github_api_events.invokeStatic(github.clj:15)
	at hubstats.github$github_api_events.invoke(github.clj:12)
	at hubstats.github$events.invokeStatic(github.clj:22)
	at hubstats.github$events.invoke(github.clj:18)
	at hubstats.github$events.invokeStatic(github.clj:25)
	at hubstats.github$events.invoke(github.clj:18)
	at hubstats.github$events.invokeStatic(github.clj:30)
	at hubstats.github$events.invoke(github.clj:18)
	at hubstats.github$pr_stats.invokeStatic(github.clj:73)
	at hubstats.github$pr_stats.invoke(github.clj:64)
	at hubstats.core$_main$fn__9880$state_machine__7222__auto____9897$fn__9899.invoke(core.clj:60)
	at hubstats.core$_main$fn__9880$state_machine__7222__auto____9897.invoke(core.clj:59)
	at clojure.core.async.impl.ioc_macros$run_state_machine.invokeStatic(ioc_macros.clj:978)
	at clojure.core.async.impl.ioc_macros$run_state_machine.invoke(ioc_macros.clj:977)
	at clojure.core.async.impl.ioc_macros$run_state_machine_wrapped.invokeStatic(ioc_macros.clj:982)
	at clojure.core.async.impl.ioc_macros$run_state_machine_wrapped.invoke(ioc_macros.clj:980)
	at hubstats.core$_main$fn__9880.invoke(core.clj:59)
	at clojure.lang.AFn.run(AFn.java:22)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at clojure.core.async.impl.concurrent$counted_thread_factory$reify__1962$fn__1963.invoke(concurrent.clj:29)
	at clojure.lang.AFn.run(AFn.java:22)
	at java.base/java.lang.Thread.run(Thread.java:834)

It does not fail when setting a token (even if it is not needed):

$ lein run --organization python --repository peps --token $GITHUB_TOKEN
pull requests for python/peps ->
	since 2021-03-06T18:23:45Z
		8 opened / 10 closed / 2 commented (11 comments)
 		opened per author:  {markshannon 2, isidentical 2, iritkatriel 2, vstinner 1, mrahtz 1}
 		comments per author:  {gvanrossum 6, iritkatriel 4, CAM-Gerlach 1}
 		closed per author:  {markshannon 3, gvanrossum 3, isidentical 2, dstufft 1, brettcannon 1}

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

github-actions
.github/workflows/ci.yml
  • actions/checkout v4
  • actions/setup-java v4
  • DeLaGuardo/setup-clojure 12.1
leiningen
project.clj
  • org.clojure:clojure 1.11.1
  • org.clojure:data.json 2.5.0
  • hato:hato 0.9.0
  • slingshot:slingshot 0.12.2
  • clj-time:clj-time 0.15.2
  • org.clojure:core.async 1.6.681
  • lein-ancient:lein-ancient 0.7.0
  • lein-cljfmt:lein-cljfmt 0.9.2

  • Check this box to trigger a request for Renovate to run again on this repository

Update token instructions

I'm not quite sure yet, but I personally use 2-factor authentication and I had to generate an access token for https://github.com/fbiville/liquigraph, a public repository.

Can you try on Liquigraph as well @nicokosi in order to see if the same thing happens?

In any case, the instructions will need to be updated, either to say: "if the project owner is an individual and uses 2-factor auth..." or "if you are using 2-factor auth..." .

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.