GithubHelp home page GithubHelp logo

groovecoder / discord Goto Github PK

View Code? Open in Web Editor NEW
29.0 29.0 13.0 172 KB

GitHub webhook that analyzes pull requests and adds comments about incompatible CSS

License: Mozilla Public License 2.0

JavaScript 95.78% HTML 4.22%
analyzer unmaintained webhook

discord's People

Contributors

darkwing avatar faeranne avatar federicoculloca avatar groovecoder avatar openjck 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

discord's Issues

appease gulp test

Right now gulp complains about a couple of style issues with the code (an if without braces and a missing semicolon).

Since I need to get familiar with the code base (and everybody wants to appease linters :P) I'm thinking about tackling this.

Log commits checked and .css files found

#33 was a good start, and the logging in renderComment is good too. We should add logging of commits checked and .css files found too. So we know the hook is processing payloads even if it doesn't find any issues.

Comment as MDN

Current specification

Compatibility comments should be made under the MDN brand. It should look like MDN itself added the comment.

Comment to a line of code on GitHub. The comment is published by a user named "MDN" who is using the MDN logo as an avatar.

Add Severity Levels To Warnings

It's be nice not to moderate the tone of the comments when a user is using good progressive enhancement techniques. For example: a box-radius that isn't supported is probably not going to be a problem but lack of support for display: flex could be pretty catastrophic.

Never post the same comment twice

If a pull request is submitted, then another commit pushed to that branch (thus updating the PR), the entire PR is then reevaluated and commit comments duplicated.
00000300

Post a discussion comment when a stylesheet cannot be tested

There may be times when a stylesheet cannot be tested: for example, if Stylus cannot be compiled. When this happens, we should post a comment to the pull request discussion (not a line comment) mentioning that the stylesheet could not be tested.

Add test suite

We're getting to the point where we want tests on the repo so we can test against certain payloads without having to make real commits on GitHub.

Discord fails when encountering some preprocessor imports

We enabled the hook on the kuma code-base, and merged mdn/kuma@d575949 into master.

They payload delivered successfully to the hook, but the heroku logs show ...

2015-06-10T19:46:07.348792+00:00 heroku[router]: at=info method=POST path="/hook" host=youshoulduse.herokuapp.com request_id=5767898a-3792-4337-80cb-3d52c0539b24 fwd="192.30.252.45" dyno=web.1 connect=1ms service=42ms status=200 bytes=211
2015-06-10T19:46:07.332623+00:00 app[web.1]: Wed, 10 Jun 2015 19:46:07 GMT express deprecated res.send(status, body): Use res.status(status).send(body) instead at module.js:13:9
2015-06-10T19:46:07.342132+00:00 app[web.1]: Repo: mozilla/kuma
2015-06-10T19:46:08.603048+00:00 app[web.1]:     return sourceMap.sections != null
2015-06-10T19:46:08.603050+00:00 app[web.1]:                     ^
2015-06-10T19:46:08.603052+00:00 app[web.1]: TypeError: Cannot read property 'sections' of undefined
2015-06-10T19:46:08.603042+00:00 app[web.1]: /app/node_modules/source-map/lib/source-map/source-map-consumer.js:23
2015-06-10T19:46:08.603055+00:00 app[web.1]:     at /app/sourceParse.js:22:26
2015-06-10T19:46:08.603057+00:00 app[web.1]:     at Renderer.render (/app/node_modules/stylus/lib/renderer.js:107:12)
2015-06-10T19:46:08.603054+00:00 app[web.1]:     at new SourceMapConsumer (/app/node_modules/source-map/lib/source-map/source-map-consumer.js:23:21)
2015-06-10T19:46:08.603061+00:00 app[web.1]:     at Request.emit (events.js:110:17)
2015-06-10T19:46:08.603060+00:00 app[web.1]:     at Request.self.callback (/app/node_modules/request/request.js:354:22)
2015-06-10T19:46:08.603058+00:00 app[web.1]:     at Request._callback (/app/sourceParse.js:21:17)
2015-06-10T19:46:08.603063+00:00 app[web.1]:     at Request.<anonymous> (/app/node_modules/request/request.js:1207:14)
2015-06-10T19:46:08.603064+00:00 app[web.1]:     at Request.emit (events.js:129:20)
2015-06-10T19:46:08.603067+00:00 app[web.1]:     at IncomingMessage.emit (events.js:129:20)
2015-06-10T19:46:08.603066+00:00 app[web.1]:     at IncomingMessage.<anonymous> (/app/node_modules/request/request.js:1153:12)

React to rate-limit being reached

When using OAUTH authentication, we are limited to 5,000 API calls per hour. We need to handle the case where the limit is reached.

Verify Beautify settings

It appears that beautify is either not been used recently, or has settings that seem to differ based on the system used.

Add compatibility comments to pull requests

Current specification

When someone submits a pull request to a repository that has YouShouldUse installed, it should go through and add compatibility comments to the lines of code modified in the pull request.

An open pull request with two inline compatibility comments

Commit comments are not added

Quoting @darkwing:

Here's what I've done that is not yet working:

  1. Go to my GitHub settings, created a Personal Access Token with the permissions: admin:org_hook, admin:repo_hook, gist, repo, user
  2. Added token to my env: export OAUTH_TOKEN=XXXXXX
  3. Added a commit to my test repo's master branch, pushed to GitHub
  4. Checked out the commit display on GitHub...no comments :(

The Personal Access Tokens page also mentions the token has never been used.

Invalid Comment Count

At present, when a commit's files are analyzed by YSU, the entire file is analyzed instead of simply the file's diff data. This is problematic because the repo page shows one comment count for the commit:

https://camo.githubusercontent.com/97b8401bdc0161d88b275b74b952f64a5913bbea/687474703a2f2f636f6e74656e742e73637265656e636173742e636f6d2f75736572732f646176696477616c736838332f666f6c646572732f4a696e672f6d656469612f35346563636539632d313336322d343063622d383137322d3464363837383334316665612f30303030303239382e706e67

...instead of just the number of comments that the use will be shown when the browse the commit itself.

Contribution instruction: token creation instructions unclear

Today, while setting up the environment, I noticed the instructions about the creation of a personal access token inside the CONTRIBUTING.md file are unclear. It seems one should add the following permissions:

  • admin:repo_hook
  • admin:org_hook

Or so I've been instructed by @darkwing .

Is this correct? If yes, I'll amend the file to include the information.

Use default configuration if .doiuse file is empty

If a repository has an empty .doiuse file, an empty configuration is used. The stylesheets of that repository are not tested against any browsers. This is "by design", but in hindsight, it's a pretty dumb design. I can't imagine why anyone would expect this behavior.

We should treat an empty .doiuse file like a non-existent .doiuse file and fall back to the default configuration.

Line comments

Instead of reporting all issues in one comment at the bottom of the file, report issues in-place as line comments. Do not add line comments for issues related to lines that did not change it that commit.

Discord does not comment on all incompatibilities

When a user submits comments too quickly, the account is temporarily prevented from adding more. GitHub prints a message explaining this if you try to manually add a comment after running Discord. This restriction explains why Discord does not comment on all incompatibilities.

I was able to make Discord comment on all incompatibilities by pausing for a random amount of time between each comment but that's just a proof-of-concept. We'll need a much different implementation for production. Some kind of queue would be great, but I can't find a node queue that can be configured to pause between tasks.

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.