Skip to content

Commit 1785ad7

Browse files
authored
Merge pull request #41 from Tieqiong/linting
style: add pre-commit
2 parents ec370af + 5e9ea98 commit 1785ad7

File tree

167 files changed

+14149
-17309
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

167 files changed

+14149
-17309
lines changed

.clang-format

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
BasedOnStyle: Google
2+
3+
IndentWidth: 2
4+
ContinuationIndentWidth: 2
5+
TabWidth: 2
6+
UseTab: Never
7+
8+
ColumnLimit: 80
9+
10+
SortIncludes: false

.codespell/ignore_words.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Please include explanations for each ignored word (lowercase).
2+
# See https://docs.openverse.org/meta/codespell.html for docs.
3+
4+
# src/diffpy/srreal/BaseDebyeSum.cpp:231,233
5+
# variable name
6+
multipl
7+
8+
# src/tests/TestScatteringFactorTable.hpp:73-80
9+
# Custom alias name of C in test
10+
Ccustom

.flake8

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# As of now, flake8 does not natively support configuration via pyproject.toml
2+
# https://github.com/microsoft/vscode-flake8/issues/135
3+
[flake8]
4+
exclude =
5+
.git,
6+
__pycache__,
7+
build,
8+
dist,
9+
doc/source/conf.py
10+
site_scons/* # bring it back after updating scons tools
11+
max-line-length = 115
12+
# Ignore some style 'errors' produced while formatting by 'black'
13+
# https://black.readthedocs.io/en/stable/guides/using_black_with_other_tools.html#labels-why-pycodestyle-warnings
14+
extend-ignore = E203

.gitignore

Lines changed: 101 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,26 @@
1-
# Compiled Object files
2-
*.slo
3-
*.lo
4-
*.o
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
.exp
6+
.lib
7+
.dll
58

69
# Compiled Dynamic libraries
710
*.so
811
*.dylib
912

13+
# Compiled Object files
14+
*.slo
15+
*.lo
16+
*.o
17+
1018
# Compiled Static libraries
1119
*.lai
1220
*.la
1321
*.a.sconf_temp
1422

1523
# SCons build files
16-
*.pyc
1724
.gdb_history
1825
.sconf_temp/
1926
.sconsign.dblite
@@ -24,16 +31,98 @@ errors.err
2431
/sconsvars.py
2532
tags
2633

27-
# eclipse
34+
# Distribution / packaging
35+
.Python
36+
env/
37+
build/
38+
_build/
39+
develop-eggs/
40+
dist/
41+
downloads/
42+
eggs/
43+
.eggs/
44+
lib/
45+
lib64/
46+
parts/
47+
sdist/
48+
var/
49+
venv/
50+
*.egg-info/
51+
.installed.cfg
52+
*.egg
53+
bin/
54+
temp/
55+
tags/
56+
errors.err
57+
58+
# PyInstaller
59+
# Usually these files are written by a python script from a template
60+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
61+
*.manifest
62+
*.spec
63+
64+
# Installer logs
65+
pip-log.txt
66+
pip-delete-this-directory.txt
67+
MANIFEST
68+
69+
# Unit test / coverage reports
70+
htmlcov/
71+
.tox/
72+
.coverage
73+
.coverage.*
74+
.cache
75+
nosetests.xml
76+
coverage.xml
77+
*,cover
78+
.hypothesis/
79+
80+
# Translations
81+
*.mo
82+
*.pot
83+
84+
# Mr Developer
85+
.mr.developer.cfg
2886
.project
2987
.pydevproject
3088

31-
# source distribution tarball
32-
libdiffpy-*.tar.gz
89+
# Django stuff:
90+
*.log
91+
92+
# Sphinx documentation
93+
docs/build/
94+
docs/source/generated/
95+
96+
# pytest
97+
.pytest_cache/
98+
99+
# PyBuilder
100+
target/
33101

102+
# Editor files
103+
# mac
104+
.DS_Store
105+
*~
34106

107+
# vim
108+
*.swp
109+
*.swo
110+
111+
# pycharm
112+
.idea/
113+
114+
# VSCode
115+
.vscode/
116+
117+
# Visual Studio
35118
.vs/*
36-
.exp
37-
.lib
38-
.dll
39-
.vscode/*
119+
120+
# eclipse
121+
.project
122+
.pydevproject
123+
124+
# Ipython Notebook
125+
.ipynb_checkpoints
126+
127+
# source distribution tarball
128+
libdiffpy-*.tar.gz

.isort.cfg

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[settings]
2+
# Keep import statement below line_length character limit
3+
line_length = 115
4+
multi_line_output = 3
5+
include_trailing_comma = True

.pre-commit-config.yaml

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
default_language_version:
2+
python: python3
3+
4+
exclude: (?x)^.*\.(cif|dat)$
5+
6+
ci:
7+
autofix_commit_msg: |
8+
[pre-commit.ci] auto fixes from pre-commit hooks
9+
autofix_prs: true
10+
autoupdate_branch: "pre-commit-autoupdate"
11+
autoupdate_commit_msg: "[pre-commit.ci] pre-commit autoupdate"
12+
autoupdate_schedule: monthly
13+
skip: [no-commit-to-branch]
14+
submodules: false
15+
16+
repos:
17+
- repo: https://github.com/pre-commit/pre-commit-hooks
18+
rev: v4.6.0
19+
hooks:
20+
- id: check-yaml
21+
- id: end-of-file-fixer
22+
- id: trailing-whitespace
23+
- id: check-case-conflict
24+
- id: check-merge-conflict
25+
- id: check-toml
26+
- id: check-added-large-files
27+
28+
- repo: https://github.com/psf/black
29+
rev: 24.4.2
30+
hooks:
31+
- id: black
32+
files: \.py$
33+
34+
- repo: https://github.com/pycqa/isort
35+
rev: 5.13.2
36+
hooks:
37+
- id: isort
38+
args: ["--profile", "black"]
39+
files: \.py$
40+
41+
- repo: https://github.com/pycqa/flake8
42+
rev: 7.0.0
43+
hooks:
44+
- id: flake8
45+
files: \.py$
46+
47+
- repo: https://github.com/pre-commit/mirrors-clang-format
48+
rev: v20.1.6
49+
hooks:
50+
- id: clang-format
51+
name: clang-format (C/C++)
52+
files: \.(c|cpp|cc|cxx|h|hpp|hh)$
53+
54+
# Add this back after maintainance
55+
# - repo: https://github.com/cpplint/cpplint
56+
# rev: 2.0.2
57+
# hooks:
58+
# - id: cpplint
59+
# name: cpplint (C/C++)
60+
# files: \.(c|cc|cpp|cxx|h|hh|hpp|hxx)$
61+
# args:
62+
# - --filter=
63+
# -whitespace/line_length
64+
# ,-legal/copyright
65+
# ,-build/header_guard
66+
# ,-build/include_order
67+
# ,-build/include_what_you_use
68+
69+
- repo: https://github.com/codespell-project/codespell
70+
rev: v2.3.0
71+
hooks:
72+
- id: codespell
73+
additional_dependencies:
74+
- tomli
75+
args:
76+
- "--ignore-words=./.codespell/ignore_words.txt"
77+
78+
- repo: https://github.com/pre-commit/pre-commit-hooks
79+
rev: v4.4.0
80+
hooks:
81+
- id: no-commit-to-branch
82+
name: Prevent commit to main branch
83+
args: ["--branch", "main"]
84+
stages: [pre-commit]

.travis-sconscript.local

Lines changed: 0 additions & 34 deletions
This file was deleted.

0 commit comments

Comments
 (0)