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
5 changes: 0 additions & 5 deletions .ci/lint-js.sh

This file was deleted.

14 changes: 0 additions & 14 deletions .ci/lint-python-bash.sh

This file was deleted.

21 changes: 0 additions & 21 deletions .ci/lint-cpp.sh → .ci/lint/lint-openmp-pragmas.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,6 @@

set -e -E -u -o pipefail

echo "running cpplint"
cpplint \
--filter=-build/c++11,-build/include_subdir,-build/header_guard,-whitespace/line_length \
--recursive ./src ./include ./R-package ./swig ./tests \
|| exit 1
echo "done running cpplint"

echo "running cmakelint"
find \
. \
-type f \
\( -name CMakeLists.txt -o -path "./cmake/*.cmake" \) \
-not -path './external_libs/*' \
-exec cmakelint \
--linelength=120 \
--filter=-convention/filename,-package/stdargs,-readability/wonkycase \
{} \+ \
|| exit 1
echo "done running cmakelint"

echo "checking that all OpenMP pragmas specify num_threads()"
get_omp_pragmas_without_num_threads() {
grep \
Expand Down Expand Up @@ -52,4 +32,3 @@ if test "${PROBLEMATIC_LINES}" != ""; then
echo "For details, see https://www.openmp.org/spec-html/5.0/openmpse14.html#x54-800002.6"
exit 1
fi
echo "done checking OpenMP pragmas"
113 changes: 57 additions & 56 deletions .ci/lint-powershell.ps1 → .ci/lint/lint-powershell.ps1
Original file line number Diff line number Diff line change
@@ -1,56 +1,57 @@
$settings = @{
Severity = @(
'Information',
'Warning',
'Error'
)
IncludeDefaultRules = $true
# Additional rules that are disabled by default
Rules = @{
PSAvoidExclaimOperator = @{
Enable = $true
}
PSAvoidLongLines = @{
Enable = $true
MaximumLineLength = 120
}
PSAvoidSemicolonsAsLineTerminators = @{
Enable = $true
}
PSPlaceCloseBrace = @{
Enable = $true
NoEmptyLineBefore = $true
IgnoreOneLineBlock = $true
NewLineAfter = $false
}
PSPlaceOpenBrace = @{
Enable = $true
OnSameLine = $true
NewLineAfter = $true
IgnoreOneLineBlock = $true
}
PSUseConsistentIndentation = @{
Enable = $true
IndentationSize = 4
PipelineIndentation = 'IncreaseIndentationAfterEveryPipeline'
Kind = 'space'
}
PSUseConsistentWhitespace = @{
Enable = $true
CheckInnerBrace = $true
CheckOpenBrace = $true
CheckOpenParen = $true
CheckOperator = $true
CheckSeparator = $true
CheckPipe = $true
CheckPipeForRedundantWhitespace = $true
CheckParameter = $true
IgnoreAssignmentOperatorInsideHashTable = $false
}
PSUseCorrectCasing = @{
Enable = $true
}
}
}

Invoke-ScriptAnalyzer -Path ./ -Recurse -EnableExit -Settings $settings
$settings = @{
Severity = @(
'Information',
'Warning',
'Error'
)
IncludeDefaultRules = $true
# Additional rules that are disabled by default
Rules = @{
PSAvoidExclaimOperator = @{
Enable = $true
}
PSAvoidLongLines = @{
Enable = $true
MaximumLineLength = 120
}
PSAvoidSemicolonsAsLineTerminators = @{
Enable = $true
}
PSPlaceCloseBrace = @{
Enable = $true
NoEmptyLineBefore = $true
IgnoreOneLineBlock = $true
NewLineAfter = $false
}
PSPlaceOpenBrace = @{
Enable = $true
OnSameLine = $true
NewLineAfter = $true
IgnoreOneLineBlock = $true
}
PSUseConsistentIndentation = @{
Enable = $true
IndentationSize = 4
PipelineIndentation = 'IncreaseIndentationAfterEveryPipeline'
Kind = 'space'
}
PSUseConsistentWhitespace = @{
Enable = $true
CheckInnerBrace = $true
CheckOpenBrace = $true
CheckOpenParen = $true
CheckOperator = $true
CheckSeparator = $true
CheckPipe = $true
CheckPipeForRedundantWhitespace = $true
CheckParameter = $true
IgnoreAssignmentOperatorInsideHashTable = $false
}
PSUseCorrectCasing = @{
Enable = $true
}
}
}

Install-Module -Name PSScriptAnalyzer -Scope CurrentUser -SkipPublisherCheck
Invoke-ScriptAnalyzer -Path ./.ci -Recurse -EnableExit -Settings $settings
1 change: 1 addition & 0 deletions .ci/lint-r-code.R → .ci/lint/lint-r-code.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ FILES_TO_LINT <- list.files(
, recursive = TRUE
, include.dirs = FALSE
)
FILES_TO_LINT <- FILES_TO_LINT[!grepl(paste0("^", file.path(".", ".pixi", "")), FILES_TO_LINT)]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand this one. The line above already is saying "only look at files ending in .r or .rmd" (ignoring casing).... what files like that are in ./.pixi/?


# text to use for pipe operators from packages like 'magrittr'
pipe_text <- paste0(
Expand Down
28 changes: 0 additions & 28 deletions .ci/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -98,34 +98,6 @@ if [[ $TASK == "swig" ]]; then
exit 0
fi

if [[ $TASK == "lint" ]]; then
pwsh -command "Install-Module -Name PSScriptAnalyzer -Scope CurrentUser -SkipPublisherCheck"
echo "Linting PowerShell code"
pwsh -file ./.ci/lint-powershell.ps1 || exit 1
conda create -q -y -n "${CONDA_ENV}" \
"${CONDA_PYTHON_REQUIREMENT}" \
'biome>=1.9.3' \
'cmakelint>=1.4.3' \
'cpplint>=1.6.0' \
'matplotlib-base>=3.9.1' \
'mypy>=1.11.1' \
'pre-commit>=3.8.0' \
'pyarrow-core>=17.0' \
'scikit-learn>=1.5.2' \
'r-lintr>=3.1.2'
# shellcheck disable=SC1091
source activate "${CONDA_ENV}"
echo "Linting Python and bash code"
bash ./.ci/lint-python-bash.sh || exit 1
echo "Linting R code"
Rscript ./.ci/lint-r-code.R "${BUILD_DIRECTORY}" || exit 1
echo "Linting C++ code"
bash ./.ci/lint-cpp.sh || exit 1
echo "Linting JavaScript code"
bash ./.ci/lint-js.sh || exit 1
exit 0
fi

if [[ $TASK == "check-docs" ]] || [[ $TASK == "check-links" ]]; then
conda env create \
-n "${CONDA_ENV}" \
Expand Down
2 changes: 2 additions & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
watch_file pixi.toml pixi.lock
eval "$(pixi shell-hook)"
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# SCM syntax highlighting & preventing 3-way merges
pixi.lock merge=binary linguist-language=YAML linguist-generated=true
33 changes: 23 additions & 10 deletions .github/workflows/static_analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,27 @@ env:
PYTHON_VERSION: '3.13'

jobs:
test:
name: ${{ matrix.task }}
lint:
name: lint
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 5
submodules: false
- name: Setup pixi
uses: prefix-dev/[email protected]
with:
environments: lint
- name: Run pre-commit
run: pixi run lint

python-check-docs:
name: python-check-docs
runs-on: ubuntu-latest
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
include:
- task: lint
- task: check-docs
steps:
- name: Checkout repository
uses: actions/checkout@v4
Expand All @@ -41,12 +52,13 @@ jobs:
- name: Setup and run tests
shell: bash
run: |
export TASK="${{ matrix.task }}"
export TASK="check-docs"
export BUILD_DIRECTORY="$GITHUB_WORKSPACE"
export CONDA=${HOME}/miniforge
export PATH=${CONDA}/bin:$HOME/.local/bin:${PATH}
$GITHUB_WORKSPACE/.ci/setup.sh || exit 1
$GITHUB_WORKSPACE/.ci/test.sh || exit 1

r-check-docs:
name: r-package-check-docs
timeout-minutes: 60
Expand Down Expand Up @@ -83,10 +95,11 @@ jobs:
echo ""
exit 1
fi

all-static-analysis-jobs-successful:
if: always()
runs-on: ubuntu-latest
needs: [test, r-check-docs]
needs: [lint, python-check-docs, r-check-docs]
steps:
- name: Note that all tests succeeded
uses: re-actors/[email protected]
Expand Down
Loading
Loading