Skip to content
Open
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
39 changes: 39 additions & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
---
# AMS clang-tidy configuration
#
# Run manually: clang-tidy -p build/ src/AMSlib/wf/workflow.hpp
# Integrated via the pre-commit git hook.

Checks: >
-*,
bugprone-*,
-bugprone-easily-swappable-parameters,
-bugprone-narrowing-conversions,
misc-*,
-misc-non-private-member-variables-in-classes,
-misc-no-recursion,
modernize-*,
-modernize-use-trailing-return-type,
-modernize-avoid-c-arrays,
-modernize-use-nodiscard,
performance-*,
readability-identifier-naming

WarningsAsErrors: ''

HeaderFilterRegex: 'src/AMSlib/.*'

CheckOptions:
- key: readability-identifier-naming.ClassCase
value: CamelCase
- key: readability-identifier-naming.PrivateMemberPrefix
value: '_'
- key: readability-identifier-naming.FunctionCase
value: camelBack
- key: readability-identifier-naming.NamespaceCase
value: lower_case
- key: modernize-use-override.AllowOverrideAndFinal
value: false
- key: performance-unnecessary-value-param.AllowedTypes
value: 'std::shared_ptr;std::unique_ptr'

34 changes: 34 additions & 0 deletions .githooks/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/usr/bin/env bash
#
# Git pre-commit hook for AMS:
# Runs non-mutating checks on staged C/C++ and Python files.
#
# Install:
# git config core.hooksPath .githooks
#
# Skip temporarily:
# git commit --no-verify
#
# Skip only clang-tidy:
# AMS_SKIP_TIDY=1 git commit
#
# Specify build directory (for compile_commands.json):
# export AMS_BUILD_DIR=/path/to/build
#
# Apply fixes explicitly:
# scripts/run-code-quality.sh --fix
#
# Requires: clang-format, clang-tidy, ruff on PATH
# clang-tidy requires compile_commands.json (generated by cmake)

set -euo pipefail

REPO_ROOT=$(git rev-parse --show-toplevel)
SCRIPT="${REPO_ROOT}/scripts/run-code-quality.sh"

if [[ ! -f "$SCRIPT" ]]; then
echo "ERROR: missing helper script: $SCRIPT"
exit 1
fi

exec bash "$SCRIPT" --check --staged --fail-on-partial
1 change: 0 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ cmake_policy(SET CMP0074 NEW)

project(AMS VERSION 0.1.1 LANGUAGES CXX C)


# NOTE: This may break some of our integrations with the applications. But flux requires > C++20, RMQ requires C++17 and although AMS does not have
# any restrictions on the CXX standard the application may impose those. The solution would be to compile RMQ with an older GCC version (8) and
# have flux to be an external of the system environment
Expand Down
64 changes: 17 additions & 47 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ dependencies = [
"flux-python>=0.75.0"
]

[project.optional-dependencies]
dev = [
"ruff",
]

[project.scripts]
AMSBroker = "ams_wf.AMSBroker:main"
AMSDBStage = "ams_wf.AMSDBStage:main"
Expand All @@ -56,62 +61,27 @@ AMSDeploy = "ams_wf.AMSDeploy:main"
package-dir = {"" = "src/AMSWorkflow"}
packages = ["ams_wf", "ams"]

# Black formatting
[tool.black]
line-length = 120
include = '\.pyi?$'
exclude = '''
/(
.eggs # exclude a few common directories in the
| .git # root of the project
| .hg
| .mypy_cache
| .tox
| venv
| _build
| buck-out
| build
| dist
)/
'''

# iSort
[tool.isort]
profile = "black"
line_length = 120
multi_line_output = 3
include_trailing_comma = true
virtual_env = "venv"

# flake8
[tool.flake8]
ignore = ["E501", "W503", "E226", "BLK100", "E203"]
max-line-length = 120
exclude = [
# No need to traverse our git directory
".git",
# There's no value in checking cache directories
"__pycache__",
"*.egg-info",
"build"
]
# E501: Line too long
# W503: Line break occurred before binary operator
# E226: Missing white space around arithmetic operator

[tool.ruff]
lint.ignore = ["E501", "E226", "E203"]
line-length = 120
show-fixes = true
exclude = [
".git",
"__pycache__",
"*.egg-info",
"build"
]
# change the default line length number or characters.
line-length = 120
lint.select = ['E', 'F', 'W', 'A', 'PLC', 'PLE', 'PLW', 'I', 'N', 'Q']

[tool.yapf]
ignore = ["E501", "W503", "E226", "BLK100", "E203"]
column_limit = 120
[tool.ruff.lint]
select = ['E', 'F', 'W', 'A', 'PLC', 'PLE', 'PLW', 'I', 'N', 'Q', 'B', 'UP', 'SIM', 'RUF']
ignore = ["E501", "E226", "E203"]

[tool.ruff.lint.isort]
known-first-party = ["ams", "ams_wf"]

[tool.ruff.format]
quote-style = "double"
indent-style = "space"

Loading
Loading