Skip to content

Commit 901263e

Browse files
CI: Setup pre-commit and format the files accordingly (#17)
1 parent 93e5b58 commit 901263e

File tree

11 files changed

+441
-37
lines changed

11 files changed

+441
-37
lines changed

.auto-changelog

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@
33
"template": ".auto-changelog-template.hbs",
44
"commitLimit": false,
55
"backfillLimit": false,
6-
"ignoreCommitPattern": "Release [0-9]+\\.[0-9]+\\.[0-9]+|Update CHANGELOG.*|.*\\[skip-changelog\\].*|Initial empty repository",
6+
"ignoreCommitPattern": "Release [0-9]+\\.[0-9]+\\.[0-9]+|Update CHANGELOG.*|.*\\[skip-changelog\\].*|\\[pre-commit.ci\\]",
77
"commitUrl": "https://github.com/BlueBrain/dir-content-diff/commit/{id}",
88
"issueUrl": "https://github.com/BlueBrain/dir-content-diff/issues/{id}",
99
"mergeUrl": "https://github.com/BlueBrain/dir-content-diff/pull/{id}",
10-
"compareUrl": "https://github.com/BlueBrain/dir-content-diff/compare/{from}..{to}"
10+
"compareUrl": "https://github.com/BlueBrain/dir-content-diff/compare/{from}..{to}",
11+
"startingVersion": "1.1.0"
1112
}

.auto-changelog-template.hbs

Lines changed: 157 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,176 @@
11
# Changelog
22

