Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
[flake8]
ignore =
# Module level import not at top of file
E402
# Whitespace before ':'; Removed per Black documentation
E203
# Invalid escape sequence
W605
# Python3.7+ compatibility checks
W606
# Ambiguous variable name l
E741
# Line break occurred before a binary operator
W503
# Missing docstring in public module
D100
# Missing docstring in public class
D101
# Missing docstring in public method
D102
# Missing docstring in public function
D103
# Missing docstring in public package
D104
# Missing docstring in magic method
D105
# Missing docstring in __init__
D107
# One-line docstring should fit on one line with quotes
D200
# No blank lines allowed after function docstring
D202
# 1 blank line required between summary line and description
D205
# First line should end with a period
D400
# First line should be in imperative mood
D401
max-line-length = 79
max-complexity = 18
select = B,C,D,E,F,W,T4,B9
extend-ignore = E203
18 changes: 18 additions & 0 deletions .isort.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#
# Copyright (c) 2022 by Delphix. All rights reserved.
#

[settings]
default_section=THIRDPARTY

extra_standard_library=posixpath,ntpath,Queue

# Every import should try its best to be on one line
force_single_line=True

# Settings needed to be compatible with black
multi_line_output=3
include_trailing_comma=True
force_grid_wrap=0
use_parentheses=True
line_length=79
39 changes: 39 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
repos:
- repo: https://github.com/psf/black
rev: 22.3.0
hooks:
- id: black
exclude: >
(?x)^(
)$
args: [--line-length=79]
- repo: https://github.com/pycqa/flake8
rev: 3.9.2
hooks:
- id: flake8
exclude: >
(?x)^(
)$
- repo: local
hooks:
- id: copyright
name: copyright
entry: copyright.sh
language: script
types: [text]
exclude: >
(?x)^(
.flake8|
.pre-commit-config.yaml|
pyproject.toml|
schema.json|
.*__init__.py|
src/templates/service_file_template.txt|
src/config/logger_conf.ini|
README.md|
.github/workflows/codeql.yml|
.github/CODEOWNERS|
.isort.cfg|
LICENSE|
.gitignore|
)$
23 changes: 23 additions & 0 deletions copyright.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash
#
# Copyright (c) 2022, 2023 by Delphix. All rights reserved.
#

function verify_copyright() {
file=$1
current_year=$(date +%Y)
if [[ $(grep -e "Copyright (c).*$current_year .*Delphix. All rights reserved." "$file") ]] ; then
return 0
else
echo "Copyright check failed for file: $file"
return 1
fi

}

code=0
for file in "$@" ; do
verify_copyright "$file"
code=$(($? + $code))
done
exit $code
Loading