-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
More CI (mypy, coverage), setup pre-commit, formatting #24
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
7f56587
add pre-commit config file
benbovy 3cf66eb
clang format tweaks
benbovy 88386af
run black
benbovy 55e39e7
ci: add mypy gha workflow
benbovy c6111d0
add pre-commit note in README
benbovy 68d1432
fix mypy gha job
benbovy f6eb8ba
fix trailing whitespace
benbovy 3c35bbd
configure mypy
benbovy ee2fdf3
use micromamba gha for tests
benbovy d55f7b5
fix tests gha
benbovy 2dc00c9
typo
benbovy 80a2fc7
enable coverage
benbovy 2df03ab
try fix codecov upload
benbovy a99ba9d
add coverage badge in README
benbovy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,17 @@ | ||
--- | ||
Language: Cpp | ||
BasedOnStyle: Google | ||
ColumnLimit: 100 | ||
TabWidth: 4 | ||
IndentWidth: 4 | ||
PointerAlignment: Left | ||
ReferenceAlignment: Pointer | ||
IndentAccessModifiers: false | ||
AccessModifierOffset: -4 | ||
BinPackArguments: false | ||
BinPackParameters: false | ||
ExperimentalAutoDetectBinPacking: false | ||
AllowAllParametersOfDeclarationOnNextLine: false | ||
AllowShortFunctionsOnASingleLine: Empty | ||
AllowShortLambdasOnASingleLine: Inline | ||
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
branches: [main] | ||
|
||
name: Lint | ||
|
||
jobs: | ||
lint: | ||
name: mypy | ||
runs-on: ubuntu-latest | ||
defaults: | ||
run: | ||
shell: bash -l {0} | ||
|
||
steps: | ||
- name: Checkout repo | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup micromamba | ||
uses: mamba-org/provision-with-micromamba@v15 | ||
with: | ||
environment-file: ci/environment.yml | ||
environment-name: spherely-dev | ||
extra-specs: | | ||
python=3.11 | ||
|
||
- name: Build and install spherely | ||
run: | | ||
python -m pip install . -v --no-build-isolation | ||
|
||
- name: Install mypy | ||
run: | | ||
python -m pip install 'mypy<0.990' | ||
|
||
- name: Run mypy | ||
run: | | ||
python -m mypy --install-types --non-interactive | ||
benbovy marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.4.0 | ||
hooks: | ||
- id: trailing-whitespace | ||
- id: end-of-file-fixer | ||
- id: check-yaml | ||
- id: debug-statements | ||
- id: mixed-line-ending | ||
- repo: https://github.com/psf/black | ||
rev: 23.1.0 | ||
hooks: | ||
- id: black | ||
args: [--safe, --quiet] | ||
- repo: https://github.com/pre-commit/mirrors-clang-format | ||
rev: v15.0.7 | ||
hooks: | ||
- id: clang-format | ||
args: [--style=file] | ||
|
||
ci: | ||
autofix_prs: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -54,4 +54,4 @@ Predicates | |
intersects | ||
contains | ||
within | ||
disjoint | ||
disjoint |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't have any opinion about how C++ code should look like, and how much we want to customize compared to the base Google style (so happy to follow your preferences). But just to consider, s2geography just follows google (https://github.com/paleolimbot/s2geography/blob/master/.clang-format), and arrow uses only minimal overrides (https://github.com/apache/arrow/blob/main/.clang-format)
(but so +1 on adding a linter for this to enforce consistent style!)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't have strong opinions either and I think it is a good idea to stay close to the Google style used by s2geography and not add too much customization. This is just to fix some minor things I find annoying, like packing some of the parameters on the same line when all the parameters don't fit on one line, e.g., I prefer this:
over this:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As mentioned, I don't mind (as long as it is automated), so just follow your preferences ;)