Contribute to Open Source. Search issue labels to find the right project for you!

rate limit exceeded: funky error message

google/go-github

The error message for “rate limit exceeded” has both a period and a semicolon in it which looks weird.

GET https://api.github.com/repos/golang/go/issues?direction=desc&page=1&per_page=100&sort=updated&state=all: 403 API rate limit of 5000 
still exceeded until 2017-04-21 08:38:57 -0700 PDT, not making remote request.; rate reset 
in 26m8.032328588s

We could also probably round the duration to the nearest second (if greater than a minute) or tenth of a second (if less than a minute) to avoid 8 useless units of precision after the decimal.

Updated 24/04/2017 15:57 15 Comments

Consistent Go naming for JSON fields

google/go-github

As discussed in https://github.com/google/go-github/pull/520#discussion_r98727959 and https://github.com/google/go-github/pull/602#issuecomment-290255621 the naming of fields such as Total (as opposed to TotalCount) where the JSON name is total_count seems inconsistent and it would be nice to consolidate.

However, this is a breaking API change.

This issue has been opened to discuss the situation and see if it is worth breaking the API to have more consistency.

Updated 01/04/2017 00:40 12 Comments

UnauthenticatedRateLimitedTransport.RoundTrip breaks http.RoundTripper contract (mostly harmless).

google/go-github

UnauthenticatedRateLimitedTransport.RoundTrip does this:

// To set extra querystring params, we must make a copy of the Request so
// that we don't modify the Request we were given. This is required by the
// specification of http.RoundTripper.
req = cloneRequest(req)
q := req.URL.Query()
q.Set("client_id", t.ClientID)
q.Set("client_secret", t.ClientSecret)
req.URL.RawQuery = q.Encode()

But cloneRequest doesn’t make a copy of the URL field, it still points to the same url.URL struct that the original request points to. So doing req.URL.RawQuery = q.Encode() actually modifies the URL of original request.

This issue is mostly harmless, but it’s a bug.

This is similar to https://go-review.googlesource.com/c/36483/.

Updated 23/02/2017 03:20 4 Comments

escape-case and no-hex-escape false positives – need to handle backslashes

sindresorhus/eslint-plugin-unicorn

package.json:

{
  "private": true,
  "eslintConfig": {
    "env": {
      "es6": true
    },
    "parserOptions": {
      "ecmaVersion": 2017,
      "sourceType": "module"
    },
    "plugins": [
      "unicorn"
    ],
    "rules": {
      "unicorn/escape-case": "error",
      "unicorn/no-hex-escape": "error"
    }
  },
  "scripts": {
    "test": "eslint test.js"
  },
  "devDependencies": {
    "eslint": "^3.15.0",
    "eslint-plugin-unicorn": "^2.0.1"
  }
}

test.js:

"\\ufeff"
"\\\\xa0"

Output:

$ npm test

> @ test /home/lydell/bugs/eslint-plugin-unicorn-bugs
> eslint test.js


/home/lydell/bugs/eslint-plugin-unicorn-bugs/test.js
  1:1  error  Use uppercase characters for the value of the escape sequence  unicorn/escape-case
  2:1  error  Use uppercase characters for the value of the escape sequence  unicorn/escape-case
  2:1  error  Use unicode escapes instead of hexadecimal escapes             unicorn/no-hex-escape

✖ 3 problems (3 errors, 0 warnings)

npm ERR! Test failed.  See above for more details.

Expected: No errors.

Updated 26/03/2017 10:55 6 Comments

Identify user mistakes in config

deployphp/deployer
Q A
Issue Type Feature Request
Deployer Version next

Implement internal bookkeeping to help identify user mistakes like spelling errors or unused variables that may lead to unexpected behavior.

set('keep_relaeses', 5);

Shows an warning:

Unknown config `keep_relaeses`. Did you mean `keep_releases`?
Updated 21/03/2017 13:12 3 Comments

ava incorrectly ignores test files when the project itself is contained in node_modules directory

avajs/ava

Description

I have two projects:

  • https://github.com/gajus/isomorphic-webpack
  • https://github.com/gajus/isomorphic-webpack-demo

Due to the nature of the projects (process.pwd() aware dependency resolution), it is not possible to link isomorphic-webpack-demo inside isomorphic-webpack. Therefore, I need to do:

git clone https://github.com/gajus/isomorphic-webpack
git clone https://github.com/gajus/isomorphic-webpack-demo
(cd ./isomorphic-webpack && npm install)
(cd ./isomorphic-webpack-demo && npm install)
rm -fr ./isomorphic-webpack-demo/node_modules/isomorphic-webpack
cp ./isomorphic-webpack ./isomorphic-webpack-demo/node_modules

The problem happens when I try to run ava inside of isomorphic-webpack, i.e.

cd ./isomorphic-webpack-demo/node_modules/isomorphic-webpack
npm run test

I am getting error:

  1 exception

  ✖ Couldn't find any files to test

My guess (without looking at the source code), is that ava detects that ./isomorphic-webpack-demo/node_modules/isomorphic-webpack/test path includes node_modules and therefore ignores this path.

