Giter Site home page Giter Site logo

gojp / goreportcard Goto Github PK

View Code? Open in Web Editor NEW
2.0K 2.0K 251.0 11.98 MB

A report card for your Go application

Home Page: https://goreportcard.com

License: Apache License 2.0

Go 67.25% HTML 31.10% Makefile 0.75% Shell 0.56% Dockerfile 0.33%
go golang golang-tools goreportcard report-card

goreportcard's People

Contributors

abduelhamit avatar amatsagu avatar arp242 avatar bradleyfalzon avatar bufdev avatar caarlos0 avatar chadgrant avatar ckeyer avatar dependabot[bot] avatar dvrkps avatar georgeok avatar hansrodtang avatar hermanschaaf avatar jackspirou avatar jmikkola avatar jung-kurt avatar mattfarina avatar metalmatze avatar micnncim avatar neurosnap avatar nicksnyder avatar niconex avatar nstratos avatar shawnps avatar shawnps-sigsci avatar tariq1890 avatar tomohiro avatar vieux avatar winhowes avatar yanghua-ola 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  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  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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

goreportcard's Issues

suggest repositories if none specific given

Please forgive me if it behaves differently on a desktop, I've only tried mobile.

I tried out goreportcard and naturally used my own account first. I couldn't remember the name of any of my go repos and entering just the username presents an error flash.

If I enter just the username it would be neat to be displayed a list of available repositories to run the report on.

Optionally then repositories with go code (via the languages api call) could be promoted or the set could be filtered to avoid showing ineligible repos.

Thanks

add tests

integration test should be pretty quick to put together

Check: errcheck

Original report by @shawnps:

errcheck checks whether a package is checking errors returned by functions. For example, it detects both of these:

recover()

and

_ := recover()

but unfortunately:

shawnps [9:59 PM]
but it runs at the package level 😞

shawnps [9:59 PM]
and the package needs to be in your gopath too so we'd have to like clone the repo into repos/src/github.com/org/reponame and then run it on there

We could still use it but we'd have to hack the repos dir a bit and set GOPATH to it. Then we'd have to clone the GitHub repo into repos/src/github.com/orgname/reponame and run errcheck on there.

More informative error messages

Oops! There was an error processing your request and 500 Internal Server Error are not really informative. Here is an example for illustration. I have no clue what's wrong with it and I'm not able to reproduce the error locally (the same repo but uppercased works as expected).

Repository error when processing request

github.com/peter-edge/flights-go

I cloned goreportcard locally and ran it, it works fine and shows 0 issues across 3 files.

Can we debug? Maybe also add a way to see what the error is when running?

Pulling repo exits status 1 sometimes

On goreportcard.com (not seeing on local) if I click Update Now I get an error, and in the log it says git pull exited status 1. Clicking it twice works

Include minimum score of dependencies.

The quality of dependencies an important point about the quality of the project.

By including the scores of dependencies it makes it visible. It would also encourage collaboration, e.g. i write a package and get a score C because of a dependencies then I'm more motivated to improve that dependency.

There's the question how to aggregate those dependencies. Minimum seems the most appropriate, chain is as weak as its weakest link.

make last refresh date more obvious when it's old

some users may not realize that clicking Test Now pulls data from a cache unless they explicitly click Update now. maybe the last refresh text could be colored red if it's quite old or something

don't break when mongo is unreachable

this is probably discouraging to anyone trying to develop locally, if you aren't running mongo and you try to get a report, the gopher spins for a minute or two then you get the following error:

Failed to get mongo collection during GET: no reachable servers

misspell update / re-org

Thanks to goreportcard a bunch of false positives have been fixed.

More importantly

  • Long blocks of text with no whitespace are ignored. This eliminates false positives in urls and big chunks of base64 text that sometimes are in source files.
  • For Golang files only comments are checked for spelling (for now). You can change this behavior to check everything with -source=text. I may expand this to include raw strings but only if it behaves nicely.
  • Big API update... to make sure you install with
go get -u github.com/client9/misspell/cmd/misspell

(maybe do this first to make double sure)

rm `which misspell`

onward!

A vector for Denial of Service Attack

Goreportcard does not check a presence of ../ in repo url and thus it is possible to start a check for all available repo directories by using it as url parameter. And multiple ../../ let us make the system scan everything beginning from the root (/).
All this create a vector for Denial of Service attack.

For illustration, goreportcard stores go getted repos inside repos/src. And when a scan of path/to/example is requested, the project from repos/src/path/to/example is checked. However, if we request the scan of ../ it will try to check repos/src/../ (i.e. repos/). In case of ../../ it will be just ./ and so forth.
As the process of rescanning (to check gofmt-ness, golint-ness, etc.) of all available projects isn't fast, it is potentially dangerous because an attacker may exploit this to DoS the service.

screenshot from 2015-12-28 03 55 08

Reclone project if "git pull" fails

Currently, goreportcard clones a repo just once. Every subsequent attempt to update info about a project triggers git pull. Is my understanding correct?

    if os.IsNotExist(err) {
        cmd := exec.Command("git", "clone", "--depth", "1", "--single-branch", url, dir)
        if err := cmd.Run(); err != nil {
            return fmt.Errorf("could not run git clone: %v", err)
        }
    } else if err != nil {
        return fmt.Errorf("could not stat dir: %v", err)
    } else {
        cmd := exec.Command("git", "-C", dir, "pull")
        if err := cmd.Run(); err != nil {
            return fmt.Errorf("could not pull repo: %v", err)
        }
    }

