diff mbox series

[2/2] Integrate 'pre-commit'

Message ID 20190924094445.19820-2-stephen@that.guru
State Accepted
Headers show
Series [1/2] trivial: Style fixes | expand

Commit Message

Stephen Finucane Sept. 24, 2019, 9:44 a.m. UTC
Helps me avoid simple style issues. We explicitly disable newline checks
for some files where the "fix" would be harmful (e.g. mboxes and
templates).

Signed-off-by: Stephen Finucane <stephen@that.guru>
---
 .pre-commit-config.yaml | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
 create mode 100644 .pre-commit-config.yaml

Comments

Daniel Axtens Sept. 26, 2019, 1:12 p.m. UTC | #1
Hi Stephen,

I love automated tools, but I have no idea what pre-commit is - would
you be able to clarify it in the commit message?

Kind regards,
Daniel

> Helps me avoid simple style issues. We explicitly disable newline checks
> for some files where the "fix" would be harmful (e.g. mboxes and
> templates).
>
> Signed-off-by: Stephen Finucane <stephen@that.guru>
> ---
>  .pre-commit-config.yaml | 20 ++++++++++++++++++++
>  1 file changed, 20 insertions(+)
>  create mode 100644 .pre-commit-config.yaml
>
> diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
> new file mode 100644
> index 00000000..bea1187a
> --- /dev/null
> +++ b/.pre-commit-config.yaml
> @@ -0,0 +1,20 @@
> +repos:
> +- repo: https://github.com/pre-commit/pre-commit-hooks
> +  rev: v2.3.0
> +  hooks:
> +  - id: check-executables-have-shebangs
> +  - id: check-merge-conflict
> +  - id: check-yaml
> +  - id: end-of-file-fixer
> +    exclude: (.*\.mbox)|(.*\.css)|(.*\.json)|(.*\.js)|(.*\.svg)|(.*/mails/.*-subject\.txt)
> +  - id: flake8
> +    exclude: ^patchwork/migrations
> +  - id: trailing-whitespace
> +    exclude: (.*\.mbox)|(.*\.svg)
> +- repo: https://github.com/Lucas-C/pre-commit-hooks
> +  rev: v1.1.7
> +  hooks:
> +  - id: remove-tabs
> +    exclude: (.*\.mbox)|(.*\.svg)|(.*\.sql)|(.*\.conf)
> +  - id: remove-crlf
> +    exclude: (.*\.mbox)|(.*\.svg)
> -- 
> 2.21.0
>
> _______________________________________________
> Patchwork mailing list
> Patchwork@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/patchwork
Stephen Finucane Sept. 27, 2019, 7:56 a.m. UTC | #2
On Thu, 2019-09-26 at 23:12 +1000, Daniel Axtens wrote:
> Hi Stephen,
> 
> I love automated tools, but I have no idea what pre-commit is - would
> you be able to clarify it in the commit message?

Yup, sorry. Let me send a follow-up doc fix that should explain
everything.

Stephen

> Kind regards,
> Daniel
> 
> > Helps me avoid simple style issues. We explicitly disable newline checks
> > for some files where the "fix" would be harmful (e.g. mboxes and
> > templates).
> > 
> > Signed-off-by: Stephen Finucane <stephen@that.guru>
> > ---
> >  .pre-commit-config.yaml | 20 ++++++++++++++++++++
> >  1 file changed, 20 insertions(+)
> >  create mode 100644 .pre-commit-config.yaml
> > 
> > diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
> > new file mode 100644
> > index 00000000..bea1187a
> > --- /dev/null
> > +++ b/.pre-commit-config.yaml
> > @@ -0,0 +1,20 @@
> > +repos:
> > +- repo: https://github.com/pre-commit/pre-commit-hooks
> > +  rev: v2.3.0
> > +  hooks:
> > +  - id: check-executables-have-shebangs
> > +  - id: check-merge-conflict
> > +  - id: check-yaml
> > +  - id: end-of-file-fixer
> > +    exclude: (.*\.mbox)|(.*\.css)|(.*\.json)|(.*\.js)|(.*\.svg)|(.*/mails/.*-subject\.txt)
> > +  - id: flake8
> > +    exclude: ^patchwork/migrations
> > +  - id: trailing-whitespace
> > +    exclude: (.*\.mbox)|(.*\.svg)
> > +- repo: https://github.com/Lucas-C/pre-commit-hooks
> > +  rev: v1.1.7
> > +  hooks:
> > +  - id: remove-tabs
> > +    exclude: (.*\.mbox)|(.*\.svg)|(.*\.sql)|(.*\.conf)
> > +  - id: remove-crlf
> > +    exclude: (.*\.mbox)|(.*\.svg)
> > -- 
> > 2.21.0
> > 
> > _______________________________________________
> > Patchwork mailing list
> > Patchwork@lists.ozlabs.org
> > https://lists.ozlabs.org/listinfo/patchwork
Stephen Finucane Oct. 5, 2019, 2:51 p.m. UTC | #3
On Fri, 2019-09-27 at 08:56 +0100, Stephen Finucane wrote:
> On Thu, 2019-09-26 at 23:12 +1000, Daniel Axtens wrote:
> > Hi Stephen,
> > 
> > I love automated tools, but I have no idea what pre-commit is - would
> > you be able to clarify it in the commit message?
> 
> Yup, sorry. Let me send a follow-up doc fix that should explain
> everything.
> 
> Stephen

Applied with the doc.

Stephen
diff mbox series

Patch

diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
new file mode 100644
index 00000000..bea1187a
--- /dev/null
+++ b/.pre-commit-config.yaml
@@ -0,0 +1,20 @@ 
+repos:
+- repo: https://github.com/pre-commit/pre-commit-hooks
+  rev: v2.3.0
+  hooks:
+  - id: check-executables-have-shebangs
+  - id: check-merge-conflict
+  - id: check-yaml
+  - id: end-of-file-fixer
+    exclude: (.*\.mbox)|(.*\.css)|(.*\.json)|(.*\.js)|(.*\.svg)|(.*/mails/.*-subject\.txt)
+  - id: flake8
+    exclude: ^patchwork/migrations
+  - id: trailing-whitespace
+    exclude: (.*\.mbox)|(.*\.svg)
+- repo: https://github.com/Lucas-C/pre-commit-hooks
+  rev: v1.1.7
+  hooks:
+  - id: remove-tabs
+    exclude: (.*\.mbox)|(.*\.svg)|(.*\.sql)|(.*\.conf)
+  - id: remove-crlf
+    exclude: (.*\.mbox)|(.*\.svg)