Skip to content

Commit

Permalink
Merge pull request #3 from compas-dev/configurable-style-folders
Browse files Browse the repository at this point in the history
add configurable style folders
  • Loading branch information
gonzalocasas authored Nov 1, 2023
2 parents ea6ba1f + 067a873 commit 32140bc
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 16 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

- uses: compas-dev/compas-actions.build@v1.1.1
- uses: compas-dev/compas-actions.build@v3
with:
test_lint: true
invoke_lint: true
6 changes: 3 additions & 3 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
steps:
- uses: actions/checkout@v2

- uses: compas-dev/compas-actions.docs@v1.4.1
- uses: compas-dev/compas-actions.docs@v2
id: docs
with:
dest: deploy
Expand All @@ -32,11 +32,11 @@ jobs:
keep_history: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

outputs:
commit_type: ${{ steps.docs.outputs.commit_type }}
current_version: ${{ steps.docs.outputs.current_version }}

docVersions:
needs: build
if: needs.build.outputs.commit_type == 'tag'
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,9 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

- uses: compas-dev/compas-actions.build@v1.1.1
- uses: compas-dev/compas-actions.build@v3
with:
test_lint: true
test_compas: false
invoke_lint: true

Release:
needs: Build
Expand Down
6 changes: 4 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

* Added `lint_folders` and `format_folders` optionals in settings. Defaults to `["src", "tests"]`.

### Changed

* Fixed `AttributeError` when GH component `prefix` is not specified in settings.
Expand All @@ -22,7 +24,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changed

- Use context to locate ironpython install if not provided
* Use context to locate ironpython install if not provided

### Removed

Expand All @@ -33,7 +35,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changed

- Fixed cleanup of GH User components
* Fixed cleanup of GH User components

### Removed

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ line-length = 120

[tool.pytest.ini_options]
minversion = "6.0"
testpaths = ["tests", "src/compas_invocations"]
testpaths = ["tests"]
python_files = [
"test_*.py",
"tests.py"
Expand Down
2 changes: 1 addition & 1 deletion requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ matplotlib
nbsphinx
pydocstyle
pytest >=3.2
sphinx >=3.4
sphinx >=3.4, <=7.1.2
sphinx_compas_theme >=0.15.18
twine
wheel
Expand Down
9 changes: 6 additions & 3 deletions src/compas_invocations/style.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,20 @@
def lint(ctx):
"""Check the consistency of coding style."""
print("Running flake8 python linter...")
ctx.run("flake8 src tests")
folders = ctx.get("lint_folders") or ["src", "tests"]
ctx.run("flake8 {}".format(" ".join(folders)))

print("Running black python linter...")
ctx.run("black --check --diff --color src tests")
folders = ctx.get("format_folders") or ["src", "tests"]
ctx.run("black --check --diff --color {}".format(" ".join(folders)))


@invoke.task()
def format(ctx):
"""Reformat the code base using black."""
print("Running black python formatter...")
ctx.run("black src tests")
folders = ctx.get("format_folders") or ["src", "tests"]
ctx.run("black {}".format(" ".join(folders)))


@invoke.task()
Expand Down
8 changes: 7 additions & 1 deletion tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,10 @@
build.clean,
build.release,
)
ns.configure({"base_folder": os.path.dirname(__file__)})
ns.configure(
{
"base_folder": os.path.dirname(__file__),
"lint_folders": ["src", "tests"],
"format_folders": ["src", "tests"],
}
)

0 comments on commit 32140bc

Please sign in to comment.