if os.IsNotExist(err) {
cmd := exec.Command("git", "clone", "--depth", "1", "--single-branch", url, dir)
if err := cmd.Run(); err != nil {
return fmt.Errorf("could not run git clone: %v", err)
}
} else if err != nil {
return fmt.Errorf("could not stat dir: %v", err)
} else {
cmd := exec.Command("git", "-C", dir, "pull")
if err := cmd.Run(); err != nil {
return fmt.Errorf("could not pull repo: %v", err)
}
}

If so, there is a flaw in this approach:

  1. git pull will always fail if I rewrite my git history;
  2. if I change my GH username (what I've recently done), a person who decides to use my old one will not be able to test his/her projects that have the same names as my projects had.

I think, if git pull fails it should remove the old directory and clone the project again instead of just returning an error.

Github readme badges

...a request we have received many times, and something I personally want too 😺

fyi: https://github.com/karolgorecki/goprove

this maybe be of interest to you

https://github.com/karolgorecki/goprove

$ goprove .
Passed tests: 7 of 11
---------------------------------------------------------------
[βœ”] README Presence: Does the project's include a documentation entrypoint?
[βœ”] Licensed: Does the project have a license?
[βœ”] gofmt Correctness: Is the code formatted correctly?
[βœ”] golint Correctness: Is the linter satisfied?
[βœ”] go tool vet Correctness: Is the Go vet satisfied?
[βœ”] Compiles: Does the project build?
[βœ”] Are the tests passing?
---------------------------------------------------------------
[βœ—] Contribution Process: Does the project document a contribution process?
[βœ—] Blackbox Tests: In addition to standard tests, does the project have blackbox tests?
[βœ—] Benchmarks: In addition to tests, does the project have benchmarks?
[βœ—] Directory Names and Packages Match: Does each package <pkg> statement's package name match the containing directory name?

make the high scores page more configurable

Right now a repo will only appear on /high_scores if it has > 100 files. That was just a number that I chose arbitrarily. There are probably plenty of great repos that have 1-99 files :) Could probably pass the min number in a query parameter or something.

Oops! There was an error processing your request: {}

Not sure if this is the best place to report this, but I don't know of anywhere else :)

When trying to update the score for my repo bwmarrin/discordgo I am getting the below error

Oops! There was an error processing your request: {}

But this seems to work fine for other repo's I have so I'm unsure if somehow there's something I've done in my discordgo repo that's causing a problem :( I would like to get it updated as I've fixed a bunch of things and like anybody else I want a good score :)

Allow for periods in URL routes.

Github allows for usernames, org names, and repo names to include periods, but currently goreportcard.com does not. If a period is present in the URL route goreportcard throws a 404.

I suggest allowing for periods by updating the makeHandler method in the main.go file to include them:
^/%s/([a-zA-Z0-9\-_]+)/([a-zA-Z0-9\-_]+)$ -> ^/%s/([a-zA-Z0-9\-_]+)/([a-zA-Z0-9\-_.]+)$

This way goreportcard will be compatible with the same characters github allows for users/orgs repos.

*** updated ***

Handle non-Go repos more gracefully

Right now we just return internal server error, but we can actually tell when a repo has no go files in it so we should return a more specific error

FYI: goreportcard library style

Hi,

Not an issue, just a heads up.
I needed to score projects programmatically so I extracted the relevant parts and made a package out of it.
It might be just me needing this but IMHO it'd be nice if the official project split the "web part" and the "scoring part", to separate concerns and avoid such forks.

Cheers!

Add notice if github-hosted project is missing a description

Doing some experiments I found that some repos don't have a description set in github. It would be nice if go-reportcard mentioned this. It might help to get people to add a description.

2015/10/18 17:17:56 cloudflare/gokeyless: Go implementation of the keyless protocol
2015/10/18 17:17:56 cloudflare/service:  <--- ???
2015/10/18 17:17:56 cloudflare/dns: Clone of https://github.com/miekg/dns

2015/10/18 17:17:57 coreos/coreos-metadata: A simple cloud-provider metadata agent
2015/10/18 17:17:57 coreos/fuze: Convert YAML to JSON
2015/10/18 17:17:57 coreos/mayday: <--- ???
2015/10/18 17:17:57 coreos/sqlbuilder: a SQL query composition library for Go
2015/10/18 17:17:57 coreos/discovery.etcd.io: <--- ???
2015/10/18 17:17:57 coreos/update-ssh-keys: <--- ???
2015/10/18 17:17:57 coreos/etcd-ca: <--- ???

2015/10/18 17:17:58 docker/notary: <--- ???
2015/10/18 17:17:58 docker/libcompose: <--- ???
2015/10/18 17:17:58 docker/machine: Machine management for a container-centric world

Writing to mongo happens twice when clicking update now

Seeing this in the server log when clicking Update Now:

2015/02/08 08:46:08 Writing to mongo...
2015/02/08 08:46:08 Writing to mongo...
2015/02/08 08:46:10 Writing to mongo...
2015/02/08 08:46:10 Writing to mongo...
2015/02/08 08:46:14 Writing to mongo...
2015/02/08 08:46:14 Writing to mongo...
2015/02/08 08:46:17 Writing to mongo...
2015/02/08 08:46:17 Writing to mongo...
2015/02/08 08:46:19 Writing to mongo...
2015/02/08 08:46:19 Writing to mongo...

Doesn't happen locally I think

make mongo stuff configurable

the mongo info is just global vars in the handlers package right now, would be nice to make those flags with defaults in main.go and pass them to a struct or something.

Check: go test -cover

Original comment by @shawnps:

Check the coverage percent of the package. We might not do this if we can't properly sandbox stuff.

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.