You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@couchdb.apache.org by Jason Smith <ja...@gmail.com> on 2015/09/15 14:08:07 UTC

A Plan: Remove pre-commit, jshint, code style requirements from couchdb-nano

Hi, list!

I want to share my plan for preparing to work on couchdb-nano. Briefly, I
want to fix a thing or two in the project, but I think a more urgent change
is the pre-commit hooks enforcing coding style and test coverage.

The Nano project has several brilliant checks that it can do:
https://github.com/apache/couchdb-nano/blob/master/package.json#L50-L56

However, now that it is under the Apache CouchDB umbrella, I think these
checks are overkill. AFAIK, no other parts of the CouchDB project enforce a
particular style, certainly not as a condition to commit.

For example, here is a rejection by attempting to commit a single blank
line. https://gist.github.com/jhs/a198c75b4d06c72a5940 (TL;DR a huge test
suite runs, fails for some reason, and the commit is rejected).

A gem of the Nano project is that all of its http interactions are mocked.
You can run the entire test suite from a simple git clone (plus npm install
for dependencies). I would like to embrace that characteristic. If
contributors waiver on the style or test coverage, the maintainers can
shoulder that burden (for example, by committing to the contribution,
lowering the minimum coverage threshold, ha ha ha!).

Really, I am sending this email because it is a departure from the
dscape/nano philosophy. I think the world of Nano and its community. Nuno
is brilliant, and the Nano community is brilliant. I don't wan to--sort of
betray my gurus; but on the other hand, whoo boy, it's a bit much.

Re: A Plan: Remove pre-commit, jshint, code style requirements from couchdb-nano

Posted by Jason Smith <ja...@gmail.com>.
Hi, Robert. I agree with everything you said.

Furthermore, I would like to adopt the Fauxton style for the Nano project
(and I propose that it extends to all JavaScript under the CouchDB
umbrella).

As a first step, I will simply remove the tests from pre-commit hooks. In
the future, I would like to re-use or duplicate your CI tools for Nano. But
first thing's first! I want to fix a couple of bugs and ship a release.

On Wed, Sep 16, 2015 at 7:18 AM, Robert Kowalski <ro...@kowalski.gd> wrote:

> Hey there,
>
> just as a report how we are doing it with Fauxton:
>
> the Fauxton project also has a styleguide in order to make reviews and
> reading code easier for everyone. At one point it turned out to reduce a
> lot of work for the reviewers if we test automatically for the coding style
> as part of our testsuite.
>
> We don't use commit hooks for it, but the CI will fail if the automatic
> coding style check and also the testsuite was not successful. the style
> check is runs before the unit tests run, which run before the integration
> tests. Red tests (that include tests for style) are a no-go for a merge in
> Fauxton.
>
> I don't think the checks must be enforced on a pre/post-commit-hook-level
> but somewhere they should notify the proposer of the change to make the
> live of the reviewer easier - in case you think code style is important for
> your project. I also want to not that some sub projects of CouchDB have no
> styleguide at all and that it can be a positive thing or a negative thing.
> Having one worked out well for Fauxton.
>
> I also think that deploying with a red CI might be OK in exceptional cases,
> but in these cases the deploying person should be aware why the test fails
> in 100%, and know the reasons why it is not fixable right now.
>
> In the recent past I have seen people saying they would know why the
> integration tests fails, delivering buggy releases.
>
> I think it is a small boundary and not everyone who says they know why the
> tests fail is 100% sure why they really fail (and deploys broken releases
> therefore). But I have worked with people that were so deep into the
> testsuites and the project they maintained in the past that they were able
> to predict that.
>
> In short I support whatever you decide for I just wanted to share my
> experiences, maybe it helps :)
>
> On Tue, Sep 15, 2015 at 2:54 PM, Jason Smith <ja...@gmail.com>
> wrote:
>
> > Hi, Dale.
> >
> > On Tue, Sep 15, 2015 at 7:26 PM, Dale Harvey <da...@arandomurl.com>
> wrote:
> >
> > >
> > > I just wanted to clarify, are you speaking about removing as a
> > "pre-commit
> > > hook", or removing the requirements for those checks to pass before
> > > merging?
> > >
> >
> > I am speaking about removing the pre-commit hook only--the mechanical
> thing
> > that that runs automatically when one commits.
> >
> > The tests and checks would make brilliant push hooks, or perhaps Travis
> > tests for pull requests. However they are a bit much as a *commit* hook.
> >
> > A separate conversation: should the tests pass for merging. I would say:
> > yes if it's smart; no if it's dumb: they need not pass for merging, at
> > least not automatically, mechanically. The reason is that we should merge
> > pull requests liberally, accepting contributions from all, then commit on
> > top of those to correct for style. I won't have some sort of angry
> > Calvinist robot telling me I can't merge a pull request. (If we can be
> > clever, for example to require all tests pass for the master branch but
> not
> > feature branches, then yes I would love that.)
> >
>