Expected behaviour: ava should detect the immediate ./test directory and run the tests.

Environment

node -e "var os=require('os');console.log('Node.js ' + process.version + '\n' + os.platform() + ' ' + os.release())"
ava --version
npm --version
Node.js v7.3.0
darwin 16.3.0
0.17.0
3.10.10
Updated 13/03/2017 10:10 5 Comments

Mercurial support?

deployphp/deployer
Q A
Issue Type Question
Deployer Version master
Local Machine OS N/A
Remote Machine OS N/A

Is there a way to use it with Mercurial(hg) repo?

repository is mandatory in configuration, and it only accepts git, as I can see, but what to do, if I don’t use git?

Updated 06/03/2017 03:26 6 Comments

Enforce length check style in the `explicit-length-check` rule

sindresorhus/eslint-plugin-unicorn

explicit-length-check checks that length properties get compared to a value instead of checking the truthiness of the property.

In https://github.com/avajs/eslint-plugin-ava/pull/149#pullrequestreview-3799305, we remembered that there are some opinions on how that value then gets compared :sweat_smile:

For instance:

a.length === 0
// vs
a.length < 1 // not sure I've ever seen this one TBH

a.length !== 0
// vs
a.length > 0
// vs
a.length >= 1

// + some I might have forgotten

It could be nice to be able to specify how you want your comparisons to be made, and make that consistent across your project.

I’m not sure what the options would look like. At the top of my head, I’m thinking:

{
  "unicorn/explicit-length-check": ["error", {
    "empty": ["eq", 0] | ["lt", 1], // one or the other
    "not-empty": ["ne", 0] | ["gt", 0] | ["gte", 1]
  }]
}

Should one be omitted (empty for instance), then you’d simply get no errors reports on how that one gets checked (both a.length < 1 a.length === 0 would be fine).

This sounds pretty complicated at the moment (especially if we want to support == too), so I’m not too fond of it at the moment, especially it would not make sense to have empty: ["equal", 1200] as the config. Maybe we could simplify it to

{
  "unicorn/explicit-length-check": ["error", {
    "empty": "eq" | "lt",
    "not-empty": "ne" | "gt" | "gte"
  }]
}

and then we have predefined values associated to each of those operators. We could also have longer names for the operators, but you’d then get greater-than-or-equal (which is okay, but pretty long).

I’m kind of proposing this system so that we could have the same system for a different rule checking the indexOf uses. It might be nice to think of a similar “API” for it.

Oh, and obviously, this should not report any check for specific indices: a.length === 2 and a.length == 2 should always be fine, whatever the settings may be.

Updated 05/02/2017 18:42 2 Comments

Remove Projects (0) from repo navigation

sindresorhus/refined-github

Since GitHub has introduced projects there is this Projects tab on every repo. I am yet to see a repository using them. So I’d suggest removing the tab if there are 0 projects. It would reduce clutter and you will only see it when a repository is actually using projects.

That said I understand why GitHub did it like that - showing it for every repository even though nobody is using it at first - they want people to know about the feature, to open the tab and see the intro copy there. However I think users of Refined GitHub are heavy GitHub users and already know about it.

Implementation should be fairly easy as GitHub already show the number of projects in the tab button.

Updated 29/03/2017 18:49 18 Comments

tape/tap transition guide

avajs/ava

Would make migrating from tape easier if AVA & tape shared the same API.

Below is the full list of tape apis that don’t exist in AVA. Most of these would only require a simple alias e.g. Test.prototype.deepEqual = Test.prototype.same

Though it’s possible there’s benefit in divorcing the tape API entirely & just keeping the current, simpler API. For example, not sure if it was ever a good idea to support both deepEquals and deepEqual other than to encourage bikeshedding within a team about which one to use.

const TapeTest = require('tape/lib/test')
const AVATest = require('ava/lib/test')
Object.keys(TapeTest.prototype).filter(k => !Object.keys(AVATest.prototype).includes(k))
[ 'test',
  'comment',
  'timeoutAfter',
  '_end',
  '_exit',
  '_pendingAsserts',
  'skip',
  'notok',
  'iferror',
  'ifErr',
  'strictEquals',
  'strictEqual',
  'isEqual',
  'equals',
  'equal',
  'isInequal',
  'doesNotEqual',
  'isNot',
  'isNotEqual',
  'notStrictEquals',
  'notStrictEqual',
  'notEquals',
  'notEqual',
  'isEquivalent',
  'deepEquals',
  'deepEqual',
  'looseEquals',
  'looseEqual',
  'deepLooseEqual',
  'isInequivalent',
  'isNotEquivalent',
  'isNotDeeply',
  'isNotDeepEqual',
  'notDeeply',
  'notEquivalent',
  'notDeepEqual',
  'notLooseEquals',
  'notLooseEqual',
  'notDeepLooseEqual' ]

Related to https://github.com/sindresorhus/ava/issues/96

Updated 21/04/2017 18:32 10 Comments

Fork me on GitHub