3+
{{!--
4+
Introduction
5+
• This template tries to follow conventional commits format https://www.conventionalcommits.org/en/v1.0.0/
6+
• The template uses regex to filter commit types into their own headings (this is more than just fixes and features headings)
7+
• It also uses the replaceText function in package.json to remove the commit type text from the message, because the headers are shown instead.
8+
• The text 'Breaking:' or 'Breaking changes:' can be located anywhere in the commit.
9+
• The types feat:, fix:, chore:, docs:, refactor:, test:, style:, perf: must be at the beginning of the commit subject with an : on end.
10+
• They can optionally have a scope set to outline the module or component that is affected eg feat(bldAssess):
11+
• There is a short hash on the end of every commit that is currently commented out so that change log did not grow too long (due to some system's file size limitations). You can uncomment if you wish [`{{shorthash}}`]({{href}})
12+
Example Definitions
13+
• feat: A new feature
14+
• fix: A bug fix
15+
• perf: A code change that improves performance
16+
• refactor: A code change that neither fixes a bug nor adds a feature
17+
• style: Changes that do not affect the meaning of the code (white-space, formatting, spelling mistakes, missing semi-colons, etc)
18+
• test: Adding missing tests or correcting existing tests
19+
• docs: Adding/updating documentation
20+
• chore: Something like updating a library version, or moving files to be in a better location and updating all file refs
21+
--}}
22+
23+
24+
{{!-- In package.json need to add this to remove label text from the change log output (because the markdown headers are now used to group them).
25+
NOTES • Individual brackets have been escaped twice to be Json compliant.
26+
• For items that define a scope eg feat(bldAssess): We remove the 1st bracket and then re-add it so we can select the right piece of text
27+
{
28+
"name": "my-awesome-package",
29+
"auto-changelog": {
30+
"replaceText": {
31+
"([bB]reaking:)": "",
32+
"([bB]reaking change:)": "",
33+
"(^[fF]eat:)": "",
34+
"(^[fF]eat\\()": "\\(",
35+
"(^[fF]ix:)": "",
36+
"(^[fF]ix\\()": "\\(",
37+
"(^[cC]hore:)": "",
38+
"(^[cC]hore\\()": "\\(",
39+
"(^[dD]ocs:)": "",
40+
"(^[dD]ocs\\()": "\\(",
41+
"(^[rR]efactor:)": "",
42+
"(^[rR]efactor\\()": "\\(",
43+
"(^[tT]est:)": "",
44+
"(^[tT]est\\()": "\\(",
45+
"(^[sS]tyle:)": "",
46+
"(^[sS]tyle\\()": "\\(",
47+
"(^[pP]erf:)": "",
48+
"(^[pP]erf\\()": "\\("
49+
}
50+
}
51+
}
52+
--}}
53+
54+
{{!--
55+
Regex reminders
56+
^ = starts with
57+
\( = ( character (otherwise it is interpreted as a regex lookup group)
58+
* = zero or more of the previous character
59+
\s = whitespace
60+
. = any character except newline
61+
| = or
62+
[aA] = charcter a or character A
63+
--}}
64+
65+
366
{{#each releases}}
467
{{#if href}}
568
## [{{title}}]({{href}})
669
{{else}}
770
## {{title}}
871
{{/if}}
972

10-
{{#if tag}}
11-
> {{niceDate}}
12-
{{/if}}
73+
> {{niceDate}}
1374

1475
{{#if summary}}
1576
{{summary}}
1677
{{/if}}
1778

18-
{{#each merges}}
19-
- {{#if commit.breaking}}**Breaking change:** {{/if}}{{message}}{{#if href}} [#{{id}}]({{href}}){{/if}}
20-
{{/each}}
79+
{{! List commits that fix a given issues}}
2180
{{#each fixes}}
2281
- {{#if commit.breaking}}**Breaking change:** {{/if}}{{commit.subject}}{{#each fixes}} ({{author}}{{#if href}} - [#{{id}}]({{href}}){{/if}}){{/each}}
2382
{{/each}}
24-
{{#each commits}}
25-
- {{#if breaking}}**Breaking change:** {{/if}}{{subject}} ({{author}}{{#if href}} - [{{shorthash}}]({{href}}){{/if}})
26-
{{/each}}
83+
84+
{{! List commits with 'breaking:' or 'Breaking change:' anywhere in the message under a heading}}
85+
{{#commit-list merges heading='### Breaking Changes :warning:' message='[bB]reaking [cC]hange:|[bB]reaking:' exclude='\[skip-changelog\]'}}
86+
- {{message}} @{{author}} <!--[`#{{id}}`]({{href}}) -->
87+
{{/commit-list}}
88+
89+
{{! List commits organised under a heading, but not those already listed in the breaking section }}
90+
{{#commit-list merges heading='### New Features' message='^[fF]eat:|[fF]eat\(' exclude='[bB]reaking [cC]hange:|[bB]reaking:|\[skip-changelog\]'}}
91+
- {{message}} ({{author}}{{#if href}} - [#{{id}}]({{href}}){{/if}})
92+
{{/commit-list}}
93+
94+
{{#commit-list merges heading='### Fixes' message='^[fF]ix:|^[fF]ix\(' exclude='[bB]reaking [cC]hange:|[bB]reaking:|\[skip-changelog\]'}}
95+
- {{message}} ({{author}}{{#if href}} - [#{{id}}]({{href}}){{/if}})
96+
{{/commit-list}}
97+
98+
{{#commit-list merges heading='### Chores And Housekeeping' message='^[cC]hore:|^[cC]hore\(' exclude='[bB]reaking [cC]hange:|[bB]reaking:|\[skip-changelog\]'}}
99+
- {{message}} ({{author}}{{#if href}} - [#{{id}}]({{href}}){{/if}})
100+
{{/commit-list}}
101+
102+
{{#commit-list merges heading='### Documentation Changes' message='^[dD]ocs:|^[dD]ocs\(' exclude='[bB]reaking [cC]hange:|[bB]reaking:|\[skip-changelog\]'}}
103+
- {{message}} ({{author}}{{#if href}} - [#{{id}}]({{href}}){{/if}})
104+
{{/commit-list}}
105+
106+
{{#commit-list merges heading='### Refactoring and Updates' message='^[rR]efactor:|^[rR]efactor\(' exclude='[bB]reaking [cC]hange:|[bB]reaking:|\[skip-changelog\]'}}
107+
- {{message}} ({{author}}{{#if href}} - [#{{id}}]({{href}}){{/if}})
108+
{{/commit-list}}
109+
110+
{{#commit-list merges heading='### Changes to Test Assests' message='^[tT]est:|^[tT]est\(' exclude='[bB]reaking [cC]hange:|[bB]reaking:|\[skip-changelog\]'}}
111+
- {{message}} ({{author}}{{#if href}} - [#{{id}}]({{href}}){{/if}})
112+
{{/commit-list}}
113+
114+
{{#commit-list merges heading='### Tidying of Code eg Whitespace' message='^[sS]tyle:|^[sS]tyle\(' exclude='[bB]reaking [cC]hange:|[bB]reaking:|\[skip-changelog\]'}}
115+
- {{message}} ({{author}}{{#if href}} - [#{{id}}]({{href}}){{/if}})
116+
{{/commit-list}}
117+
118+
{{#commit-list merges heading='### Performance Improvements' message='^[pP]erf:|^[pP]erf\(' exclude='[bB]reaking [cC]hange:|[bB]reaking:|\[skip-changelog\]'}}
119+
- {{message}} ({{author}}{{#if href}} - [#{{id}}]({{href}}){{/if}})
120+
{{/commit-list}}
121+
122+
{{#commit-list merges heading='### CI Improvements' message='^[cC][iI]:|^[cC][iI]\(' exclude='[bB]reaking [cC]hange:|[bB]reaking:|\[skip-changelog\]'}}
123+
- {{message}} ({{author}}{{#if href}} - [#{{id}}]({{href}}){{/if}})
124+
{{/commit-list}}
125+
126+
{{#commit-list merges heading='### Uncategorized Changes' exclude='[bB]reaking [cC]hange:|[bB]reaking:|^[fF]eat:|^[fF]eat\(|^[fF]ix:|^[fF]ix\(|^[cC]hore:|^[cC]hore\(|^[dD]ocs:|^[dD]ocs\(|^[rR]efactor:|^[rR]efactor\(|^[tT]est:|^[tT]est\(|^[sS]tyle:|^[sS]tyle\(|^[pP]erf:|^[pP]erf\(|\[skip-changelog\]'}}
127+
- {{message}} ({{author}}{{#if href}} - [#{{id}}]({{href}}){{/if}})
128+
{{/commit-list}}
129+
130+
{{! List commits with 'breaking:' or 'Breaking change:' anywhere in the message under a heading}}
131+
{{#commit-list commits heading='### Breaking Changes :warning:' message='[bB]reaking [cC]hange:|[bB]reaking:' exclude='\[skip-changelog\]'}}
132+
- {{subject}} ({{author}}{{#if href}} - [{{shorthash}}]({{href}}){{/if}})
133+
{{/commit-list}}
134+
135+
{{! List commits organised under a heading, but not those already listed in the breaking section }}
136+
{{#commit-list commits heading='### New Features' message='^[fF]eat:|[fF]eat\(' exclude='[bB]reaking [cC]hange:|[bB]reaking:|\[skip-changelog\]'}}
137+
- {{subject}} ({{author}}{{#if href}} - [{{shorthash}}]({{href}}){{/if}})
138+
{{/commit-list}}
139+
140+
{{#commit-list commits heading='### Fixes' message='^[fF]ix:|^[fF]ix\(' exclude='[bB]reaking [cC]hange:|[bB]reaking:|\[skip-changelog\]'}}
141+
- {{subject}} ({{author}}{{#if href}} - [{{shorthash}}]({{href}}){{/if}})
142+
{{/commit-list}}
143+
144+
{{#commit-list commits heading='### Chores And Housekeeping' message='^[cC]hore:|^[cC]hore\(' exclude='[bB]reaking [cC]hange:|[bB]reaking:|\[skip-changelog\]'}}
145+
- {{subject}} ({{author}}{{#if href}} - [{{shorthash}}]({{href}}){{/if}})
146+
{{/commit-list}}
147+
148+
{{#commit-list commits heading='### Documentation Changes' message='^[dD]ocs:|^[dD]ocs\(' exclude='[bB]reaking [cC]hange:|[bB]reaking:|\[skip-changelog\]'}}
149+
- {{subject}} ({{author}}{{#if href}} - [{{shorthash}}]({{href}}){{/if}})
150+
{{/commit-list}}
151+
152+
{{#commit-list commits heading='### Refactoring and Updates' message='^[rR]efactor:|^[rR]efactor\(' exclude='[bB]reaking [cC]hange:|[bB]reaking:|\[skip-changelog\]'}}
153+
- {{subject}} ({{author}}{{#if href}} - [{{shorthash}}]({{href}}){{/if}})
154+
{{/commit-list}}
155+
156+
{{#commit-list commits heading='### Changes to Test Assests' message='^[tT]est:|^[tT]est\(' exclude='[bB]reaking [cC]hange:|[bB]reaking:|\[skip-changelog\]'}}
157+
- {{subject}} ({{author}}{{#if href}} - [{{shorthash}}]({{href}}){{/if}})
158+
{{/commit-list}}
159+
160+
{{#commit-list commits heading='### Tidying of Code eg Whitespace' message='^[sS]tyle:|^[sS]tyle\(' exclude='[bB]reaking [cC]hange:|[bB]reaking:|\[skip-changelog\]'}}
161+
- {{subject}} ({{author}}{{#if href}} - [{{shorthash}}]({{href}}){{/if}})
162+
{{/commit-list}}
163+
164+
{{#commit-list commits heading='### Performance Improvements' message='^[pP]erf:|^[pP]erf\(' exclude='[bB]reaking [cC]hange:|[bB]reaking:|\[skip-changelog\]'}}
165+
- {{subject}} ({{author}}{{#if href}} - [{{shorthash}}]({{href}}){{/if}})
166+
{{/commit-list}}
167+
168+
{{#commit-list commits heading='### CI Improvements' message='^[cC][iI]:|^[cC][iI]\(' exclude='[bB]reaking [cC]hange:|[bB]reaking:|\[skip-changelog\]'}}
169+
- {{subject}} ({{author}}{{#if href}} - [{{shorthash}}]({{href}}){{/if}})
170+
{{/commit-list}}
171+
172+
{{#commit-list commits heading='### Uncategorized Changes' exclude='[bB]reaking [cC]hange:|[bB]reaking:|^[fF]eat:|^[fF]eat\(|^[fF]ix:|^[fF]ix\(|^[cC]hore:|^[cC]hore\(|^[cC][iI]:|^[cC][iI]\(|^[dD]ocs:|^[dD]ocs\(|^[rR]efactor:|^[rR]efactor\(|^[tT]est:|^[tT]est\(|^[sS]tyle:|^[sS]tyle\(|^[pP]erf:|^[pP]erf\(|\[skip-changelog\]'}}
173+
- {{subject}} ({{author}}{{#if href}} - [{{shorthash}}]({{href}}){{/if}})
174+
{{/commit-list}}
27175

28176
{{/each}}

.github/workflows/run-tox.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,3 @@ jobs:
3333
files: ./reports/coverage-py38.xml
3434
flags: pytest
3535
name: "dir-content-diff-py38"
36-

.pre-commit-config.yaml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
default_language_version:
2+
python: python3.8
3+
repos:
4+
- repo: https://github.com/pre-commit/pre-commit-hooks
5+
rev: v4.2.0
6+
hooks:
7+
- id: check-added-large-files
8+
- id: check-case-conflict
9+
- id: check-merge-conflict
10+
- id: check-symlinks
11+
- id: check-yaml
12+
- id: debug-statements
13+
- id: end-of-file-fixer
14+
- id: trailing-whitespace
15+
- repo: https://github.com/alessandrojcm/commitlint-pre-commit-hook
16+
rev: v8.0.0
17+
hooks:
18+
- id: commitlint
19+
stages:
20+
- commit-msg
21+
additional_dependencies: ['conventional-changelog-conventionalcommits']
22+
- repo: https://github.com/pycqa/isort
23+
rev: 5.10.1
24+
hooks:
25+
- id: isort
26+
- repo: https://github.com/psf/black
27+
rev: 22.3.0
28+
hooks:
29+
- id: black
30+
- repo: https://github.com/codespell-project/codespell
31+
rev: v2.1.0
32+
hooks:
33+
- id: codespell
34+
- repo: https://github.com/PyCQA/pydocstyle
35+
rev: 6.1.1
36+
hooks:
37+
- id: pydocstyle
38+
additional_dependencies: ["toml"]
39+
- repo: https://github.com/PyCQA/flake8
40+
rev: 4.0.1
41+
hooks:
42+
- id: flake8

CHANGELOG.md

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,42 @@
11
# Changelog
22

3+
## [1.1.1](https://github.com/BlueBrain/dir-content-diff/compare/1.1.0..1.1.1)
4+
5+
> 5 May 2022
6+
7+
### Uncategorized Changes
8+
9+
- Updating copyright year (bbpgithubaudit - [#15](https://github.com/BlueBrain/dir-content-diff/pull/15))
10+
- Bump black (Adrien Berchet - [#16](https://github.com/BlueBrain/dir-content-diff/pull/16))
11+
- Add codespell in lint (Adrien Berchet - [#14](https://github.com/BlueBrain/dir-content-diff/pull/14))
12+
- Add missing types in doc of DictComparator.diff (Adrien Berchet - [#13](https://github.com/BlueBrain/dir-content-diff/pull/13))
13+
314
## [1.1.0](https://github.com/BlueBrain/dir-content-diff/compare/1.0.1..1.1.0)
415

516
> 21 January 2022
617
7-
- Require changes for CodeCov [#11](https://github.com/BlueBrain/dir-content-diff/pull/11)
8-
- Add pandas HDF capability [#10](https://github.com/BlueBrain/dir-content-diff/pull/10)
9-
- Fix tests for rst2pdf&gt;0.99 [#9](https://github.com/BlueBrain/dir-content-diff/pull/9)
10-
- Setup Codecov (#8) (Adrien Berchet - [fab0946](https://github.com/BlueBrain/dir-content-diff/commit/fab09468795dd1620f5b60047a3b780359634842))
18+
### Uncategorized Changes
19+
20+
- Require changes for CodeCov (Adrien Berchet - [#11](https://github.com/BlueBrain/dir-content-diff/pull/11))
21+
- Add pandas HDF capability (Alexis Arnaudon - [#10](https://github.com/BlueBrain/dir-content-diff/pull/10))
22+
- Fix tests for rst2pdf&gt;0.99 (Adrien Berchet - [#9](https://github.com/BlueBrain/dir-content-diff/pull/9))
23+
- Setup Codecov (Adrien Berchet - [#8](https://github.com/BlueBrain/dir-content-diff/pull/8))
24+
25+
<!-- auto-changelog-above -->
1126

1227
## [1.0.1](https://github.com/BlueBrain/dir-content-diff/compare/1.0.0..1.0.1)
1328

1429
> 16 December 2021
1530
16-
- Improve documentation [#6](https://github.com/BlueBrain/dir-content-diff/pull/6)
31+
- Improve documentation (Adrien Berchet - [#6](https://github.com/BlueBrain/dir-content-diff/pull/6))
1732

1833
## [1.0.0](https://github.com/BlueBrain/dir-content-diff/compare/0.2.0..1.0.0)
1934

2035
> 15 December 2021
2136
22-
- Fix URL [#3](https://github.com/BlueBrain/dir-content-diff/pull/3)
23-
- README.md spelling update [#2](https://github.com/BlueBrain/dir-content-diff/pull/2)
24-
- Change license and open the sources [#1](https://github.com/BlueBrain/dir-content-diff/pull/1)
25-
- Update README (Adrien Berchet - [e72b25a](https://github.com/BlueBrain/dir-content-diff/commit/e72b25ae91ce68e860b65f43c0d19dbaa36d4f20))
37+
- Fix URL (Adrien Berchet - [#3](https://github.com/BlueBrain/dir-content-diff/pull/3))
38+
- README.md spelling update (alex4200 - [#2](https://github.com/BlueBrain/dir-content-diff/pull/2))
39+
- Change license and open the sources (Adrien Berchet - [#1](https://github.com/BlueBrain/dir-content-diff/pull/1))
2640

2741
## [0.2.0](https://github.com/BlueBrain/dir-content-diff/compare/0.1.0..0.2.0)
2842

0 commit comments

Comments
 (0)