Re: A Plan: Remove pre-commit, jshint, code style requirements from couchdb-nano

Posted by Robert Kowalski <ro...@kowalski.gd>.
Hey there,

just as a report how we are doing it with Fauxton:

the Fauxton project also has a styleguide in order to make reviews and
reading code easier for everyone. At one point it turned out to reduce a
lot of work for the reviewers if we test automatically for the coding style
as part of our testsuite.

We don't use commit hooks for it, but the CI will fail if the automatic
coding style check and also the testsuite was not successful. the style
check is runs before the unit tests run, which run before the integration
tests. Red tests (that include tests for style) are a no-go for a merge in
Fauxton.

I don't think the checks must be enforced on a pre/post-commit-hook-level
but somewhere they should notify the proposer of the change to make the
live of the reviewer easier - in case you think code style is important for
your project. I also want to not that some sub projects of CouchDB have no
styleguide at all and that it can be a positive thing or a negative thing.
Having one worked out well for Fauxton.

I also think that deploying with a red CI might be OK in exceptional cases,
but in these cases the deploying person should be aware why the test fails
in 100%, and know the reasons why it is not fixable right now.

In the recent past I have seen people saying they would know why the
integration tests fails, delivering buggy releases.

I think it is a small boundary and not everyone who says they know why the
tests fail is 100% sure why they really fail (and deploys broken releases
therefore). But I have worked with people that were so deep into the
testsuites and the project they maintained in the past that they were able
to predict that.

In short I support whatever you decide for I just wanted to share my
experiences, maybe it helps :)

On Tue, Sep 15, 2015 at 2:54 PM, Jason Smith <ja...@gmail.com>
wrote:

> Hi, Dale.
>
> On Tue, Sep 15, 2015 at 7:26 PM, Dale Harvey <da...@arandomurl.com> wrote:
>
> >
> > I just wanted to clarify, are you speaking about removing as a
> "pre-commit
> > hook", or removing the requirements for those checks to pass before
> > merging?
> >
>
> I am speaking about removing the pre-commit hook only--the mechanical thing
> that that runs automatically when one commits.
>
> The tests and checks would make brilliant push hooks, or perhaps Travis
> tests for pull requests. However they are a bit much as a *commit* hook.
>
> A separate conversation: should the tests pass for merging. I would say:
> yes if it's smart; no if it's dumb: they need not pass for merging, at
> least not automatically, mechanically. The reason is that we should merge
> pull requests liberally, accepting contributions from all, then commit on
> top of those to correct for style. I won't have some sort of angry
> Calvinist robot telling me I can't merge a pull request. (If we can be
> clever, for example to require all tests pass for the master branch but not
> feature branches, then yes I would love that.)
>

Re: A Plan: Remove pre-commit, jshint, code style requirements from couchdb-nano

Posted by Jason Smith <ja...@gmail.com>.
Hi, Dale.

On Tue, Sep 15, 2015 at 7:26 PM, Dale Harvey <da...@arandomurl.com> wrote:

>
> I just wanted to clarify, are you speaking about removing as a "pre-commit
> hook", or removing the requirements for those checks to pass before
> merging?
>

I am speaking about removing the pre-commit hook only--the mechanical thing
that that runs automatically when one commits.

The tests and checks would make brilliant push hooks, or perhaps Travis
tests for pull requests. However they are a bit much as a *commit* hook.

A separate conversation: should the tests pass for merging. I would say:
yes if it's smart; no if it's dumb: they need not pass for merging, at
least not automatically, mechanically. The reason is that we should merge
pull requests liberally, accepting contributions from all, then commit on
top of those to correct for style. I won't have some sort of angry
Calvinist robot telling me I can't merge a pull request. (If we can be
clever, for example to require all tests pass for the master branch but not
feature branches, then yes I would love that.)

Re: A Plan: Remove pre-commit, jshint, code style requirements from couchdb-nano

Posted by Dale Harvey <da...@arandomurl.com>.
Speaking from not a part of nano, but pouchdb has similiar checks and
requirements.

I just wanted to clarify, are you speaking about removing as a "pre-commit
hook", or removing the requirements for those checks to pass before merging?

The checks and tests existing and being enforced looks like a huge
positive, however if they are implemented via a pre-commit hook thats
blocking contributors even getting them up to a PR level so any issues can
be collaboratively fixed, that certainly seems like a problem.

On 15 September 2015 at 14:08, Jason Smith <ja...@gmail.com> wrote:

> Hi, list!
>
> I want to share my plan for preparing to work on couchdb-nano. Briefly, I
> want to fix a thing or two in the project, but I think a more urgent change
> is the pre-commit hooks enforcing coding style and test coverage.
>
> The Nano project has several brilliant checks that it can do:
> https://github.com/apache/couchdb-nano/blob/master/package.json#L50-L56
>
> However, now that it is under the Apache CouchDB umbrella, I think these
> checks are overkill. AFAIK, no other parts of the CouchDB project enforce a
> particular style, certainly not as a condition to commit.
>
> For example, here is a rejection by attempting to commit a single blank
> line. https://gist.github.com/jhs/a198c75b4d06c72a5940 (TL;DR a huge test
> suite runs, fails for some reason, and the commit is rejected).
>
> A gem of the Nano project is that all of its http interactions are mocked.
> You can run the entire test suite from a simple git clone (plus npm install
> for dependencies). I would like to embrace that characteristic. If
> contributors waiver on the style or test coverage, the maintainers can
> shoulder that burden (for example, by committing to the contribution,
> lowering the minimum coverage threshold, ha ha ha!).
>
> Really, I am sending this email because it is a departure from the
> dscape/nano philosophy. I think the world of Nano and its community. Nuno
> is brilliant, and the Nano community is brilliant. I don't wan to--sort of
> betray my gurus; but on the other hand, whoo boy, it's a bit much.
>

Re: A Plan: Remove pre-commit, jshint, code style requirements from couchdb-nano

Posted by Johannes Jörg Schmidt <sc...@netzmerk.com>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Hi Jason,

I support your plan. I think one of the main reasons behind this
coverage contract [1] was to render the maintainer useless :) But
these pre commit hooks also have bugged me in the past.

Best
Schmidt

[1]: http://blog.yld.io/2014/11/12/nano6-and-the-coverage-contract/

On 15.09.2015 14:08, Jason Smith wrote:
> Hi, list!
> 
> I want to share my plan for preparing to work on couchdb-nano.
> Briefly, I want to fix a thing or two in the project, but I think a
> more urgent change is the pre-commit hooks enforcing coding style
> and test coverage.
> 
> The Nano project has several brilliant checks that it can do: 
> https://github.com/apache/couchdb-nano/blob/master/package.json#L50-L5
6
>
>  However, now that it is under the Apache CouchDB umbrella, I think
> these checks are overkill. AFAIK, no other parts of the CouchDB
> project enforce a particular style, certainly not as a condition to
> commit.
> 
> For example, here is a rejection by attempting to commit a single
> blank line. https://gist.github.com/jhs/a198c75b4d06c72a5940 (TL;DR
> a huge test suite runs, fails for some reason, and the commit is
> rejected).
> 
> A gem of the Nano project is that all of its http interactions are
> mocked. You can run the entire test suite from a simple git clone
> (plus npm install for dependencies). I would like to embrace that
> characteristic. If contributors waiver on the style or test
> coverage, the maintainers can shoulder that burden (for example, by
> committing to the contribution, lowering the minimum coverage
> threshold, ha ha ha!).
> 
> Really, I am sending this email because it is a departure from the 
> dscape/nano philosophy. I think the world of Nano and its
> community. Nuno is brilliant, and the Nano community is brilliant.
> I don't wan to--sort of betray my gurus; but on the other hand,
> whoo boy, it's a bit much.
> 

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQEcBAEBCAAGBQJV+A65AAoJED+W7gN+c0gcioMH/ROJ1RSoJZ3u0HUCouRybSo6
+TlUmEuErv9N4g5m4kXH6tXrr5HgvyvxiDZzp4OwdMDA6Q4Pba/kYci/TXz+shoH
+aoq/zkv/Z8H8dYNm7eQ1+b4I66czdvzawcxBypasqv3prY1akSFplpL5q8ZAawd
wLbhsZ7kORovRbs4U5ekFxER4Yf0xQP4ym34c11L19fHZd/nrI2OySBlOROJ/8m5
nTAMcH7pH5rVVPxJCNA6QG0UVh//w7GUfDe/+pZTl1Smno/FHXcXsd3mAAvdp1QH
kS6VXsjMeiWueDZFwVY15xKEwpAu8z26yv/vFqVrDjKqm5kkvMiSzONiULaTgZ8=
=iDMf
-----END PGP SIGNATURE-----